summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/cl-macs.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2012-06-27 11:11:28 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2012-06-27 11:11:28 -0400
commitd5c6faf921772e523fc224333d8af142c830a7e6 (patch)
treec56d324652a27862cad6eaa553017b6f8ffef5c1 /lisp/emacs-lisp/cl-macs.el
parent7b953864bad04a37e9cc0e0de4328caf1b4c400e (diff)
downloademacs-d5c6faf921772e523fc224333d8af142c830a7e6.tar.gz
emacs-d5c6faf921772e523fc224333d8af142c830a7e6.tar.bz2
emacs-d5c6faf921772e523fc224333d8af142c830a7e6.zip
* lisp/emacs-lisp/cl.el (flet): Mark obsolete.
* lisp/emacs-lisp/cl-macs.el (cl-flet*): New macro. * lisp/vc/vc-rcs.el (vc-rcs-annotate-command, vc-rcs-parse): * lisp/progmodes/js.el (js-c-fill-paragraph): * lisp/progmodes/ebrowse.el (ebrowse-switch-member-buffer-to-sibling-class) (ebrowse-switch-member-buffer-to-derived-class): * test/automated/ert-x-tests.el (ert-test-run-tests-interactively-2): * lisp/play/5x5.el (5x5-solver): Use cl-flet. Fixes: debbugs:11780
Diffstat (limited to 'lisp/emacs-lisp/cl-macs.el')
-rw-r--r--lisp/emacs-lisp/cl-macs.el14
1 files changed, 13 insertions, 1 deletions
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'.