all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: <tomas@tuxteam.de>
Cc: help-gnu-emacs@gnu.org
Subject: Re: call-process and incremental display of output
Date: Wed, 17 Oct 2018 11:34:14 +0200	[thread overview]
Message-ID: <87in20x6g9.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <20181017092156.GE31501@tuxteam.de> (tomas@tuxteam.de's message of "Wed, 17 Oct 2018 11:21:56 +0200")

* > 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	other threads:[~2018-10-17  9:34 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-16 13:25 call-process and incremental display of output Florian Weimer
2018-10-16 14:21 ` Michael Albinus
2018-10-16 14:26   ` Florian Weimer
2018-10-16 14:32     ` Michael Albinus
2018-10-16 14:36 ` Stefan Monnier
2018-10-17  8:32   ` Florian Weimer
2018-10-17  9:21     ` tomas
2018-10-17  9:34       ` Florian Weimer [this message]
2018-10-17  9:40         ` tomas
2018-10-17 14:59     ` Stefan Monnier
2018-10-19 21:40       ` John Shahid
2018-10-19 22:05         ` Stefan Monnier
2018-10-19 23:52           ` John Shahid
2018-10-20  2:06             ` Stefan Monnier
2018-10-21 17:05               ` John Shahid
     [not found]                 ` <jwv36szqj1d.fsf-monnier+emacs@gnu.org>
2018-12-26 17:47                   ` John Shahid
2019-02-27 12:59                     ` John Shahid
2019-02-27 14:11                       ` Stefan Monnier
2019-02-28 19:16                         ` John Shahid
2019-02-28 21:56                           ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87in20x6g9.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=tomas@tuxteam.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.