* 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
This commit is contained in:
Stefan Monnier 2012-06-27 11:11:28 -04:00
parent 7b953864ba
commit d5c6faf921
11 changed files with 231 additions and 191 deletions

View file

@ -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'.

View file

@ -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.
@ -1595,6 +1594,18 @@ Like `cl-labels' but the definitions are not recursive.
(if (assq 'function newenv) newenv
(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.
@ -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'.

View file

@ -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.