emacs-devel
[Top][All Lists]
Advanced

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

Recenter automatically the window showing output buffer


From: Tino Calancha
Subject: Recenter automatically the window showing output buffer
Date: Sun, 8 Jul 2018 13:21:04 +0900 (JST)
User-agent: Alpine 2.20 (DEB 67 2015-01-07)


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



reply via email to

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