From: Stephen Leake <stephen_leake@stephe-leake.org>
To: emacs-devel <emacs-devel@gnu.org>
Subject: showing process progress while waiting
Date: Wed, 04 Mar 2020 12:03:11 -0800 [thread overview]
Message-ID: <865zfjkhvk.fsf@stephe-leake.org> (raw)
I'm trying to display progress info to the user while they are forced to
wait.
There is a background process that is sending symbol info to Emacs; in
this case several thousand symbols, so it takes a while.
If the user invokes a function that requires the completion table using
those symbols, it waits until all symbols are sent, then returns the
table.
The wait is done in a loop like this:
(with-current-buffer (process-buffer process)
(when (eq command-type 'symbols)
;; show progress in mode line
(setq gpr-query--symbols-progress "")
(add-to-list 'mode-line-misc-info '("" gpr-query--symbols-progress " "))
(force-mode-line-update))
(while (and (process-live-p process)
(not done))
(message (concat "running gpr_query ..." (make-string wait-count ?.)))
;; process output is inserted before point, so move back over it to search it
(goto-char search-start)
(if (re-search-forward gpr-query-prompt (point-max) 1)
(setq done t)
;; else wait for more input
(unless (accept-process-output process 1.0)
;; accept-process returns non-nil when we got output, so we
;; did not wait for timeout.
(setq wait-count (1+ wait-count))
(when (eq command-type 'symbols)
;; update progress
(force-mode-line-update)
(redisplay))
))
))
There is a process filter on the background process that updates
gpr-query--symbols-progress to be "symbols 10%", then "symbols 20%" etc.
However, when I invoke this, the mode line is not updated until I
interrupt it with C-g.
What am I missing?
--
-- Stephe
next reply other threads:[~2020-03-04 20:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-04 20:03 Stephen Leake [this message]
2020-03-05 15:07 ` showing process progress while waiting Stephen Leake
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=865zfjkhvk.fsf@stephe-leake.org \
--to=stephen_leake@stephe-leake.org \
--cc=emacs-devel@gnu.org \
/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.