mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 18:40:39 -08:00
Change the with-delayed-message syntax to allow future extensibility
* doc/lispref/display.texi (Progress): Document it. * lisp/subr.el (with-delayed-message): Change the syntax to allow future extensibility. * lisp/net/eww.el (eww-display-html): Use it.
This commit is contained in:
parent
8c73e6b0f9
commit
9ce0008edd
3 changed files with 9 additions and 7 deletions
|
|
@ -561,13 +561,13 @@ You can rewrite the previous example with this macro as follows:
|
|||
@end example
|
||||
@end defmac
|
||||
|
||||
@defmac with-delayed-message timeout message body@dots{}
|
||||
@defmac with-delayed-message (timeout message) body@dots{}
|
||||
Sometimes it's unclear whether an operation will take a long time to
|
||||
execute or not, or it can be inconvenient to implement a progress
|
||||
reporter. This macro can be used in those situations.
|
||||
|
||||
@lisp
|
||||
(with-delayed-message 2 (format "Gathering data for %s" entry)
|
||||
(with-delayed-message (2 (format "Gathering data for %s" entry))
|
||||
(setq data (gather-data entry)))
|
||||
@end lisp
|
||||
|
||||
|
|
|
|||
|
|
@ -694,7 +694,7 @@ The renaming scheme is performed in accordance with
|
|||
(meta . eww-tag-meta)
|
||||
(a . eww-tag-a)))))
|
||||
(erase-buffer)
|
||||
(with-delayed-message 2 "Rendering HTML..."
|
||||
(with-delayed-message (2 "Rendering HTML...")
|
||||
(shr-insert-document document))
|
||||
(cond
|
||||
(point
|
||||
|
|
|
|||
10
lisp/subr.el
10
lisp/subr.el
|
|
@ -6723,12 +6723,14 @@ as the variable documentation string.
|
|||
(define-keymap--define (list ,@(nreverse opts) ,@defs))
|
||||
,@(and doc (list doc)))))
|
||||
|
||||
(defmacro with-delayed-message (timeout message &rest body)
|
||||
(defmacro with-delayed-message (args &rest body)
|
||||
"Like `progn', but display MESSAGE if BODY takes longer than TIMEOUT seconds.
|
||||
The MESSAGE form will be evaluated immediately, but the resulting
|
||||
string will be displayed only if BODY takes longer than TIMEOUT seconds."
|
||||
(declare (indent 2))
|
||||
`(funcall-with-delayed-message ,timeout ,message
|
||||
string will be displayed only if BODY takes longer than TIMEOUT seconds.
|
||||
|
||||
\(fn (timeout message) &rest body)"
|
||||
(declare (indent 1))
|
||||
`(funcall-with-delayed-message ,(car args) ,(cadr args)
|
||||
(lambda ()
|
||||
,@body)))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue