From 155ddde4dd3f6246814ab76bc2f54f4d571bbd15 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 18 Oct 2022 18:43:50 -0400 Subject: (sit-for): Add compiler-macro to warn about obsolete calling convention * lisp/subr.el (sit-for): Add compiler-macro. * lisp/eshell/esh-util.el (eshell-redisplay): * lisp/play/zone.el (zone, zone-pgm-jitter, zone-pgm-whack-chars): (zone-remove-text): Avoid obsolete calling convention. --- lisp/subr.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lisp/subr.el') diff --git a/lisp/subr.el b/lisp/subr.el index 08dfe7aa430..e49c22158f9 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -3270,7 +3270,14 @@ An obsolete, but still supported form is where the optional arg MILLISECONDS specifies an additional wait period, in milliseconds; this was useful when Emacs was built without floating point support." - (declare (advertised-calling-convention (seconds &optional nodisp) "22.1")) + (declare (advertised-calling-convention (seconds &optional nodisp) "22.1") + (compiler-macro + (lambda (form) + (if (not (or (numberp nodisp) obsolete)) form + (macroexp-warn-and-return + "Obsolete calling convention for 'sit-for'" + `(,(car form) (+ ,seconds (/ (or ,nodisp 0) 1000.0)) ,obsolete) + '(obsolete sit-for)))))) ;; This used to be implemented in C until the following discussion: ;; https://lists.gnu.org/r/emacs-devel/2006-07/msg00401.html ;; Then it was moved here using an implementation based on an idle timer, -- cgit v1.2.3