all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Recenter automatically the window showing output buffer
@ 2018-07-08  4:21 Tino Calancha
  2018-07-08 13:22 ` Tino Calancha
  0 siblings, 1 reply; 2+ messages in thread
From: Tino Calancha @ 2018-07-08  4:21 UTC (permalink / raw)
  To: Emacs developers; +Cc: Tino Calancha


Dear Emacs,

I am trying to do something apparently simple, but I cannot make it
work consistenly.

* Start a shell process which print out the string 'Hello!\n'.
* Set a simple sentinel to prevent the buffer from showing
   'Process *shell* finished'.

The output buffer consists of just 2 lines (second is empty).
The window doesn't display 'Hello!': it shows the output buffer 
from line 2.

--8<-----------------------------cut here---------------start------------->8---
(let* ((buf (generate-new-buffer "*foo*"))
       (proc (start-process-shell-command
              "*shell*" buf "printf 'Hello!\n'"))
       (sentinel (lambda (process status)
                   (message "process '%s' %s" (process-name process) status))))
   (set-process-sentinel proc sentinel)
   (display-buffer buf))
--8<-----------------------------cut here---------------start------------->8---

I've tried adding after `display-buffer' the following:
   (let ((recenter-redisplay t)) ; Force a redisplay
     (with-selected-window (get-buffer-window buf) (recenter))))

But it doesn't really make a difference.

How can I achieve the recenter in buf?

Thank you,
Tino



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-07-08 13:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-08  4:21 Recenter automatically the window showing output buffer Tino Calancha
2018-07-08 13:22 ` Tino Calancha

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.