Function: mh-flet
mh-flet is a macro defined in mh-compat.el.gz.
Signature
(mh-flet ((FUNC ARGLIST BODY...) ...) FORM...)
Documentation
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.
Source Code
;; Defined in /usr/src/emacs/lisp/mh-e/mh-compat.el.gz
;; Emacs 24 made flet obsolete and suggested either cl-flet or
;; cl-letf. This macro is based upon gmm-flet from Gnus.
(defmacro mh-flet (bindings &rest body)
"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.
\(fn ((FUNC ARGLIST BODY...) ...) FORM...)"
(declare (indent 1) (debug ((&rest (sexp sexp &rest form)) &rest form)))
(if (fboundp 'cl-letf)
`(cl-letf ,(mapcar (lambda (binding)
`((symbol-function ',(car binding))
(lambda ,@(cdr binding))))
bindings)
,@body)
`(flet ,bindings ,@body)))