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

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

[nongnu] elpa/evil-escape 0b62cb6637 025/133: Fix multiple inserted occu


From: ELPA Syncer
Subject: [nongnu] elpa/evil-escape 0b62cb6637 025/133: Fix multiple inserted occurrences of `f` in isearch and ex-command context
Date: Wed, 3 Jan 2024 21:59:49 -0500 (EST)

branch: elpa/evil-escape
commit 0b62cb6637c446639fd6ffb5147c436599a686f6
Author: syl20bnr <sylvain.benner@gmail.com>
Commit: syl20bnr <sylvain.benner@gmail.com>

    Fix multiple inserted occurrences of `f` in isearch and ex-command context
---
 evil-escape.el | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/evil-escape.el b/evil-escape.el
index a21737f5d0..1395c2fd12 100644
--- a/evil-escape.el
+++ b/evil-escape.el
@@ -5,7 +5,7 @@
 ;; Author: Sylvain Benner <sylvain.benner@gmail.com>
 ;; Keywords: convenience editing evil
 ;; Created: 22 Oct 2014
-;; Version: 2.0
+;; Version: 2.01
 ;; Package-Requires: ((emacs "24") (evil "1.0.9"))
 ;; URL: https://github.com/syl20bnr/evil-escape
 
@@ -225,6 +225,14 @@ with a key sequence."
   "Send `q' key press event to exit from a buffer."
   (setq unread-command-events (listify-key-sequence "q")))
 
+(defun evil-escape--execute-shadow-func (func)
+  "Execute the passed FUNC if the context allows it."
+  (unless (or (null func)
+              (eq 'insert evil-state)
+              (and (boundp 'isearch-mode) (symbol-value 'isearch-mode))
+              (minibufferp))
+    (call-interactively func)))
+
 (defun evil-escape--escape
     (keys callback &optional shadowed-func insert-func delete-func)
   "Execute the passed CALLBACK using KEYS. KEYS is a cons cell of 2 characters.
@@ -239,10 +247,6 @@ If INSERT-FUNC is not nil then the first key pressed is 
inserted using the
 If DELETE-FUNC is not nil then the first key is deleted using the function
 DELETE-FUNC when calling CALLBACK. "
   (let* ((modified (buffer-modified-p))
-         (insertf (if insert-func
-                      insert-func 'evil-escape--default-insert-func))
-         (deletef (if delete-func
-                      delete-func 'evil-escape--default-delete-func))
          (fkey (elt keys 0))
          (fkeystr (char-to-string fkey))
          (skey (elt keys 1)))
@@ -250,8 +254,7 @@ DELETE-FUNC when calling CALLBACK. "
     (let* ((evt (read-event nil nil evil-escape-delay)))
       (cond
        ((null evt)
-        (unless (eq 'insert evil-state)
-          (if shadowed-func (call-interactively shadowed-func))))
+        (evil-escape--execute-shadow-func shadowed-func))
        ((and (integerp evt)
              (char-equal evt skey))
         ;; remove the f character
@@ -261,8 +264,7 @@ DELETE-FUNC when calling CALLBACK. "
        (t ; otherwise
         (setq unread-command-events
               (append unread-command-events (list evt)))
-        (unless (eq 'insert evil-state)
-          (if shadowed-func (call-interactively shadowed-func))))))))
+        (evil-escape--execute-shadow-func shadowed-func))))))
 
 (provide 'evil-escape)
 



reply via email to

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