[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master f8354d1935 2/4: Move mh-flet macro to mh-acros.el
From: |
Stefan Kangas |
Subject: |
master f8354d1935 2/4: Move mh-flet macro to mh-acros.el |
Date: |
Sat, 6 Aug 2022 15:23:43 -0400 (EDT) |
branch: master
commit f8354d1935c8900a5b8dada7ba564cdd6dafdc93
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>
Move mh-flet macro to mh-acros.el
* lisp/mh-e/mh-compat.el (mh-flet): Move from here...
* lisp/mh-e/mh-acros.el (mh-flet): ...to here.
---
lisp/mh-e/mh-acros.el | 16 ++++++++++++++++
lisp/mh-e/mh-compat.el | 16 ----------------
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/lisp/mh-e/mh-acros.el b/lisp/mh-e/mh-acros.el
index 805b0820b0..31630b43ca 100644
--- a/lisp/mh-e/mh-acros.el
+++ b/lisp/mh-e/mh-acros.el
@@ -269,6 +269,22 @@ MH-E functions."
binders)
(let* ,binders ,@body))))
+;; 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.
+That is, temporarily rebind the functions listed in BINDINGS and then
+execute BODY. BINDINGS is a list containing one or more lists of the
+form (FUNCNAME ARGLIST BODY...), similar to defun."
+ (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)))
+
(provide 'mh-acros)
;; Local Variables:
diff --git a/lisp/mh-e/mh-compat.el b/lisp/mh-e/mh-compat.el
index 27158fc53a..b7a1271b4e 100644
--- a/lisp/mh-e/mh-compat.el
+++ b/lisp/mh-e/mh-compat.el
@@ -42,22 +42,6 @@
(define-obsolete-function-alias 'mh-assoc-string #'assoc-string "29.1")
(define-obsolete-function-alias 'mh-cancel-timer #'cancel-timer "29.1")
-;; 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.
-That is, temporarily rebind the functions listed in BINDINGS and then
-execute BODY. BINDINGS is a list containing one or more lists of the
-form (FUNCNAME ARGLIST BODY...), similar to defun."
- (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)))
-
(define-obsolete-function-alias 'mh-display-color-cells
#'display-color-cells "29.1")