mlf176f2 pushed a commit to branch externals/ergoemacs-mode in repository elpa.
commit 04076440435e7e0a33e0b2f5ae546a44531e8bbd Author: Matthew L. Fidler <[email protected]> Date: Wed Jun 4 08:32:38 2014 -0500 Remove shortcut override mode. --- ergoemacs-modal.el | 1 - ergoemacs-mode.el | 28 +++++------------------- ergoemacs-shortcuts.el | 52 ++++---------------------------------------- ergoemacs-theme-engine.el | 3 +- 4 files changed, 12 insertions(+), 72 deletions(-) diff --git a/ergoemacs-modal.el b/ergoemacs-modal.el index eef348f..94b9cbd 100644 --- a/ergoemacs-modal.el +++ b/ergoemacs-modal.el @@ -214,7 +214,6 @@ modal state is currently enabled." minor-mode-map-alist)) ;; (setq ergoemacs-shortcut-keys t) (ergoemacs-debug "ergoemacs-shortcut-keys: %s" ergoemacs-shortcut-keys) - (ergoemacs-debug "ergoemacs-shortcut-override-mode: %s" ergoemacs-shortcut-override-mode) (ergoemacs-debug "ergoemacs-mode: %s" ergoemacs-mode) (ergoemacs-debug "ergoemacs-unbind-keys: %s" ergoemacs-unbind-keys)) diff --git a/ergoemacs-mode.el b/ergoemacs-mode.el index 1f095ac..c770bac 100644 --- a/ergoemacs-mode.el +++ b/ergoemacs-mode.el @@ -248,7 +248,6 @@ Valid values are: (let (ergoemacs-modal ergoemacs-repeat-keys ergoemacs-read-input-keys - ergoemacs-shortcut-override-mode (keymap (make-sparse-keymap))) (mapc (lambda(key) @@ -326,9 +325,6 @@ remove the keymap depends on user input and KEEP-PRED: (defvar ergoemacs-read-input-keymap (make-sparse-keymap) "Ergoemacs minor mode shortcut input keymap.") -(defvar ergoemacs-shortcut-override-keymap (make-sparse-keymap) - "Keymap for overriding keymap.") - (unless (featurep 'ergoemacs-modal) (load "ergoemacs-modal")) (unless (featurep 'ergoemacs-functions) @@ -697,11 +693,6 @@ However instead of using M-a `eval-buffer', you could use M-a `eb'" (unless ergoemacs-mode (setq ergoemacs-mode t) (ergoemacs-debug "WARNING: ergoemacs-mode was turned off; Turning on.")) - (unless ergoemacs-shortcut-keys - (if ergoemacs-shortcut-override-mode - (ergoemacs-debug "WARNING: ergoemacs-shortcut-keys was turned off, but ergoemacs-shortcut-override-mode is on, keeping off.") - (setq ergoemacs-shortcut-keys t) - (ergoemacs-debug "WARNING: ergoemacs-shortcut-keys was turned off; Turning on."))) (unless ergoemacs-unbind-keys (setq ergoemacs-unbind-keys t) (ergoemacs-debug "WARNING: ergoemacs-unbind-keys was turned off; Turning on."))) @@ -713,12 +704,9 @@ However instead of using M-a `eval-buffer', you could use M-a `eb'" (ergoemacs-debug "WARNING: ergoemacs-unbind-keys was turned on; Turning off.")) (unless ergoemacs-shortcut-keys (setq ergoemacs-shortcut-keys nil) - (ergoemacs-debug "WARNING: ergoemacs-shortcut-keys was turned on; Turning off.")) - (unless ergoemacs-shortcut-override-mode - (setq ergoemacs-shortcut-override-mode nil) - (ergoemacs-debug "WARNING: ergoemacs-shortcut-override-mode was turned on; Turning off.")))) + (ergoemacs-debug "WARNING: ergoemacs-shortcut-keys was turned on; Turning off.")))) -(defun ergoemacs-shuffle-keys (&optional var keymap) +(defun ergoemacs-shuffle-keys (&optional var keymap keymap-list) "Shuffle ergoemacs keymaps. When VAR and KEYMAP are specified, replace the keymap in the `ergoemacs-emulation-mode-map-alist'." @@ -735,10 +723,12 @@ When VAR and KEYMAP are specified, replace the keymap in the (cons x (delq x ergoemacs-emulation-mode-map-alist))))))) ;; Promoted from least to most important '(ergoemacs-shortcut-keys - ergoemacs-shortcut-override-mode ergoemacs-modal ergoemacs-repeat-keys ergoemacs-read-input-keys)) + ;; + ;; ergoemacs-shortcut-keys should be at the bottom of the list + ;; Demote (let ((x (assq 'ergoemacs-unbind-keys minor-mode-map-alist))) (setq minor-mode-map-alist (append (delq x minor-mode-map-alist) (list x))))) @@ -844,10 +834,7 @@ These hooks are deferred to make sure `this-command' is set appropriately.") (when (and (or (not (boundp 'saved-overriding-map)) (eq saved-overriding-map t)) (not unread-command-events)) - (ergoemacs-install-shortcuts-up)) - (when (and (not ergoemacs-show-true-bindings) - (memq this-command ergoemacs-describe-keybindings-functions)) - (ergoemacs-shortcut-override-mode 1)))) + (ergoemacs-install-shortcuts-up)))) (error nil))) (unless (memq this-command ergoemacs-smart-functions) (run-hooks 'ergoemacs-pre-command-hook)) @@ -877,9 +864,6 @@ These hooks are deferred to make sure `this-command' is set appropriately.") (progn (when ergoemacs-mode (ergoemacs-shuffle-keys) - (when (and (not ergoemacs-show-true-bindings) - (memq this-command ergoemacs-describe-keybindings-functions)) - (ergoemacs-shortcut-override-mode -1)) (when (not unread-command-events) (ergoemacs-install-shortcuts-up) (ergoemacs-vars-sync))) diff --git a/ergoemacs-shortcuts.el b/ergoemacs-shortcuts.el index e7f4602..54d4a1d 100644 --- a/ergoemacs-shortcuts.el +++ b/ergoemacs-shortcuts.el @@ -572,14 +572,11 @@ It will replace anything defined by `ergoemacs-translation'" (interactive) ;; Eventually... (let ((cb (current-buffer)) - (key (and (boundp 'key) key)) - (ergoemacs-shortcut-override-mode t)) - (ergoemacs-shortcut-override-mode 1) + (key (and (boundp 'key) key))) (save-excursion (with-help-window (help-buffer) (set-buffer (help-buffer)) - (describe-buffer-bindings cb key))) - (ergoemacs-shortcut-override-mode -1))) + (describe-buffer-bindings cb key))))) (defun ergoemacs-keyboard-quit () "Replacement for `keyboard-quit' and `minibuffer-keyboard-quit'." @@ -592,7 +589,6 @@ It will replace anything defined by `ergoemacs-translation'" (let (defined-fn ergoemacs-shortcut-keys ergoemacs-read-input-keys - ergoemacs-shortcut-override-mode ergoemacs-mode) (setq defined-fn (ergoemacs-key-fn-lookup 'keyboard-quit)) (setq defined-fn @@ -655,9 +651,7 @@ In addition, when the function is called: ((and (boundp 'ergoemacs-test-fn) ergoemacs-test-fn) (setq ergoemacs-test-fn function)) (ergoemacs-describe-key - (ergoemacs-shortcut-override-mode 1) (describe-key key) - (ergoemacs-shortcut-override-mode -1) (setq ergoemacs-describe-key nil)) ((condition-case err (string-match "self-insert" (symbol-name function)) @@ -770,8 +764,7 @@ FORCE-KEY forces keys like <escape> to work properly. " (prog1 (let* (ergoemacs-read-input-keys - ergoemacs-modal - ergoemacs-shortcut-override-mode + ergoemacs-modal ;; Turn on `ergoemacs-shortcut-keys' layer when the ;; prior-key is defined on `ergoemacs-read-input-keymap'. ;; This way keys like <apps> will read the from the @@ -1374,7 +1367,8 @@ argument prompt. (defvar ergoemacs-ignored-prefixes '(;; "C-h" "<f1>" - "C-x" "C-c" "ESC" "<escape>")) + "C-x" "C-c" "ESC" "<escape>" + "<remap>")) (defun ergoemacs-setup-keys-for-layout (layout &optional base-layout) "Setup keys based on a particular LAYOUT. All the keys are based on QWERTY layout." @@ -1461,7 +1455,6 @@ Basically, this gets the keys called and passes the arguments to`ergoemacs-read- (let (ergoemacs-modal ergoemacs-repeat-keys ergoemacs-read-input-keys - ergoemacs-shortcut-override-mode (keymap (make-sparse-keymap))) (mapc (lambda(key) @@ -1732,41 +1725,6 @@ Setup C-c and C-x keys to be described properly.") (defvar ergoemacs-show-true-bindings nil "Show the true bindings. Otherwise, show what the bindings translate to...") -(define-minor-mode ergoemacs-shortcut-override-mode - "Lookup the functions for `ergoemacs-mode' shortcut keys and pretend they are currently bound." - nil - :lighter "" - :global t - :group 'ergoemacs-mode - (if ergoemacs-shortcut-override-mode - (progn - (let ((x (assq 'ergoemacs-shortcut-override-mode - ergoemacs-emulation-mode-map-alist))) - (when x - (setq ergoemacs-emulation-mode-map-alist (delq x ergoemacs-emulation-mode-map-alist))) - ;; Remove shortcuts. - (setq x (assq 'ergoemacs-shortcut-keys ergoemacs-emulation-mode-map-alist)) - (when x - (setq ergoemacs-emulation-mode-map-alist (delq x ergoemacs-emulation-mode-map-alist))) - ;; Create keymap - ;; (ergoemacs-debug-heading "Turn on `ergoemacs-shortcut-override-mode'") - ;; (setq ergoemacs-shortcut-override-keymap (ergoemacs-install-shortcuts-map)) - - ;; (ergoemacs-debug-keymap 'ergoemacs-shortcut-override-keymap) - (push (cons 'ergoemacs-shortcut-override-mode - ergoemacs-shortcut-override-keymap) - ergoemacs-emulation-mode-map-alist) - - ;; (ergoemacs-debug "ergoemacs-emulation-mode-map-alist: %s" (mapcar (lambda(x) (nth 0 x)) ergoemacs-emulation-mode-map-alist)) - ;; (ergoemacs-debug-heading "Finish `ergoemacs-shortcut-override-mode'") - ;; (ergoemacs-debug-flush) - )) - ;; Add back shortcuts. - (let ((x (assq 'ergoemacs-shortcut-keys ergoemacs-emulation-mode-map-alist))) - (when x - (setq ergoemacs-emulation-mode-map-alist (delq x ergoemacs-emulation-mode-map-alist))) - (push (cons 'ergoemacs-shortcut-keys ergoemacs-shortcut-keymap) ergoemacs-emulation-mode-map-alist)))) - (defun ergoemacs-remove-shortcuts (&optional create-overlay) "Removes ergoemacs shortcuts from keymaps." (let ((inhibit-read-only t) diff --git a/ergoemacs-theme-engine.el b/ergoemacs-theme-engine.el index 48de7fe..66205e6 100644 --- a/ergoemacs-theme-engine.el +++ b/ergoemacs-theme-engine.el @@ -1356,9 +1356,9 @@ DONT-COLLAPSE doesn't collapse empty keymaps" (and (not (eq nil theme))(symbolp theme) (symbol-name theme)) (and (stringp ergoemacs-theme) ergoemacs-theme) (and (not (eq nil ergoemacs-theme)) (symbolp ergoemacs-theme) (symbol-name ergoemacs-theme)))) - (setq ergoemacs-emulation-mode-map-alist `(,(cons 'ergoemacs-read-input-keys read-map) + ,() ,(cons 'ergoemacs-shortcut-keys shortcut-map) ,@(mapcar (lambda(remap) @@ -3304,7 +3304,6 @@ When NO-MESSAGE is true, don't tell the user." ergoemacs-shortcut-function-binding-hash (make-hash-table :test 'equal) ergoemacs-emulation-mode-map-alist '() ergoemacs-shortcut-keys nil - ergoemacs-shortcut-override-mode nil ergoemacs-modal nil ergoemacs-repeat-keys nil ergoemacs-read-input-keys nil
