mlf176f2 pushed a commit to branch externals/ergoemacs-mode in repository elpa.
commit 7af6867e9984c7d0161dca54729006bb780c785c Author: Matthew L. Fidler <[email protected]> Date: Mon Jun 16 09:16:05 2014 -0500 Fix shortcut keys again. --- ergoemacs-modal.el | 1 - ergoemacs-mode.el | 29 ++--------------------------- ergoemacs-shortcuts.el | 41 +++++++++++++---------------------------- 3 files changed, 15 insertions(+), 56 deletions(-) diff --git a/ergoemacs-modal.el b/ergoemacs-modal.el index 4a65f4c..065bdb7 100644 --- a/ergoemacs-modal.el +++ b/ergoemacs-modal.el @@ -201,7 +201,6 @@ modal state is currently enabled." (defun ergoemacs-minibuffer-setup () "Exit temporary overlay maps." - ;; (setq ergoemacs-shortcut-keys t) ) (defun ergoemacs-modal-p () diff --git a/ergoemacs-mode.el b/ergoemacs-mode.el index 5e93d47..1464a00 100644 --- a/ergoemacs-mode.el +++ b/ergoemacs-mode.el @@ -635,30 +635,6 @@ However instead of using M-a `eval-buffer', you could use M-a `eb'" (when ergoemacs-use-aliases (ergoemacs-load-aliases)) -(defun ergoemacs-vars-sync () - "Sync variables. -`ergoemacs-mode' `ergoemacs-shortcut-keys', `ergoemacs-read-input-keys' -`ergoemacs-unbind-keys'." - (if (assq 'ergoemacs-mode minor-mode-map-alist) - (when (or ergoemacs-mode ergoemacs-shortcut-keys - ergoemacs-unbind-keys - ergoemacs-save-variables) - (unless ergoemacs-mode - (setq ergoemacs-mode t) - (ergoemacs-debug "WARNING: ergoemacs-mode 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."))) - (when ergoemacs-mode - (setq ergoemacs-mode nil) - (ergoemacs-debug "WARNING: ergoemacs-mode was turned on; Turning off.")) - (unless ergoemacs-unbind-keys - (setq ergoemacs-unbind-keys nil) - (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.")))) - (defun ergoemacs-shuffle-keys (&optional force-update) "Shuffle ergoemacs keymaps in `minor-mode-map-alist'." (when (or force-update (not (eq (car (nth 0 minor-mode-map-alist)) 'ergoemacs-mode))) @@ -753,7 +729,6 @@ These hooks are deferred to make sure `this-command' is set appropriately.") (condition-case err (progn (ergoemacs-restore-post-command-hook) - (ergoemacs-vars-sync) (when (and ergoemacs-repeat-keys (keymapp ergoemacs-repeat-keymap) (not (lookup-key ergoemacs-repeat-keymap (this-single-command-keys)))) @@ -812,10 +787,10 @@ These hooks are deferred to make sure `this-command' is set appropriately.") (condition-case err (progn (when ergoemacs-mode + (setq ergoemacs-shortcut-keys t) (ergoemacs-shuffle-keys) (when (not unread-command-events) - (ergoemacs-install-shortcuts-up) - (ergoemacs-vars-sync))) + (ergoemacs-install-shortcuts-up))) (when (not ergoemacs-mode) (ergoemacs-remove-shortcuts))) (error (message "Error %s" err)))) diff --git a/ergoemacs-shortcuts.el b/ergoemacs-shortcuts.el index 41d6f60..dafee9a 100644 --- a/ergoemacs-shortcuts.el +++ b/ergoemacs-shortcuts.el @@ -65,7 +65,8 @@ major-mode, minor-mode, and global keys are ignored." (minor-mode-map-alist `((ergoemacs-mode ,@ergoemacs-keymap) (ergoemacs-unbind-keys ,@ergoemacs-unbind-keymap))) - (ergoemacs-emulation-mode-map-alist + (ergoemacs-emulation-mode-map-alist '()) + (ergoemacs-shortcut-emulation-mode-map-alist `((ergoemacs-shortcut-keys ,@ergoemacs-shortcut-keymap))) (old-global-map (current-global-map)) (old-local-map (current-local-map)) @@ -932,33 +933,17 @@ FORCE-KEY forces keys like <escape> to work properly. (setq ret (ergoemacs-read-key-lookup-get-ret fn)) (or ret (commandp fn t))) (unless ret - (cond - ((and ergoemacs-shortcut-keys (not ergoemacs-describe-key) - (not ergoemacs-single-command-keys)) - (if (nth 0 hash) - (progn - (setq fn (nth 0 hash))) - (setq fn (key-binding key)) - (setq fn (or (command-remapping fn (point)) fn))) - (ergoemacs-read-key--echo-command pretty-key fn) - ;; There is some issue with these keys. Read-key - ;; thinks it is in a minibuffer, so the recursive - ;; minibuffer error is raised unless these are put - ;; into unread-command-events. - (ergoemacs-read-key--send-unread key lookup use-override) - (setq ret 'shortcut-workaround)) - (t - (setq fn (or (command-remapping fn (point)) fn)) - (when (memq fn ergoemacs-universal-fns) - (setq ret (ergoemacs-read-key-lookup-get-ret---universal fn))) - (unless ret - (setq ergoemacs-single-command-keys key) - (ergoemacs-read-key--echo-command - pretty-key (or (and (symbolp fn) (symbol-name fn)) - (ergoemacs-unicode-char "λ" "lambda"))) - (ergoemacs-read-key-call fn nil key) - (setq ergoemacs-single-command-keys nil) - (setq ret 'function)))))) + (setq fn (or (command-remapping fn (point)) fn)) + (when (memq fn ergoemacs-universal-fns) + (setq ret (ergoemacs-read-key-lookup-get-ret---universal fn))) + (unless ret + (setq ergoemacs-single-command-keys key) + (ergoemacs-read-key--echo-command + pretty-key (or (and (symbolp fn) (symbol-name fn)) + (ergoemacs-unicode-char "λ" "lambda"))) + (ergoemacs-read-key-call fn nil key) + (setq ergoemacs-single-command-keys nil) + (setq ret 'function)))) ;; Does this call an override or major/minor mode function? ((progn (setq fn (or
