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

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

Re: call-process and incremental display of output


From: Florian Weimer
Subject: Re: call-process and incremental display of output
Date: Wed, 17 Oct 2018 11:34:14 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

* > On Wed, Oct 17, 2018 at 10:32:04AM +0200, Florian Weimer wrote:
>> * Stefan Monnier:
>> 
>> >> (defun fw/get-new-mail ()
>
> [...]
>
>> I see.  Further questions: How can I restore the window configuration
>> after the process terminates?  Is there something similar to
>> save-excursion?
>
> save-window-excursion

Oops, I could have found this myself.

>> How can I make the displayed buffer to scroll to the end?
>
>   (pop-to buffer "foo")
>   (goto-char (point-max))
>
> Don't wrap this in save-excursion :-)

Nice, I now have got this:

(defun fw/get-new-mail ()
  (interactive)
  (let* ((buffer (get-buffer-create "*mbsync*"))
         (status (save-window-excursion
                   (pop-to-buffer buffer)
                   (delete-region (point-min) (point-max))
                   (goto-char (point-max))
                   (call-process "mbsync" nil (list buffer t) t
                                 "-V" "redhat-incoming"))))
    (unless (= 0 status)
      (switch-to-buffer buffer)
      (error "mbsync exit with status %d" status))))

It's not very Emacs-like, but at least I have something to watch while
mail is downloaded.  Thanks!

Florian



reply via email to

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