]> git.eshelyaron.com Git - emacs.git/commitdiff
Change 'type' declaration to 'ftype'
authorAndrea Corallo <acorallo@gnu.org>
Tue, 14 May 2024 07:24:05 +0000 (09:24 +0200)
committerEshel Yaron <me@eshelyaron.com>
Thu, 16 May 2024 08:21:12 +0000 (10:21 +0200)
* 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
lisp/emacs-lisp/byte-run.el
lisp/emacs-lisp/comp.el
lisp/emacs-lisp/lisp.el
lisp/emacs-lisp/regexp-opt.el
lisp/env.el
lisp/files.el
lisp/simple.el
lisp/subr.el
lisp/window.el

index acde2714b0ba135f85761a0a081a583ec83f27b9..5d2a51f5fe3b118cf48f42059691bddbb2439b7a 100644 (file)
@@ -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))
index 392cc86450da500f193e24c7ad1d2118650ca415..04cb183699f78c254abb986103bc449b9e6da5eb 100644 (file)
@@ -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,
index f9fa83da585d320b66ff8c6fe804cff9363d3d25..83ca480616f7937da3500310a9f25f65b6a4ab2f 100644 (file)
@@ -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)
 
index 9edc11ad1324b4073a4d9f4fe42284fe4378d582..e65eec508d9abbd96efb2ad4adf7ef5442e86284 100644 (file)
@@ -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)))
 
index 82a854a18dd4e4a0b406f63b3d2a5d8d96fe656e..f8cba24fc60a1327d2dc27ba09cb058f7bc2ed79 100644 (file)
@@ -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.
index 7d0c7dd0126705518ddc102ed9eb443e3af00f07..28f4f8a1d61175d367fe4bd814a98da04a069421 100644 (file)
@@ -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)
index f3a13d95d778fbe47ff5f1004190a0eaa0410807..7fee742c68b8edca23dfba0679d6b88deaaaa721 100644 (file)
@@ -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
index 154f3f587de129a804a9c934a1487a3da4e32576..1ba3c6dddf96f0b0df2644544648b8eafe67fdc6 100644 (file)
@@ -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))
 
index 3ddc0d192d2a4ee40f57e93405f2842006b40f64..b499cc0cff132c90b21620769fbcfdc7a883761f 100644 (file)
@@ -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))
index a5fbbf41170776df4cccf422fdb9a9f08247b71b..4adad916f475a189870f6574b15752f339bb5c5b 100644 (file)
@@ -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)))