From 9ecb595dea56ed1149b60245d021cb5e6d7dd73f Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 13 Oct 2023 19:28:30 -0400 Subject: [PATCH] (sit-for): Remove support for old calling convention * lisp/subr.el (sit-for): Remove support for old calling convention * doc/lispref/functions.texi (Obsolete Functions): Adjust wording now that we don't support `sit-for`s old convention any more. * doc/lispref/commands.texi (Waiting): Remove mention of old calling convention for `sit-for`. --- doc/lispref/commands.texi | 4 ---- doc/lispref/functions.texi | 4 ++-- etc/NEWS | 3 +++ lisp/subr.el | 22 ++-------------------- 4 files changed, 7 insertions(+), 26 deletions(-) diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi index 6601135cb85..fdf5ec1d7fe 100644 --- a/doc/lispref/commands.texi +++ b/doc/lispref/commands.texi @@ -3967,10 +3967,6 @@ the timeout elapses). In batch mode (@pxref{Batch Mode}), @code{sit-for} cannot be interrupted, even by input from the standard input descriptor. It is thus equivalent to @code{sleep-for}, which is described below. - -It is also possible to call @code{sit-for} with three arguments, -as @code{(sit-for @var{seconds} @var{millisec} @var{nodisp})}, -but that is considered obsolete. @end defun @defun sleep-for seconds &optional millisec diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index 236b823e7e6..ba0d919549b 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi @@ -2364,8 +2364,8 @@ accepted three arguments, like this (sit-for seconds milliseconds nodisp) @end example -However, calling @code{sit-for} this way is considered obsolete -(@pxref{Waiting}). The old calling convention is deprecated like +During a transition period, the function accepted those three +arguments, but declared this old calling convention as deprecated like this: @example diff --git a/etc/NEWS b/etc/NEWS index a8d028afc9d..3bd47a0112b 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1022,6 +1022,9 @@ The compatibility aliases 'x-defined-colors', 'x-color-defined-p', ** 'easy-mmode-define-{minor,global}-mode' aliases are now obsolete. Use 'define-minor-mode' and 'define-globalized-minor-mode' instead. +** The obsolete calling convention of 'sit-for' has been removed. +That convention was: (sit-for SECONDS MILLISEC &optional NODISP) + * Lisp Changes in Emacs 30.1 diff --git a/lisp/subr.el b/lisp/subr.el index e88815fa58c..58274987d71 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -3408,7 +3408,7 @@ causes it to evaluate `help-form' and display the result." (message "%s%s" prompt (char-to-string char)) char)) -(defun sit-for (seconds &optional nodisp obsolete) +(defun sit-for (seconds &optional nodisp) "Redisplay, then wait for SECONDS seconds. Stop when input is available. SECONDS may be a floating-point value. \(On operating systems that do not support waiting for fractions of a @@ -3417,29 +3417,11 @@ second, floating-point values are rounded down to the nearest integer.) If optional arg NODISP is t, don't redisplay, just wait for input. Redisplay does not happen if input is available before it starts. -Value is t if waited the full time with no input arriving, and nil otherwise. - -An obsolete, but still supported form is -\(sit-for SECONDS &optional MILLISECONDS NODISP) -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") - (compiler-macro - (lambda (form) - (if (not (or (numberp nodisp) obsolete)) form - (macroexp-warn-and-return - (format-message "Obsolete calling convention for `sit-for'") - `(,(car form) (+ ,seconds (/ (or ,nodisp 0) 1000.0)) ,obsolete) - '(obsolete sit-for)))))) +Value is t if waited the full time with no input arriving, and nil otherwise." ;; 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, ;; which was then replaced by the use of read-event. - (if (numberp nodisp) - (setq seconds (+ seconds (* 1e-3 nodisp)) - nodisp obsolete) - (if obsolete (setq nodisp obsolete))) (cond (noninteractive (sleep-for seconds) -- 2.39.2