aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Corallo2020-10-02 22:17:09 +0200
committerAndrea Corallo2020-10-05 20:46:15 +0200
commitad5a2bbde071138cacadd19b95f2638741fd5d8d (patch)
treeda75247557c37de7b2c32f206436be3a54816902
parent323200044f0c3f716f8f78a6f5e39349fe039117 (diff)
downloademacs-ad5a2bbde071138cacadd19b95f2638741fd5d8d.tar.gz
emacs-ad5a2bbde071138cacadd19b95f2638741fd5d8d.zip
Revert "Add `advice-flet' macro"
This reverts commit d07d7ab1a0e321ced62ebe5dd9db27eb7e93430e.
-rw-r--r--lisp/emacs-lisp/nadvice.el26
1 files changed, 0 insertions, 26 deletions
diff --git a/lisp/emacs-lisp/nadvice.el b/lisp/emacs-lisp/nadvice.el
index 21da038dc1c..5b3aa708508 100644
--- a/lisp/emacs-lisp/nadvice.el
+++ b/lisp/emacs-lisp/nadvice.el
@@ -356,32 +356,6 @@ of the piece of advice."
356 (macroexp-let2 nil new `(advice--remove-function ,getter ,function) 356 (macroexp-let2 nil new `(advice--remove-function ,getter ,function)
357 `(unless (eq ,new ,getter) ,(funcall setter new))))) 357 `(unless (eq ,new ,getter) ,(funcall setter new)))))
358 358
359;;;###autoload
360(defmacro advice-flet (bindings &rest body)
361 ;; FIXME add doc.
362 (declare (indent 1))
363 (let ((let-binds ())
364 (ad-add ())
365 (ad-del ()))
366 (dolist (bind bindings)
367 (let* ((fun-name (car bind))
368 (fun (cadr bind))
369 (tmp-sym (gensym (symbol-name fun-name))))
370 (push `(,tmp-sym ,fun) let-binds)
371 (push `(advice-add #',fun-name
372 ,(if (= (length bind) 3)
373 (nth 2 bind)
374 :override)
375 ,tmp-sym)
376 ad-add)
377 (push `(advice-remove #',fun-name ,tmp-sym) ad-del)))
378 `(let ,(reverse let-binds)
379 (unwind-protect
380 (progn
381 ,@(reverse ad-add)
382 ,@body)
383 ,@(reverse ad-del)))))
384
385(defun advice-function-mapc (f function-def) 359(defun advice-function-mapc (f function-def)
386 "Apply F to every advice function in FUNCTION-DEF. 360 "Apply F to every advice function in FUNCTION-DEF.
387F is called with two arguments: the function that was added, and the 361F is called with two arguments: the function that was added, and the