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

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

[nongnu] elpa/evil-escape f59790846c 062/133: Add evil-escape-inhibit va


From: ELPA Syncer
Subject: [nongnu] elpa/evil-escape f59790846c 062/133: Add evil-escape-inhibit variable
Date: Wed, 3 Jan 2024 21:59:53 -0500 (EST)

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

    Add evil-escape-inhibit variable
    
    Useful in wrapper functions around evil-escape's own wrappers.
---
 evil-escape.el | 63 ++++++++++++++++++++++++++++++++--------------------------
 1 file changed, 35 insertions(+), 28 deletions(-)

diff --git a/evil-escape.el b/evil-escape.el
index 0b1e2767bb..c6249e7ba7 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.27
+;; Version: 2.28
 ;; Package-Requires: ((emacs "24") (evil "1.0.9"))
 ;; URL: https://github.com/syl20bnr/evil-escape
 
@@ -128,6 +128,10 @@ This variable is used to restore the original function 
bound to the
 first key of the escape key sequence when `evil-escape'
 mode is disabled.")
 
+(defvar evil-escape-inhibit nil
+  "If non nil then evil-escape does nothing. This variable is used to
+support functions which wrap evil-escape.")
+
 ;;;###autoload
 (define-minor-mode evil-escape-mode
   "Buffer-local minor mode to escape insert state and everythin else
@@ -379,6 +383,7 @@ from the `post-command-hook'."
         (setq evil-escape--first-pass nil))
     ;; second pass
     (evil-escape--define-keys)
+    (setq evil-escape-inhibit nil)
     (remove-hook 'post-command-hook passthrough)))
 
 (defun evil-escape--setup-passthrough (from map &optional shadowed-func)
@@ -391,7 +396,8 @@ from the `post-command-hook'."
                                        ,map
                                        ',shadowed-func
                                        ',passthrough)))
-    (setq evil-escape--first-pass t)
+    (setq evil-escape--first-pass t
+          evil-escape-inhibit t)
     (add-hook 'post-command-hook passthrough)
     (unless (or (bound-and-true-p isearch-mode) (minibufferp))
       (setq unread-command-events
@@ -417,32 +423,33 @@ DELETE-FUNC when calling CALLBACK. "
          (fkeystr (char-to-string fkey))
          (skey (elt keys 1))
          (hl-line-mode-before (when (boundp 'hl-line-mode) hl-line-mode)))
-    (if insert-func (funcall insert-func fkey))
-    ;; global-hl-line-mode seems to be deactivated when `read-event' so we
-    ;; temporarily force line-mode locally to prevent flicker
-    (when (or (bound-and-true-p global-hl-line-mode)
-              (bound-and-true-p hl-line-mode))
-      (hl-line-mode))
-    (let* ((evt (read-event nil nil evil-escape-delay)))
-      (unless hl-line-mode-before (hl-line-mode -1))
-      (cond
-       ((null evt)
-        (unless insert-func
-          (evil-escape--setup-passthrough from map shadowed-func)))
-       ((and (integerp evt)
-             (char-equal evt skey))
-        ;; remove the f character
-        (if delete-func (funcall delete-func))
-        (set-buffer-modified-p modified)
-        ;; disable running transient map
-        (unless (equal "isearch" from)
-          (setq overriding-terminal-local-map nil))
-        (call-interactively callback))
-       (t ; otherwise
-        (unless insert-func
-          (evil-escape--setup-passthrough from map shadowed-func))
-        (setq unread-command-events
-              (append unread-command-events (list evt))))))))
+    (unless evil-escape-inhibit
+      (if insert-func (funcall insert-func fkey))
+      ;; global-hl-line-mode seems to be deactivated when `read-event' so we
+      ;; temporarily force line-mode locally to prevent flicker
+      (when (or (bound-and-true-p global-hl-line-mode)
+                (bound-and-true-p hl-line-mode))
+        (hl-line-mode))
+      (let* ((evt (read-event nil nil evil-escape-delay)))
+        (unless hl-line-mode-before (hl-line-mode -1))
+        (cond
+         ((null evt)
+          (unless insert-func
+            (evil-escape--setup-passthrough from map shadowed-func)))
+         ((and (integerp evt)
+               (char-equal evt skey))
+          ;; remove the f character
+          (if delete-func (funcall delete-func))
+          (set-buffer-modified-p modified)
+          ;; disable running transient map
+          (unless (equal "isearch" from)
+            (setq overriding-terminal-local-map nil))
+          (call-interactively callback))
+         (t ; otherwise
+          (unless insert-func
+            (evil-escape--setup-passthrough from map shadowed-func))
+          (setq unread-command-events
+                (append unread-command-events (list evt)))))))))
 
 (provide 'evil-escape)
 



reply via email to

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