emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/recomplete 0369b805d3: Improve 'with-advice' using gensym


From: ELPA Syncer
Subject: [nongnu] elpa/recomplete 0369b805d3: Improve 'with-advice' using gensym for let bound variable
Date: Tue, 8 Aug 2023 10:00:45 -0400 (EDT)

branch: elpa/recomplete
commit 0369b805d36462103eed6f87d9db870bdf0dbcd7
Author: Campbell Barton <ideasman42@gmail.com>
Commit: Campbell Barton <ideasman42@gmail.com>

    Improve 'with-advice' using gensym for let bound variable
---
 recomplete.el | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/recomplete.el b/recomplete.el
index 1018f7cb64..9c98bc6e56 100644
--- a/recomplete.el
+++ b/recomplete.el
@@ -77,12 +77,13 @@
 
 WHERE using FN-ADVICE temporarily added to FN-ORIG."
   (declare (indent 3))
-  `(let ((fn-advice-var ,fn-advice))
-     (unwind-protect
-         (progn
-           (advice-add ,fn-orig ,where fn-advice-var)
-           ,@body)
-       (advice-remove ,fn-orig fn-advice-var))))
+  (let ((function-var (gensym)))
+    `(let ((,function-var ,fn-advice))
+       (unwind-protect
+           (progn
+             (advice-add ,fn-orig ,where ,function-var)
+             ,@body)
+         (advice-remove ,fn-orig ,function-var)))))
 
 ;; Back-ported from emacs-29.1 (remove once older versions have beeen dropped).
 (defmacro recomplete--with-undo-amalgamate (&rest body)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]