From 193f4f3a4e58e9f420eb06da13ca05f134b91083 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Tue, 14 May 2024 09:24:05 +0200 Subject: [PATCH] Change 'type' declaration to 'ftype' * lisp/window.el (get-lru-window, get-largest-window) (one-window-p): Update function type declaration. * lisp/subr.el (ignore, error, zerop, fixnump, bignump, lsh) (last, eventp, mouse-movement-p, log10, memory-limit) (internal-pop-keymap): Likewise. * lisp/simple.el (count-lines, mark, string-empty-p): Likewise. * lisp/files.el (parse-colon-path): Likewise. * lisp/env.el (getenv): Likewise. * lisp/emacs-lisp/regexp-opt.el (regexp-opt): Likewise. * lisp/emacs-lisp/lisp.el (buffer-end): Likewise. * lisp/emacs-lisp/comp.el (comp--final): Likewise. * lisp/custom.el (custom-variable-p): Likewise. * lisp/emacs-lisp/byte-run.el (defun-declarations-alist): Rename 'type' -> 'ftype'. (cherry picked from commit 6e1bb713f61da3e09b811883ed889067a1cc939b) --- lisp/custom.el | 2 +- lisp/emacs-lisp/byte-run.el | 2 +- lisp/emacs-lisp/comp.el | 4 ++-- lisp/emacs-lisp/lisp.el | 2 +- lisp/emacs-lisp/regexp-opt.el | 2 +- lisp/env.el | 2 +- lisp/files.el | 2 +- lisp/simple.el | 6 +++--- lisp/subr.el | 24 ++++++++++++------------ lisp/window.el | 6 +++--- 10 files changed, 26 insertions(+), 26 deletions(-) diff --git a/lisp/custom.el b/lisp/custom.el index acde2714b0b..5d2a51f5fe3 100644 --- a/lisp/custom.el +++ b/lisp/custom.el @@ -666,7 +666,7 @@ If NOSET is non-nil, don't bother autoloading LOAD when setting the variable." A customizable variable is either (i) a variable whose property list contains a non-nil `standard-value' or `custom-autoload' property, or (ii) an alias for another customizable variable." - (declare (type (function (symbol) t)) + (declare (ftype (function (symbol) t)) (side-effect-free t)) (when (symbolp variable) (setq variable (indirect-variable variable)) diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el index 392cc86450d..04cb183699f 100644 --- a/lisp/emacs-lisp/byte-run.el +++ b/lisp/emacs-lisp/byte-run.el @@ -251,7 +251,7 @@ If `error-free', drop calls even if `byte-compile-delete-errors' is nil.") (list 'completion #'byte-run--set-completion) (list 'modes #'byte-run--set-modes) (list 'interactive-args #'byte-run--set-interactive-args) - (list 'type #'byte-run--set-function-type)) + (list 'ftype #'byte-run--set-function-type)) "List associating function properties to their macro expansion. Each element of the list takes the form (PROP FUN) where FUN is a function. For each (PROP . VALUES) in a function's declaration, diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index f9fa83da585..83ca480616f 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -3325,12 +3325,12 @@ Prepare every function for final compilation and drive the C back-end." ;; are assumed just to be true. Use with extreme caution... (defun comp-hint-fixnum (x) - (declare (type (function (t) fixnum)) + (declare (ftype (function (t) fixnum)) (gv-setter (lambda (val) `(setf ,x ,val)))) x) (defun comp-hint-cons (x) - (declare (type (function (t) cons)) + (declare (ftype (function (t) cons)) (gv-setter (lambda (val) `(setf ,x ,val)))) x) diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el index 9edc11ad132..e65eec508d9 100644 --- a/lisp/emacs-lisp/lisp.el +++ b/lisp/emacs-lisp/lisp.el @@ -534,7 +534,7 @@ major mode's decisions about context.") "Return the \"far end\" position of the buffer, in direction ARG. If ARG is positive, that's the end of the buffer. Otherwise, that's the beginning of the buffer." - (declare (type (function ((or number marker)) integer)) + (declare (ftype (function ((or number marker)) integer)) (side-effect-free error-free)) (if (> arg 0) (point-max) (point-min))) diff --git a/lisp/emacs-lisp/regexp-opt.el b/lisp/emacs-lisp/regexp-opt.el index 82a854a18dd..f8cba24fc60 100644 --- a/lisp/emacs-lisp/regexp-opt.el +++ b/lisp/emacs-lisp/regexp-opt.el @@ -130,7 +130,7 @@ usually more efficient than that of a simplified version: (concat (car parens) (mapconcat \\='regexp-quote strings \"\\\\|\") (cdr parens))))" - (declare (type (function (list &optional t) string)) + (declare (ftype (function (list &optional t) string)) (pure t) (side-effect-free t)) (save-match-data ;; Recurse on the sorted list. diff --git a/lisp/env.el b/lisp/env.el index 7d0c7dd0126..28f4f8a1d61 100644 --- a/lisp/env.el +++ b/lisp/env.el @@ -207,7 +207,7 @@ parameter. Otherwise, this function searches `process-environment' for VARIABLE. If it is not found there, then it continues the search in the environment list of the selected frame." - (declare (type (function (string &optional frame) (or null string))) + (declare (ftype (function (string &optional frame) (or null string))) (side-effect-free t)) (interactive (list (read-envvar-name "Get environment variable: " t))) (let ((value (getenv-internal (if (multibyte-string-p variable) diff --git a/lisp/files.el b/lisp/files.el index f3a13d95d77..7fee742c68b 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -862,7 +862,7 @@ GNU and Unix systems). Substitute environment variables into the resulting list of directory names. For an empty path element (i.e., a leading or trailing separator, or two adjacent separators), return nil (meaning `default-directory') as the associated list element." - (declare (type (function (string) list))) + (declare (ftype (function (string) list))) (when (stringp search-path) (let ((spath (substitute-env-vars search-path)) (double-slash-special-p diff --git a/lisp/simple.el b/lisp/simple.el index 154f3f587de..1ba3c6dddf9 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1774,7 +1774,7 @@ not at the start of a line. When IGNORE-INVISIBLE-LINES is non-nil, invisible lines are not included in the count." - (declare (type (function ((or integer marker) (or integer marker) &optional t) + (declare (ftype (function ((or integer marker) (or integer marker) &optional t) integer)) (side-effect-free t)) (save-excursion @@ -6923,7 +6923,7 @@ is active, and returns an integer or nil in the usual way. If you are using this in an editing command, you are most likely making a mistake; see the documentation of `set-mark'." - (declare (type (function (&optional t) (or integer null))) + (declare (ftype (function (&optional t) (or integer null))) (side-effect-free t)) (if (or force (not transient-mark-mode) mark-active mark-even-if-inactive) (marker-position (mark-marker)) @@ -11088,7 +11088,7 @@ killed." (defun lax-plist-get (plist prop) "Extract a value from a property list, comparing with `equal'." - (declare (type (function (list t) t)) + (declare (ftype (function (list t) t)) (pure t) (side-effect-free t) (obsolete plist-get "29.1")) (plist-get plist prop #'equal)) diff --git a/lisp/subr.el b/lisp/subr.el index 3ddc0d192d2..b499cc0cff1 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -451,7 +451,7 @@ This function accepts any number of arguments in ARGUMENTS. Also see `always'." ;; Not declared `side-effect-free' because we don't want calls to it ;; elided; see `byte-compile-ignore'. - (declare (type (function (&rest t) null)) + (declare (ftype (function (&rest t) null)) (pure t) (completion ignore)) (interactive) nil) @@ -481,7 +481,7 @@ for the sake of consistency. To alter the look of the displayed error messages, you can use the `command-error-function' variable." - (declare (type (function (string &rest t) nil)) + (declare (ftype (function (string &rest t) nil)) (advertised-calling-convention (string &rest args) "23.1")) (signal 'error (list (apply #'format-message args)))) @@ -547,21 +547,21 @@ was called." "Return t if NUMBER is zero." ;; Used to be in C, but it's pointless since (= 0 n) is faster anyway because ;; = has a byte-code. - (declare (type (function (number) boolean)) + (declare (ftype (function (number) boolean)) (pure t) (side-effect-free t) (compiler-macro (lambda (_) `(= 0 ,number)))) (= 0 number)) (defun fixnump (object) "Return t if OBJECT is a fixnum." - (declare (type (function (t) boolean)) + (declare (ftype (function (t) boolean)) (side-effect-free error-free)) (and (integerp object) (<= most-negative-fixnum object most-positive-fixnum))) (defun bignump (object) "Return t if OBJECT is a bignum." - (declare (type (function (t) boolean)) + (declare (ftype (function (t) boolean)) (side-effect-free error-free)) (and (integerp object) (not (fixnump object)))) @@ -575,7 +575,7 @@ Most uses of this function turn out to be mistakes. We recommend to use `ash' instead, unless COUNT could ever be negative, and if, when COUNT is negative, your program really needs the special treatment of negative COUNT provided by this function." - (declare (type (function (integer integer) integer)) + (declare (ftype (function (integer integer) integer)) (compiler-macro (lambda (form) (macroexp-warn-and-return @@ -754,7 +754,7 @@ treatment of negative COUNT provided by this function." If LIST is nil, return nil. If N is non-nil, return the Nth-to-last link of LIST. If N is bigger than the length of LIST, return LIST." - (declare (type (function (list &optional integer) list)) + (declare (ftype (function (list &optional integer) list)) (pure t) (side-effect-free t)) ; pure up to mutation (if n (and (>= n 0) @@ -1592,7 +1592,7 @@ See also `current-global-map'.") (defun eventp (object) "Return non-nil if OBJECT is an input event or event object." - (declare (type (function (t) boolean)) + (declare (ftype (function (t) boolean)) (pure t) (side-effect-free error-free)) (or (integerp object) (and (if (consp object) @@ -1660,7 +1660,7 @@ in the current Emacs session, then this function may return nil." (defsubst mouse-movement-p (object) "Return non-nil if OBJECT is a mouse movement event." - (declare (type (function (t) boolean)) + (declare (ftype (function (t) boolean)) (side-effect-free error-free)) (eq (car-safe object) 'mouse-movement)) @@ -1970,7 +1970,7 @@ be a list of the form returned by `event-start' and `event-end'." (defun log10 (x) "Return (log X 10), the log base 10 of X." - (declare (type (function (number) float)) + (declare (ftype (function (number) float)) (side-effect-free t) (obsolete log "24.4")) (log x 10)) @@ -3261,7 +3261,7 @@ It can be retrieved with `(process-get PROCESS PROPNAME)'." (defun memory-limit () "Return an estimate of Emacs virtual memory usage, divided by 1024." - (declare (type (function () integer)) + (declare (ftype (function () integer)) (side-effect-free error-free)) (let ((default-directory temporary-file-directory)) (or (cdr (assq 'vsize (process-attributes (emacs-pid)))) 0))) @@ -6496,7 +6496,7 @@ To test whether a function can be called interactively, use `commandp'." ;; Kept around for now. See discussion at: ;; https://lists.gnu.org/r/emacs-devel/2020-08/msg00564.html - (declare (type (function () boolean)) + (declare (ftype (function () boolean)) (obsolete called-interactively-p "23.2") (side-effect-free error-free)) (called-interactively-p 'interactive)) diff --git a/lisp/window.el b/lisp/window.el index a5fbbf41170..4adad916f47 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -2515,7 +2515,7 @@ have special meanings: Any other value of ALL-FRAMES means consider all windows on the selected frame and no others." - (declare (type (function (&optional t t t) (or window null))) + (declare (ftype (function (&optional t t t) (or window null))) (side-effect-free error-free)) (let ((windows (window-list-1 nil 'nomini all-frames)) best-window best-time second-best-window second-best-time time) @@ -2595,7 +2595,7 @@ have special meanings: Any other value of ALL-FRAMES means consider all windows on the selected frame and no others." - (declare (type (function (&optional t t t) (or window null))) + (declare (ftype (function (&optional t t t) (or window null))) (side-effect-free error-free)) (let ((best-size 0) best-window size) @@ -4091,7 +4091,7 @@ with a special meaning are: Anything else means consider all windows on the selected frame and no others." - (declare (type (function (&optional t t) boolean)) + (declare (ftype (function (&optional t t) boolean)) (side-effect-free error-free)) (let ((base-window (selected-window))) (if (and nomini (eq base-window (minibuffer-window))) -- 2.39.5