mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-06-14 04:21:24 +00:00
Improve progress-reporter state to remove hard coded length (bug#80988)
Remove hard-coded state range, now a monotonically increasing integer. * lisp/subr.el (progress-reporter-update-functions): Update docstring. (progress-reporter-echo-area): Use 'progress-reporter--pulse-characters' length. (progress-reporter-do-update): Increase 'state' by 1 each pass. * lisp/system-taskbar.el (system-taskbar--progress-reporter-update): Make steps independent of 'progress-reporter-echo-area' steps.
This commit is contained in:
parent
30df8657fb
commit
e4350c538f
2 changed files with 9 additions and 7 deletions
12
lisp/subr.el
12
lisp/subr.el
|
|
@ -7114,8 +7114,7 @@ REPORTER is the result of a call to `make-progress-reporter'.
|
||||||
STATE can be one of:
|
STATE can be one of:
|
||||||
- A float representing the percentage complete in the range 0.0-1.0
|
- A float representing the percentage complete in the range 0.0-1.0
|
||||||
for a numeric reporter.
|
for a numeric reporter.
|
||||||
- An integer representing the index which cycles through the range 0-3
|
- A monotonically increasing integer for a pulsing reporter.
|
||||||
for a pulsing reporter.
|
|
||||||
- The symbol `done' to indicate that the progress reporter is complete.")
|
- The symbol `done' to indicate that the progress reporter is complete.")
|
||||||
|
|
||||||
(defsubst progress-reporter-update (reporter &optional value suffix)
|
(defsubst progress-reporter-update (reporter &optional value suffix)
|
||||||
|
|
@ -7130,7 +7129,7 @@ MIN-VALUE and MAX-VALUE.
|
||||||
Optional argument SUFFIX is a string to be displayed after REPORTER's
|
Optional argument SUFFIX is a string to be displayed after REPORTER's
|
||||||
main message and progress text. If REPORTER is a non-numerical
|
main message and progress text. If REPORTER is a non-numerical
|
||||||
reporter, then VALUE should be nil, or a string to use instead of
|
reporter, then VALUE should be nil, or a string to use instead of
|
||||||
SUFFIX. SUFFIX is considered obsolete and may be removed in the future.
|
SUFFIX.
|
||||||
|
|
||||||
See `progress-reporter-update-functions' for the list of functions
|
See `progress-reporter-update-functions' for the list of functions
|
||||||
called on each update.
|
called on each update.
|
||||||
|
|
@ -7241,8 +7240,9 @@ area is busy with something else."
|
||||||
(message "%s" text)))
|
(message "%s" text)))
|
||||||
((pred integerp)
|
((pred integerp)
|
||||||
(let ((message-log-max nil)
|
(let ((message-log-max nil)
|
||||||
(pulse-char (aref progress-reporter--pulse-characters
|
(pulse-char
|
||||||
state)))
|
(aref progress-reporter--pulse-characters
|
||||||
|
(mod state (length progress-reporter--pulse-characters)))))
|
||||||
(message "%s %s" text pulse-char)))
|
(message "%s %s" text pulse-char)))
|
||||||
('done
|
('done
|
||||||
(message "%sdone" text))))))
|
(message "%sdone" text))))))
|
||||||
|
|
@ -7294,7 +7294,7 @@ area is busy with something else."
|
||||||
(if suffix
|
(if suffix
|
||||||
(aset parameters 6 suffix)
|
(aset parameters 6 suffix)
|
||||||
(setq suffix (or (aref parameters 6) "")))
|
(setq suffix (or (aref parameters 6) "")))
|
||||||
(let ((index (mod (1+ (car reporter)) 4)))
|
(let ((index (1+ (car reporter))))
|
||||||
(setcar reporter index)
|
(setcar reporter index)
|
||||||
(run-hook-with-args 'progress-reporter-update-functions
|
(run-hook-with-args 'progress-reporter-update-functions
|
||||||
reporter
|
reporter
|
||||||
|
|
|
||||||
|
|
@ -282,7 +282,9 @@ REPORTER and STATE are the same as in
|
||||||
((pred floatp)
|
((pred floatp)
|
||||||
(system-taskbar--progress state))
|
(system-taskbar--progress state))
|
||||||
((pred integerp)
|
((pred integerp)
|
||||||
(system-taskbar--progress (/ (1+ state) 4.0)))
|
;; This won't show 0.0 to indicate work in process until done.
|
||||||
|
(system-taskbar--progress
|
||||||
|
(/ (1+ (mod state 5)) 5.0)))
|
||||||
('done
|
('done
|
||||||
(system-taskbar--progress nil)))))
|
(system-taskbar--progress nil)))))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue