@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
(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
(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)))