diff options
| author | Stefan Monnier | 2023-10-13 19:28:30 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2023-10-13 19:28:30 -0400 |
| commit | 9ecb595dea56ed1149b60245d021cb5e6d7dd73f (patch) | |
| tree | b646110c1b55982546dc2544bb708c4819467989 | |
| parent | a5789198b34d83413674e596887c089a651f7cf4 (diff) | |
| download | emacs-9ecb595dea56ed1149b60245d021cb5e6d7dd73f.tar.gz emacs-9ecb595dea56ed1149b60245d021cb5e6d7dd73f.zip | |
(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`.
| -rw-r--r-- | doc/lispref/commands.texi | 4 | ||||
| -rw-r--r-- | doc/lispref/functions.texi | 4 | ||||
| -rw-r--r-- | etc/NEWS | 3 | ||||
| -rw-r--r-- | 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). | |||
| 3967 | In batch mode (@pxref{Batch Mode}), @code{sit-for} cannot be | 3967 | In batch mode (@pxref{Batch Mode}), @code{sit-for} cannot be |
| 3968 | interrupted, even by input from the standard input descriptor. It is | 3968 | interrupted, even by input from the standard input descriptor. It is |
| 3969 | thus equivalent to @code{sleep-for}, which is described below. | 3969 | thus equivalent to @code{sleep-for}, which is described below. |
| 3970 | |||
| 3971 | It is also possible to call @code{sit-for} with three arguments, | ||
| 3972 | as @code{(sit-for @var{seconds} @var{millisec} @var{nodisp})}, | ||
| 3973 | but that is considered obsolete. | ||
| 3974 | @end defun | 3970 | @end defun |
| 3975 | 3971 | ||
| 3976 | @defun sleep-for seconds &optional millisec | 3972 | @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 | |||
| 2364 | (sit-for seconds milliseconds nodisp) | 2364 | (sit-for seconds milliseconds nodisp) |
| 2365 | @end example | 2365 | @end example |
| 2366 | 2366 | ||
| 2367 | However, calling @code{sit-for} this way is considered obsolete | 2367 | During a transition period, the function accepted those three |
| 2368 | (@pxref{Waiting}). The old calling convention is deprecated like | 2368 | arguments, but declared this old calling convention as deprecated like |
| 2369 | this: | 2369 | this: |
| 2370 | 2370 | ||
| 2371 | @example | 2371 | @example |
| @@ -1022,6 +1022,9 @@ The compatibility aliases 'x-defined-colors', 'x-color-defined-p', | |||
| 1022 | ** 'easy-mmode-define-{minor,global}-mode' aliases are now obsolete. | 1022 | ** 'easy-mmode-define-{minor,global}-mode' aliases are now obsolete. |
| 1023 | Use 'define-minor-mode' and 'define-globalized-minor-mode' instead. | 1023 | Use 'define-minor-mode' and 'define-globalized-minor-mode' instead. |
| 1024 | 1024 | ||
| 1025 | ** The obsolete calling convention of 'sit-for' has been removed. | ||
| 1026 | That convention was: (sit-for SECONDS MILLISEC &optional NODISP) | ||
| 1027 | |||
| 1025 | 1028 | ||
| 1026 | * Lisp Changes in Emacs 30.1 | 1029 | * Lisp Changes in Emacs 30.1 |
| 1027 | 1030 | ||
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." | |||
| 3408 | (message "%s%s" prompt (char-to-string char)) | 3408 | (message "%s%s" prompt (char-to-string char)) |
| 3409 | char)) | 3409 | char)) |
| 3410 | 3410 | ||
| 3411 | (defun sit-for (seconds &optional nodisp obsolete) | 3411 | (defun sit-for (seconds &optional nodisp) |
| 3412 | "Redisplay, then wait for SECONDS seconds. Stop when input is available. | 3412 | "Redisplay, then wait for SECONDS seconds. Stop when input is available. |
| 3413 | SECONDS may be a floating-point value. | 3413 | SECONDS may be a floating-point value. |
| 3414 | \(On operating systems that do not support waiting for fractions of a | 3414 | \(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.) | |||
| 3417 | If optional arg NODISP is t, don't redisplay, just wait for input. | 3417 | If optional arg NODISP is t, don't redisplay, just wait for input. |
| 3418 | Redisplay does not happen if input is available before it starts. | 3418 | Redisplay does not happen if input is available before it starts. |
| 3419 | 3419 | ||
| 3420 | Value is t if waited the full time with no input arriving, and nil otherwise. | 3420 | Value is t if waited the full time with no input arriving, and nil otherwise." |
| 3421 | |||
| 3422 | An obsolete, but still supported form is | ||
| 3423 | \(sit-for SECONDS &optional MILLISECONDS NODISP) | ||
| 3424 | where the optional arg MILLISECONDS specifies an additional wait period, | ||
| 3425 | in milliseconds; this was useful when Emacs was built without | ||
| 3426 | floating point support." | ||
| 3427 | (declare (advertised-calling-convention (seconds &optional nodisp) "22.1") | ||
| 3428 | (compiler-macro | ||
| 3429 | (lambda (form) | ||
| 3430 | (if (not (or (numberp nodisp) obsolete)) form | ||
| 3431 | (macroexp-warn-and-return | ||
| 3432 | (format-message "Obsolete calling convention for `sit-for'") | ||
| 3433 | `(,(car form) (+ ,seconds (/ (or ,nodisp 0) 1000.0)) ,obsolete) | ||
| 3434 | '(obsolete sit-for)))))) | ||
| 3435 | ;; This used to be implemented in C until the following discussion: | 3421 | ;; This used to be implemented in C until the following discussion: |
| 3436 | ;; https://lists.gnu.org/r/emacs-devel/2006-07/msg00401.html | 3422 | ;; https://lists.gnu.org/r/emacs-devel/2006-07/msg00401.html |
| 3437 | ;; Then it was moved here using an implementation based on an idle timer, | 3423 | ;; Then it was moved here using an implementation based on an idle timer, |
| 3438 | ;; which was then replaced by the use of read-event. | 3424 | ;; which was then replaced by the use of read-event. |
| 3439 | (if (numberp nodisp) | ||
| 3440 | (setq seconds (+ seconds (* 1e-3 nodisp)) | ||
| 3441 | nodisp obsolete) | ||
| 3442 | (if obsolete (setq nodisp obsolete))) | ||
| 3443 | (cond | 3425 | (cond |
| 3444 | (noninteractive | 3426 | (noninteractive |
| 3445 | (sleep-for seconds) | 3427 | (sleep-for seconds) |