[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 89/287: Fix most keybinding issues
From: |
Matthew Fidler |
Subject: |
[elpa] 89/287: Fix most keybinding issues |
Date: |
Wed, 02 Jul 2014 14:44:53 +0000 |
mlf176f2 pushed a commit to branch externals/ergoemacs-mode
in repository elpa.
commit b5bfd7f9aab8c3faee95ff2f97f62d78533e5520
Author: Matthew L. Fidler <address@hidden>
Date: Fri Jun 13 09:32:23 2014 -0500
Fix most keybinding issues
---
ergoemacs-advices.el | 31 ++++++++++---------------------
ergoemacs-theme-engine.el | 36 ++++++++++++++++++++++++++++++++----
2 files changed, 42 insertions(+), 25 deletions(-)
diff --git a/ergoemacs-advices.el b/ergoemacs-advices.el
index 798382f..9b1cba6 100644
--- a/ergoemacs-advices.el
+++ b/ergoemacs-advices.el
@@ -95,27 +95,16 @@ Also adds keymap-flag for user-defined keys run with
`run-mode-hooks'."
(defvar ergoemacs-ignore-advice nil)
(defun ergoemacs-global-set-key-after (key)
(if ergoemacs-ignore-advice nil
- (unless (or (and (vectorp key)
- (memq (elt key 0) '(menu-bar 27 remap)))
- (and (not (vectorp key))
- (string= "ESC" (key-description key))))
- (let ((ergoemacs-ignore-advice t))
- (add-to-list 'ergoemacs-global-changed-cache (key-description key))
- (when ergoemacs-global-not-changed-cache
- (delete (key-description key) ergoemacs-global-not-changed-cache))
- (add-to-list 'ergoemacs-global-override-rm-keys (or (and (vectorp key)
key)
- (read-kbd-macro
(key-description key) t)))
- (setq ergoemacs-shortcut-keymap (ergoemacs-rm-key
ergoemacs-shortcut-keymap key)
- ergoemacs-read-input-keymap (ergoemacs-rm-key
ergoemacs-read-input-keymap key)
- ergoemacs-keymap (ergoemacs-rm-key ergoemacs-keymap key)
- ergoemacs-unbind-keymap (ergoemacs-rm-key ergoemacs-keymap key))
- (remhash key ergoemacs-command-shortcuts-hash)
- (setq ergoemacs-read-emulation-mode-map-alist
- (list (cons 'ergoemacs-read-input-keys
ergoemacs-read-input-keymap))
- ergoemacs-emulation-mode-map-alist
- (append (nbutlast ergoemacs-emulation-mode-map-alist 1)
- (list (cons 'ergoemacs-shortcut-keys
ergoemacs-shortcut-keymap))))
- (ergoemacs-shuffle-keys t)))))
+ (let ((kd (key-description key)))
+ (unless (or (and (vectorp key)
+ (memq (elt key 0) '(menu-bar 27 remap)))
+ (and (not (vectorp key))
+ (string= "ESC" kd)))
+ ;; Let `ergoemacs-mode' know these keys have changed.
+ (pushnew kd ergoemacs-global-changed-cache :test 'equal)
+ (setq ergoemacs-global-not-changed-cache (delete kd
ergoemacs-global-not-changed-cache))
+ ;; Remove the key from `ergoemacs-mode' bindings
+ (ergoemacs-theme-component--ignore-globally-defined-key key t)))))
(defadvice local-set-key (around ergoemacs-local-set-key-advice (key command)
activate)
"This let you use `local-set-key' as usual when `ergoemacs-mode' is enabled."
diff --git a/ergoemacs-theme-engine.el b/ergoemacs-theme-engine.el
index dda5cb8..fc5feef 100644
--- a/ergoemacs-theme-engine.el
+++ b/ergoemacs-theme-engine.el
@@ -1903,19 +1903,47 @@ DONT-COLLAPSE doesn't collapse empty keymaps"
(ergoemacs-theme-obj-install ergoemacs-theme--object 'remove)
(setq ergoemacs-theme-object nil)))
-(defun ergoemacs-theme-component--ignore-globally-defined-key (key)
+(defun ergoemacs-theme-component--ignore-globally-defined-key (key &optional
reset)
"Adds KEY to `ergoemacs-global-override-rm-keys' and
`ergoemacs-global-override-map' if globally redefined."
(let ((ergoemacs-ignore-advice t)
(key (or (and (vectorp key) key) (read-kbd-macro (key-description key)
t)))
- lk)
+ test-key lk)
(catch 'found-global-command
(while (>= (length key) 1)
(setq lk (lookup-key (current-global-map) key))
(when (and (ergoemacs-global-changed-p key)
(or (commandp lk t)
(keymapp lk)))
- ;; Remove from shortcuts, if present
- (remhash key ergoemacs-command-shortcuts-hash)
+ (when reset ;; Reset keymaps
+ ;; Reset keymaps.
+ (dolist (map '(ergoemacs-shortcut-keymap
ergoemacs-read-input-keymap ergoemacs-keymap ergoemacs-unbind-keymap))
+ (set map (ergoemacs-rm-key (symbol-value map) key))
+ (setq lk (lookup-key (symbol-value map) key))
+ (if (not (integerp lk))
+ (setq test-key key)
+ (setq test-key (substring key 0 lk))
+ (setq lk (lookup-key (symbol-value map) test-key)))
+ (when (commandp lk t)
+ (set map (ergoemacs-rm-key (symbol-value map) test-key))))
+ ;; Remove from shortcuts, if present
+ (remhash key ergoemacs-command-shortcuts-hash)
+ ;; Reset `ergoemacs-shortcut-prefix-keys'
+ (setq ergoemacs-shortcut-prefix-keys '())
+ (maphash
+ (lambda(key ignore)
+ (when (< 1 (length key))
+ (pushnew (substring key 0 -1)
+ ergoemacs-shortcut-prefix-keys
+ :test 'equal)))
+ ergoemacs-command-shortcuts-hash)
+ ;; Setup emulation maps.
+ (setq ergoemacs-read-emulation-mode-map-alist
+ (list (cons 'ergoemacs-read-input-keys
ergoemacs-read-input-keymap))
+ ergoemacs-emulation-mode-map-alist
+ (append (nbutlast ergoemacs-emulation-mode-map-alist 1)
+ (list (cons 'ergoemacs-shortcut-keys
ergoemacs-shortcut-keymap))))
+ ;;Put maps in `minor-mode-map-alist'
+ (ergoemacs-shuffle-keys t))
(push key ergoemacs-global-override-rm-keys)
(throw 'found-global-command t))
(setq key (substring key 0 (- (length key) 1)))))))
- [elpa] 94/287: Fixed shortcut keys., (continued)
- [elpa] 94/287: Fixed shortcut keys., Matthew Fidler, 2014/07/02
- [elpa] 127/287: Update documentation again., Matthew Fidler, 2014/07/02
- [elpa] 203/287: Fix the C-e test, Matthew Fidler, 2014/07/02
- [elpa] 198/287: More flexible redo, Issue #239, Matthew Fidler, 2014/07/02
- [elpa] 96/287: Fix shortcut keys again., Matthew Fidler, 2014/07/02
- [elpa] 199/287: Update ergoemacs-test-layout so it wont parse the function, Matthew Fidler, 2014/07/02
- [elpa] 135/287: Fix defcustom, Matthew Fidler, 2014/07/02
- [elpa] 104/287: Fix many compiler warnings with ergoemacs-advices.el, Matthew Fidler, 2014/07/02
- [elpa] 97/287: First attempt for Cask without Cask (I'm on windows), Matthew Fidler, 2014/07/02
- [elpa] 116/287: Take out compiler warnings from ergoemacs-shortcuts.el, Matthew Fidler, 2014/07/02
- [elpa] 89/287: Fix most keybinding issues,
Matthew Fidler <=
- [elpa] 113/287: No more warnings for ergoemacs-modal.el; mapc->dolist, Matthew Fidler, 2014/07/02
- [elpa] 132/287: Be more careful when redefining maps., Matthew Fidler, 2014/07/02
- [elpa] 129/287: Fix compiler warnings for ergoemacs-unbind.el, Matthew Fidler, 2014/07/02
- [elpa] 140/287: Fix Byte Compile Warnings, Matthew Fidler, 2014/07/02
- [elpa] 117/287: Take out compiler errors from ergoemacs-test, Matthew Fidler, 2014/07/02
- [elpa] 93/287: Add ergoemacs-shortcut-emulation-mode-map-alist, Matthew Fidler, 2014/07/02
- [elpa] 119/287: Fix byte-compile warnings for ergoemacs-macros.el, Matthew Fidler, 2014/07/02
- [elpa] 67/287: Completely use the object, Matthew Fidler, 2014/07/02
- [elpa] 134/287: Finalize tests; Passes on windows, Matthew Fidler, 2014/07/02
- [elpa] 101/287: Fix Cask setup?, Matthew Fidler, 2014/07/02