* showing process progress while waiting
@ 2020-03-04 20:03 Stephen Leake
2020-03-05 15:07 ` Stephen Leake
0 siblings, 1 reply; 2+ messages in thread
From: Stephen Leake @ 2020-03-04 20:03 UTC (permalink / raw)
To: emacs-devel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-03-05 15:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-04 20:03 showing process progress while waiting Stephen Leake
2020-03-05 15:07 ` Stephen Leake
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.