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

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

call-process and incremental display of output


From: Florian Weimer
Subject: call-process and incremental display of output
Date: Tue, 16 Oct 2018 15:25:17 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

I'm trying to show some progress information while downloading email for
Gnus using an external program.

I think this reproduces the core issue:

(defun fw/get-new-mail ()
  (interactive)
  (let* ((buffer (get-buffer-create "*mbsync*"))
         (status (with-current-buffer buffer
                   (delete-region (point-min) (point-max))
                   (call-process "bash" nil (list buffer t) t
                                 "-c" "
for x in {1..5} ; do
  date
  sleep 1
done
"))))
    (unless (= 0 status)
      (switch-to-buffer buffer)
      (error "mbsync exit with status %d" status))))

When I run this using ‘M-x fw/get-new-mail RET’, the buffer is not
displayed, even though I passed t for the display argument.  The output
from the shell does land in the buffer, which is possible to confirm by
putting a line “exit 1” after the “done“.

Any idea what is necessary to get incremental output?

I'm running GNU Emacs 25.3.1 (x86_64-redhat-linux-gnu, GTK+ Version
3.22.26) of 2018-06-27 (which is usual the Fedora 27 build).

Thanks,
Florian



reply via email to

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