help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Buffer created but why movement command of function ignored?


From: Michael Heerdegen
Subject: Re: Buffer created but why movement command of function ignored?
Date: Wed, 11 Feb 2015 00:48:58 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Chris Seberino <cseberino@gmail.com> writes:

> When I run this function the ansi-term is created but the point
> does NOT move to beginning of buffer.  Why?
>
> (global-set-key (kbd "M-l")       (lambda () (interactive)
>                                           (ansi-term "ls")
>                                           (beginning-of-buffer)))

That's expected.  It's because the output comes from an asynchronous
process and arrives after your function has long given back control to
the command loop.  When your (beginning-of-buffer) is evaluated, the
buffer is there but still empty.

That's why such things are typically done in a process sentinel.


Michael.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]