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

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

[nongnu] scratch/evil 2c33d90e64 2/3: (evil-with-delay): Explicitly fail


From: Stefan Monnier
Subject: [nongnu] scratch/evil 2c33d90e64 2/3: (evil-with-delay): Explicitly fail in old dynbound code
Date: Mon, 21 Aug 2023 09:24:30 -0400 (EDT)

branch: scratch/evil
commit 2c33d90e64eaa62e656f5dfcc97b7b33cbbd396f
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    (evil-with-delay): Explicitly fail in old dynbound code
    
    Reverts commit 9eb69b7f5b3c72cfc66f69b3242e935015780654.
    Supposedly all Evil code uses `lexical-binding` now, so let's take
    full advantage of it and simply signal an error if some code
    forgot to activate `lexical-binding` before using `evil-with-delay`.
---
 evil-common.el | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/evil-common.el b/evil-common.el
index 9504cda27f..fa3d9a13dc 100644
--- a/evil-common.el
+++ b/evil-common.el
@@ -54,18 +54,17 @@ NAME specifies the name of the entry added to HOOK.
 If APPEND is non-nil, the entry is appended to the hook.
 If LOCAL is non-nil, the buffer-local value of HOOK is modified."
   (declare (debug (form sexp body)) (indent 2))
+  (cl-assert lexical-binding)
   (cl-destructuring-bind (hook-sym &optional append local name)
       (mapcar #'macroexp-quote (if (consp hook) hook (list hook)))
     (macroexp-let2* nil
         ((fun-name `(make-symbol
                      ,(or name (format "evil-delay-in-%s" hook-sym))))
-         (fun `(apply-partially
-                (lambda (name &rest _)
-                  (when ,(or condition t)
-                    (remove-hook ,hook-sym name ,local)
-                    ,@body
-                    t))
-                ,fun-name)))
+         (fun `(lambda (&rest _)
+                 (when ,(or condition t)
+                   (remove-hook ,hook-sym ,fun-name ,local)
+                   ,@body
+                   t))))
       `(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]