[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 9ce0008: Change the with-delayed-message syntax to allow future e
From: |
Lars Ingebrigtsen |
Subject: |
master 9ce0008: Change the with-delayed-message syntax to allow future extensibility |
Date: |
Mon, 25 Oct 2021 11:10:42 -0400 (EDT) |
branch: master
commit 9ce0008edd3be96bf1271d770b8e65c56a334b1c
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
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.
---
doc/lispref/display.texi | 4 ++--
lisp/net/eww.el | 2 +-
lisp/subr.el | 10 ++++++----
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index 6f95728..cc9ca28 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -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
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index e0bc17b..74d3788 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -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
diff --git a/lisp/subr.el b/lisp/subr.el
index 9acc799..86460d9 100644
--- a/lisp/subr.el
+++ b/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)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 9ce0008: Change the with-delayed-message syntax to allow future extensibility,
Lars Ingebrigtsen <=