From: Eshel Yaron Date: Fri, 11 Apr 2025 06:45:50 +0000 (+0200) Subject: Promote 'constantly' from 'cl-constantly' X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=6217415c4f0b69fbca14b59e658f6973270f2895;p=emacs.git Promote 'constantly' from 'cl-constantly' --- diff --git a/lisp/emacs-lisp/cl-lib.el b/lisp/emacs-lisp/cl-lib.el index 381fbee63d3..8694a60d8fa 100644 --- a/lisp/emacs-lisp/cl-lib.el +++ b/lisp/emacs-lisp/cl-lib.el @@ -590,9 +590,6 @@ of record objects." (advice-remove 'type-of #'cl--old-struct-type-of)))) (make-obsolete 'cl-old-struct-compat-mode nil "30.1") -(defun cl-constantly (value) - "Return a function that takes any number of arguments, but returns VALUE." - (lambda (&rest _) - value)) +(defalias 'cl-constantly #'constantly) ;;; cl-lib.el ends here diff --git a/lisp/subr.el b/lisp/subr.el index 1631f4ac621..859407098ac 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -521,6 +521,10 @@ Also see `ignore'." (declare (pure t) (side-effect-free error-free)) t) +(defun constantly (value) + "Return a function that takes any number of arguments, but returns VALUE." + (lambda (&rest _) value)) + (defun error (string &rest args) "Signal an error, making a message by passing ARGS to `format-message'. Errors cause entry to the debugger when `debug-on-error' is non-nil.