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

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

[nongnu] elpa/evil-escape c23a84de99 085/133: Handle error in evil-escap


From: ELPA Syncer
Subject: [nongnu] elpa/evil-escape c23a84de99 085/133: Handle error in evil-escape-pre-command-hook
Date: Wed, 3 Jan 2024 21:59:55 -0500 (EST)

branch: elpa/evil-escape
commit c23a84de9943a55a2e778b45fc7d71e30ee9394e
Author: justbur <justin@burkett.cc>
Commit: syl20bnr <sylvain.benner@gmail.com>

    Handle error in evil-escape-pre-command-hook
    
    Otherwise emacs automatically removes the function from the
    pre-command-hook.
---
 evil-escape.el | 41 +++++++++++++++++++++--------------------
 1 file changed, 21 insertions(+), 20 deletions(-)

diff --git a/evil-escape.el b/evil-escape.el
index e1c3871cca..ecaa4991c1 100644
--- a/evil-escape.el
+++ b/evil-escape.el
@@ -150,26 +150,27 @@ with a key sequence."
 
 (defun evil-escape-pre-command-hook ()
   "evil-escape pre-command hook."
-  (when (evil-escape-p)
-    (let ((modified (buffer-modified-p))
-          (inserted (evil-escape--insert))
-          (fkey (elt evil-escape-key-sequence 0))
-          (skey (elt evil-escape-key-sequence 1))
-          (evt (read-event nil nil evil-escape-delay)))
-      (when inserted (evil-escape--delete))
-      (set-buffer-modified-p modified)
-      (cond
-       ((and (integerp evt)
-             (or (and (equal (this-command-keys) (evil-escape--first-key))
-                      (char-equal evt skey))
-                 (and evil-escape-unordered-key-sequence
-                      (equal (this-command-keys) (evil-escape--second-key))
-                      (char-equal evt fkey))))
-        (evil-escape)
-        (setq this-command 'ignore))
-       ((null evt))
-       (t (setq unread-command-events
-                (append unread-command-events (list evt))))))))
+  (with-demoted-errors "evil-escape: Error %S"
+      (when (evil-escape-p)
+        (let ((modified (buffer-modified-p))
+              (inserted (evil-escape--insert))
+              (fkey (elt evil-escape-key-sequence 0))
+              (skey (elt evil-escape-key-sequence 1))
+              (evt (read-event nil nil evil-escape-delay)))
+          (when inserted (evil-escape--delete))
+          (set-buffer-modified-p modified)
+          (cond
+           ((and (integerp evt)
+                 (or (and (equal (this-command-keys) (evil-escape--first-key))
+                          (char-equal evt skey))
+                     (and evil-escape-unordered-key-sequence
+                          (equal (this-command-keys) (evil-escape--second-key))
+                          (char-equal evt fkey))))
+            (evil-escape)
+            (setq this-command 'ignore))
+           ((null evt))
+           (t (setq unread-command-events
+                    (append unread-command-events (list evt)))))))))
 
 (defun evil-escape-p ()
   "Return non-nil if evil-escape can run."



reply via email to

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