* Buffer created but why movement command of function ignored?
@ 2015-02-10 18:13 Chris Seberino
2015-02-10 23:48 ` Michael Heerdegen
0 siblings, 1 reply; 2+ messages in thread
From: Chris Seberino @ 2015-02-10 18:13 UTC (permalink / raw)
To: help-gnu-emacs
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)))
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Buffer created but why movement command of function ignored?
2015-02-10 18:13 Buffer created but why movement command of function ignored? Chris Seberino
@ 2015-02-10 23:48 ` Michael Heerdegen
0 siblings, 0 replies; 2+ messages in thread
From: Michael Heerdegen @ 2015-02-10 23:48 UTC (permalink / raw)
To: help-gnu-emacs
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-02-10 23:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-10 18:13 Buffer created but why movement command of function ignored? Chris Seberino
2015-02-10 23:48 ` Michael Heerdegen
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.