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

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

[nongnu] elpa/spell-fu 540141a576: Improve 'with-advice' using gensym fo


From: ELPA Syncer
Subject: [nongnu] elpa/spell-fu 540141a576: Improve 'with-advice' using gensym for let bound variable
Date: Tue, 8 Aug 2023 10:01:01 -0400 (EDT)

branch: elpa/spell-fu
commit 540141a5764ceb403e78e22f6714e2dab3597bc7
Author: Campbell Barton <ideasman42@gmail.com>
Commit: Campbell Barton <ideasman42@gmail.com>

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

diff --git a/spell-fu.el b/spell-fu.el
index 54e2bf0451..1c8c333e10 100644
--- a/spell-fu.el
+++ b/spell-fu.el
@@ -379,12 +379,13 @@ PROMPT is shown to the users completing read."
 (defmacro spell-fu--with-advice (fn-orig where fn-advice &rest body)
   "Execute BODY with WHERE advice on FN-ORIG temporarily enabled."
   (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)))))
 
 (defmacro spell-fu--with-message-prefix (prefix &rest body)
   "Add text before the message output.



reply via email to

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