* 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)
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))
(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,
;; 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)
"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)))
(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.
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)
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
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
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))
(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))
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)
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))))
"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))))
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
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)
(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)
(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))
(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))
(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)))
`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))
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)
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)
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)))