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

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

[nongnu] elpa/evil 1e9b243426: Fix evil-with-delay with dynamic binding


From: ELPA Syncer
Subject: [nongnu] elpa/evil 1e9b243426: Fix evil-with-delay with dynamic binding
Date: Sun, 13 Aug 2023 03:59:02 -0400 (EDT)

branch: elpa/evil
commit 1e9b2434264529fe0dd964b68fe89236a4abeac3
Author: Axel Forsman <axel@axelf.se>
Commit: Axel Forsman <axel@axelf.se>

    Fix evil-with-delay with dynamic binding
    
    If dynamic binding is used when expanding the macro, then the function
    will not capture fun-name as a closure. Fix this by using
    apply-partially which is defined in a source file that uses lexical
    binding.
---
 evil-common.el | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/evil-common.el b/evil-common.el
index 84b0817c17..9504cda27f 100644
--- a/evil-common.el
+++ b/evil-common.el
@@ -59,11 +59,13 @@ If LOCAL is non-nil, the buffer-local value of HOOK is 
modified."
     (macroexp-let2* nil
         ((fun-name `(make-symbol
                      ,(or name (format "evil-delay-in-%s" hook-sym))))
-         (fun `(lambda (&rest _)
-                 (when ,(or condition t)
-                   (remove-hook ,hook-sym ,fun-name ,local)
-                   ,@body
-                   t))))
+         (fun `(apply-partially
+                (lambda (name &rest _)
+                  (when ,(or condition t)
+                    (remove-hook ,hook-sym name ,local)
+                    ,@body
+                    t))
+                ,fun-name)))
       `(unless ,(and condition `(funcall ,fun))
          (progn (fset ,fun-name ,fun)
                 ,@(when local `((put ,fun-name 'permanent-local-hook t)))



reply via email to

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