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

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

[elpa] externals/ergoemacs-mode a1dd7a7 09/87: Eat command prefixes that


From: Stefan Monnier
Subject: [elpa] externals/ergoemacs-mode a1dd7a7 09/87: Eat command prefixes that were intercepted by the timer
Date: Wed, 14 Apr 2021 18:46:57 -0400 (EDT)

branch: externals/ergoemacs-mode
commit a1dd7a7290daf9c9a8209c371ae2a8a405c0cea6
Author: Fidler <matthew.fidler@gmail.com>
Commit: Fidler <matthew.fidler@gmail.com>

    Eat command prefixes that were intercepted by the timer
---
 ergoemacs-command-loop.el | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/ergoemacs-command-loop.el b/ergoemacs-command-loop.el
index 27f468a..c9a4d91 100644
--- a/ergoemacs-command-loop.el
+++ b/ergoemacs-command-loop.el
@@ -1140,6 +1140,7 @@ is the :full command loop."
     (cancel-timer ergoemacs-command-loop--prefix-timer)
     (setq ergoemacs-command-loop--prefix-timer nil)))
 
+(defvar ergoemacs-command-loop--eat nil)
 (defun ergoemacs-command-loop--start-for-prefix ()
   "Start the ergoemacs command loop for the currently running prefix key."
   (when (and (not (ergoemacs :modal-p))
@@ -1147,11 +1148,22 @@ is the :full command loop."
             (ergoemacs-keymapp (key-binding (this-single-command-keys)))
              (not (ergoemacs-command-loop-p)))
     (setq ergoemacs-command-loop-start t
-         ergoemacs-command-loop--single-command-keys 
(this-single-command-keys))
+         ergoemacs-command-loop--single-command-keys (this-single-command-keys)
+         ergoemacs-command-loop--eat 
ergoemacs-command-loop--single-command-keys)
     (ergoemacs-command-loop ergoemacs-command-loop--single-command-keys)))
 
+(defun ergoemacs-command-loop--eat ()
+  "Eat the key sequence calling the prefix start."
+  (when ergoemacs-command-loop--eat
+    (message "Eat %s" ergoemacs-command-loop--eat)
+    (let ((map (make-keymap)))
+      (define-key map ergoemacs-command-loop--eat '(lambda () (interactive) 
(setq overriding-terminal-local-map nil)))
+      (setq overriding-terminal-local-map map
+           ergoemacs-command-loop--eat nil))))
+
 (add-hook 'ergoemacs-mode-startup-hook #'ergoemacs-command-loop--prefix-timer)
 (add-hook 'ergoemacs-mode-shutdown-hook 
#'ergoemacs-command-loop--stop-prefix-timer)
+(add-hook 'post-command-hook #'ergoemacs-command-loop--eat)
 
 
 (defun ergoemacs-command-loop--start-with-pre-command-hook ()



reply via email to

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