diff options
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/cl-loaddefs.el | 12 | ||||
-rw-r--r-- | lisp/emacs-lisp/cl-macs.el | 14 | ||||
-rw-r--r-- | lisp/emacs-lisp/cl.el | 13 |
3 files changed, 31 insertions, 8 deletions
diff --git a/lisp/emacs-lisp/cl-loaddefs.el b/lisp/emacs-lisp/cl-loaddefs.el index f7eaa3b9f9c..4d7e1ecc8b0 100644 --- a/lisp/emacs-lisp/cl-loaddefs.el +++ b/lisp/emacs-lisp/cl-loaddefs.el @@ -260,12 +260,12 @@ Remove from SYMBOL's plist the property PROPNAME and its value. ;;;;;; cl-deftype cl-defstruct cl-callf2 cl-callf cl-rotatef cl-shiftf ;;;;;; cl-remf cl-psetf cl-declare cl-the cl-locally cl-multiple-value-setq ;;;;;; cl-multiple-value-bind cl-symbol-macrolet cl-macrolet cl-labels -;;;;;; cl-flet cl-progv cl-psetq cl-do-all-symbols cl-do-symbols +;;;;;; cl-flet* cl-flet cl-progv cl-psetq cl-do-all-symbols cl-do-symbols ;;;;;; cl-dotimes cl-dolist cl-do* cl-do cl-loop cl-return-from ;;;;;; cl-return cl-block cl-etypecase cl-typecase cl-ecase cl-case ;;;;;; cl-load-time-value cl-eval-when cl-destructuring-bind cl-function ;;;;;; cl-defmacro cl-defun cl-gentemp cl-gensym) "cl-macs" "cl-macs.el" -;;;;;; "41a15289eda7e6ae03ac9edd86bbb1a6") +;;;;;; "e7bb76130254614df1603a1c1e89cb49") ;;; Generated autoloads from cl-macs.el (autoload 'cl-gensym "cl-macs" "\ @@ -492,6 +492,14 @@ Like `cl-labels' but the definitions are not recursive. (put 'cl-flet 'lisp-indent-function '1) +(autoload 'cl-flet* "cl-macs" "\ +Make temporary function definitions. +Like `cl-flet' but the definitions can refer to previous ones. + +\(fn ((FUNC ARGLIST BODY...) ...) FORM...)" nil t) + +(put 'cl-flet* 'lisp-indent-function '1) + (autoload 'cl-labels "cl-macs" "\ Make temporary function bindings. The bindings can be recursive. Assumes the use of `lexical-binding'. diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index eaa988bfb58..39e230cb32c 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -1570,7 +1570,6 @@ a `let' form, except that the list of symbols can be computed at run-time." (setq cl--labels-convert-cache (cons f res)) res)))))) -;;; This should really have some way to shadow 'byte-compile properties, etc. ;;;###autoload (defmacro cl-flet (bindings &rest body) "Make temporary function definitions. @@ -1596,6 +1595,18 @@ Like `cl-labels' but the definitions are not recursive. (cons (cons 'function #'cl--labels-convert) newenv))))))) ;;;###autoload +(defmacro cl-flet* (bindings &rest body) + "Make temporary function definitions. +Like `cl-flet' but the definitions can refer to previous ones. + +\(fn ((FUNC ARGLIST BODY...) ...) FORM...)" + (declare (indent 1) (debug ((&rest (cl-defun)) cl-declarations body))) + (cond + ((null bindings) (macroexp-progn body)) + ((null (cdr bindings)) `(cl-flet ,bindings ,@body)) + (t `(cl-flet (,(pop bindings)) (cl-flet* ,bindings ,@body))))) + +;;;###autoload (defmacro cl-labels (bindings &rest body) "Make temporary function bindings. The bindings can be recursive. Assumes the use of `lexical-binding'. @@ -2257,6 +2268,7 @@ STRING is an optional description of the desired type." ;;;###autoload (defmacro cl-assert (form &optional show-args string &rest args) + ;; FIXME: This is actually not compatible with Common-Lisp's `assert'. "Verify that FORM returns non-nil; signal an error if not. Second arg SHOW-ARGS means to include arguments of FORM in message. Other args STRING and ARGS... are arguments to be passed to `error'. diff --git a/lisp/emacs-lisp/cl.el b/lisp/emacs-lisp/cl.el index 7996af4e02d..0b6d9cd2223 100644 --- a/lisp/emacs-lisp/cl.el +++ b/lisp/emacs-lisp/cl.el @@ -461,11 +461,13 @@ Common Lisp. ;; This should really have some way to shadow 'byte-compile properties, etc. (defmacro flet (bindings &rest body) - "Make temporary function definitions. -This is an analogue of `let' that operates on the function cell of FUNC -rather than its value cell. The FORMs are evaluated with the specified -function definitions in place, then the definitions are undone (the FUNCs -go back to their previous definitions, or lack thereof). + "Make temporary overriding function definitions. +This is an analogue of a dynamically scoped `let' that operates on the function +cell of FUNCs rather than their value cell. +If you want the Common-Lisp style of `flet', you should use `cl-flet'. +The FORMs are evaluated with the specified function definitions in place, +then the definitions are undone (the FUNCs go back to their previous +definitions, or lack thereof). \(fn ((FUNC ARGLIST BODY...) ...) FORM...)" (declare (indent 1) (debug cl-flet)) @@ -491,6 +493,7 @@ will not work - use `labels' instead" (symbol-name (car x)))) (list `(symbol-function ',(car x)) func))) bindings) ,@body)) +(make-obsolete 'flet "Use either `cl-flet' or `letf'." "24.2") (defmacro labels (bindings &rest body) "Make temporary function bindings. |