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

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

[elpa] externals/ergoemacs-mode 683020a92b 02/13: Fix `ergoemacs-read-ke


From: ELPA Syncer
Subject: [elpa] externals/ergoemacs-mode 683020a92b 02/13: Fix `ergoemacs-read-key` advice to work better with `magit`
Date: Wed, 19 Jan 2022 18:58:19 -0500 (EST)

branch: externals/ergoemacs-mode
commit 683020a92bbcb4a9135f277c6e90a338a49f224e
Author: Matthew Fidler <514778+mattfidler@users.noreply.github.com>
Commit: Matthew Fidler <514778+mattfidler@users.noreply.github.com>

    Fix `ergoemacs-read-key` advice to work better with `magit`
---
 ergoemacs-advice.el | 16 ++++++++++++----
 ergoemacs-mode.el   |  4 ++--
 ergoemacs-themes.el |  1 +
 3 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/ergoemacs-advice.el b/ergoemacs-advice.el
index 39da47e911..de7756f9f8 100644
--- a/ergoemacs-advice.el
+++ b/ergoemacs-advice.el
@@ -99,10 +99,18 @@ TYPE is the type of translation installed."
   (if (and ergoemacs-mode (not ergoemacs--temporary-disable))
       (ergoemacs-mode--undefined-advice)
     (call-interactively orig-fun)))
- 
-(defun ergoemacs-advice-read-key ()
-  "Drop single command keys for read-key." ; For compataiblity with emacs 25.5
-  (setq ergoemacs-command-loop--single-command-keys nil))
+
+(defun ergoemacs-read-key (orig-fun &rest args)
+  "Allow `ergoemacs-mode' to add put prompt into original keys."
+  (if (not (and ergoemacs-mode (not ergoemacs--temporary-disable)))
+      (apply orig-fun args)
+    (if (not (= 1 (length args)))
+        (apply orig-fun args)
+      (setq ergoemacs-command-loop--read-key-prompt
+            (nth 0 args))
+      (unwind-protect
+          (apply orig-fun args)
+        (setq ergoemacs-command-loop--read-key-prompt "")))))
 
 (provide 'ergoemacs-advice)
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
diff --git a/ergoemacs-mode.el b/ergoemacs-mode.el
index 7543ac9d66..32a32eadf9 100644
--- a/ergoemacs-mode.el
+++ b/ergoemacs-mode.el
@@ -483,13 +483,13 @@ after initializing ergoemacs-mode.
                                    (ergoemacs-mode-send-emacs-keys . 
,ergoemacs--send-emacs-keys-map)))
   (add-hook 'emulation-mode-map-alists ergoemacs-override-alist)
   (advice-add 'undefined :around #'ergoemacs-advice-undefined)
-  (advice-add 'read-key :before #'ergoemacs-advice-read-key))
+  (advice-add 'read-key :around #'ergoemacs-read-key))
 
 (defun ergoemacs-remove-override-keymap ()
   "Remove `ergoemacs-mode' keymaps."
   (remove-hook 'emulation-mode-map-alists 'ergoemacs-override-alist)
   (advice-remove 'undefined #'ergoemacs-advice-undefined)
-  (advice-remove 'read-key #'ergoemacs-advice-read-key))
+  (advice-remove 'read-key #'ergoemacs-read-key))
 
 
 ;;; Frequently used commands as aliases
diff --git a/ergoemacs-themes.el b/ergoemacs-themes.el
index 3138f75fa5..00e7a38e3b 100644
--- a/ergoemacs-themes.el
+++ b/ergoemacs-themes.el
@@ -1456,6 +1456,7 @@ In a terminal, this can be either arrow keys (e.g. meta+O 
A == <up>) or regular
 (defvar calc-mode-map)
 (defun ergoemacs-install-calc-bindings ()
   "Install `calc-mode' bindings."
+  ;; These are above `ergoemacs-mode'
   (ergoemacs-save-key-state
    'comint-mode-map
    (define-key calc-mode-map [remap ergoemacs-undo] 'calc-undo)



reply via email to

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