(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`.
This commit is contained in:
Stefan Monnier 2023-10-13 19:28:30 -04:00
parent a5789198b3
commit 9ecb595dea
4 changed files with 7 additions and 26 deletions

View file

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

View file

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

View file

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

View file

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