cl-flet is an autoloaded macro defined in cl-macs.el.gz.
Signature
(cl-flet ((FUNC ARGLIST BODY...) ...) FORM...)
Documentation
Make local function definitions.
Each definition can take the form (FUNC EXP) where
FUNC is the function name, and EXP is an expression that returns the
function value to which it should be bound, or it can take the more common
form (FUNC ARGLIST BODY...) which is a shorthand
for (FUNC (lambda ARGLIST BODY)).
FUNC is defined only within FORM, not BODY, so you can't write
recursive function definitions. Use cl-labels for that. See
info node (cl) Function Bindings for details.
View in manual
References
References in cl-macs.el.gz:
(defmacro cl-flet* ...)
Find all references Functions used by cl-flet
Debugging
Enable edebug Enable tracing
Disassemble Forget
Source Code
/usr/share/emacs/29.3/lisp/emacs-lisp/cl-macs.el.gz
(defmacro cl-flet (bindings &rest body)
"Make local function definitions.
Each definition can take the form (FUNC EXP) where
FUNC is the function name, and EXP is an expression that returns the
function value to which it should be bound, or it can take the more common
form (FUNC ARGLIST BODY...) which is a shorthand
for (FUNC (lambda ARGLIST BODY)).
FUNC is defined only within FORM, not BODY, so you can't write
recursive function definitions. Use `cl-labels' for that. See
info node `(cl) Function Bindings' for details.
\(fn ((FUNC ARGLIST BODY...) ...) FORM...)"
(declare (indent 1)
(debug ((&rest [&or (symbolp form)
(&define [&name symbolp "@cl-flet@"]
[&name [] gensym] cl-lambda-list
cl-declarations-or-string
[&optional ("interactive" interactive)]
def-body)])
cl-declarations body)))
(let ((binds ()) (newenv macroexpand-all-environment))
(dolist (binding bindings)
(let ((var (make-symbol (format "--cl-%s--" (car binding))))
(args-and-body (cdr binding)))
(if (and (= (length args-and-body) 1) (symbolp (car args-and-body)))
(setq var (car args-and-body))
(push (list var (if (= (length args-and-body) 1)
(car args-and-body)
`(cl-function (lambda . ,args-and-body))))
binds))
(push (cons (car binding)
(lambda (&rest args)
(if (eq (car args) cl--labels-magic)
(list cl--labels-magic var)
`(funcall ,var ,@args))))
newenv)))
(macroexp-let* (nreverse binds)
(macroexpand-all
`(progn ,@body)
(if (assq 'function newenv) newenv
(cons (cons 'function #'cl--labels-convert) newenv))))))
Symbol Properties
edebug-form-spec
((&rest
[&or
(symbolp form)
(&define
[&name symbolp "@cl-flet@"]
[&name
[]
gensym]
cl-lambda-list cl-declarations-or-string
[&optional
("interactive" interactive)]
def-body)])
cl-declarations body)
function-history
("/usr/share/emacs/29.3/lisp/emacs-lisp/cl-macs.elc"
(autoload "cl-macs"
("/usr/share/emacs/29.3/lisp/emacs-lisp/cl-loaddefs.elc" . 21484)
nil t))
lisp-indent-function
1