diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2021-10-24 22:20:19 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2021-10-24 22:21:19 +0200 |
commit | c2055d41b4b145aa940ce940adc1a3fabfe87a6b (patch) | |
tree | 1f48428b7a9ff967f5943413e4024602a6ef7ca2 /lisp/subr.el | |
parent | 374f14fb9936d2b8fb30a123457ff4b12160f5f3 (diff) | |
download | emacs-c2055d41b4b145aa940ce940adc1a3fabfe87a6b.tar.gz |
Add new macro `with-delayed-message'
* doc/lispref/display.texi (Progress): Document it.
* lisp/subr.el (with-delayed-message): New macro.
* src/eval.c (with_delayed_message_display)
(with_delayed_message_cancel): Helper functions.
(Ffuncall_with_delayed_message): New function (bug#19776).
Diffstat (limited to 'lisp/subr.el')
-rw-r--r-- | lisp/subr.el | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index 91189787d55..9acc79923c9 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -6723,4 +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) + "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 + (lambda () + ,@body))) + + ;;; subr.el ends here |