]> git.eshelyaron.com Git - emacs.git/commitdiff
Revert "Add `advice-flet' macro"
authorAndrea Corallo <akrl@sdf.org>
Fri, 2 Oct 2020 20:17:09 +0000 (22:17 +0200)
committerAndrea Corallo <akrl@sdf.org>
Mon, 5 Oct 2020 18:46:15 +0000 (20:46 +0200)
This reverts commit d07d7ab1a0e321ced62ebe5dd9db27eb7e93430e.

lisp/emacs-lisp/nadvice.el

index 21da038dc1c604a8b0114e632187d7d0ff43fc92..5b3aa7085082fc2b3146d6b489a4fe080ac69f29 100644 (file)
@@ -356,32 +356,6 @@ of the piece of advice."
     (macroexp-let2 nil new `(advice--remove-function ,getter ,function)
       `(unless (eq ,new ,getter) ,(funcall setter new)))))
 
-;;;###autoload
-(defmacro advice-flet (bindings &rest body)
-  ;; FIXME add doc.
-  (declare (indent 1))
-  (let ((let-binds ())
-        (ad-add ())
-        (ad-del ()))
-    (dolist (bind bindings)
-      (let* ((fun-name (car bind))
-             (fun (cadr bind))
-             (tmp-sym (gensym (symbol-name fun-name))))
-        (push `(,tmp-sym ,fun) let-binds)
-        (push `(advice-add #',fun-name
-                           ,(if (= (length bind) 3)
-                                (nth 2 bind)
-                              :override)
-                           ,tmp-sym)
-              ad-add)
-        (push `(advice-remove #',fun-name ,tmp-sym) ad-del)))
-    `(let ,(reverse let-binds)
-       (unwind-protect
-          (progn
-            ,@(reverse ad-add)
-            ,@body)
-        ,@(reverse ad-del)))))
-
 (defun advice-function-mapc (f function-def)
   "Apply F to every advice function in FUNCTION-DEF.
 F is called with two arguments: the function that was added, and the