mlf176f2 pushed a commit to branch externals/ergoemacs-mode in repository elpa.
commit e55ace8e645ff45b0cf335d3ace77d11e8d647dd Author: Matthew L. Fidler <[email protected]> Date: Fri Jun 13 11:48:15 2014 -0500 Fixed shortcut keys. --- ergoemacs-advices.el | 5 ++- ergoemacs-mode.el | 38 +++-------------------------------- ergoemacs-shortcuts.el | 51 +++++++++++++++-------------------------------- 3 files changed, 23 insertions(+), 71 deletions(-) diff --git a/ergoemacs-advices.el b/ergoemacs-advices.el index 9b1cba6..4cd4f15 100644 --- a/ergoemacs-advices.el +++ b/ergoemacs-advices.el @@ -208,8 +208,9 @@ will add MAP to substitution." (progn (setq test (key-description (nth 0 test-hash))) (ergoemacs-pretty-key test)) - (let (ergoemacs-modal ergoemacs-repeat-keys ergoemacs-read-input-keys - ergoemacs-shortcut-keys) + (let (ergoemacs-modal + ergoemacs-repeat-keys ergoemacs-read-input-keys + ergoemacs-shortcut-keys) (ergoemacs-pretty-key (ergoemacs-real-substitute-command-keys (or (and map (concat map string)) string)))))))) diff --git a/ergoemacs-mode.el b/ergoemacs-mode.el index 5e93d47..57b57a0 100644 --- a/ergoemacs-mode.el +++ b/ergoemacs-mode.el @@ -480,9 +480,6 @@ bindings the keymap is: (when (and (intern-soft (format "ergoemacs-%s-hook" major-mode))) (funcall (intern-soft (format "ergoemacs-%s-hook" major-mode)))))) (buffer-list)) - (setq ergoemacs-shortcut-keys t) - (setq ergoemacs-read-input-keys t) ; Hasn't completely been - ; fixed. (when (key-binding [ergoemacs-single-command-keys]) (if (not ergoemacs-read-key-overriding-overlay-save) (setq overriding-terminal-local-map ergoemacs-read-key-overriding-terminal-local-save) @@ -491,7 +488,6 @@ bindings the keymap is: ;; Fix `substitute-command-keys' (fset 'substitute-command-keys (symbol-function 'ergoemacs-substitute-command-keys)) (fset 'completing-read (symbol-function 'ergoemacs-completing-read)) - (setq ergoemacs-unbind-keys t) (add-hook 'pre-command-hook 'ergoemacs-pre-command-hook) (ergoemacs-populate-pre-command-hook) (add-hook 'minibuffer-setup-hook #'ergoemacs-minibuffer-setup) @@ -635,30 +631,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 +725,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)))) @@ -776,9 +747,7 @@ These hooks are deferred to make sure `this-command' is set appropriately.") (format "<override> %s" (key-description (this-single-command-keys)))))) (cond - ((condition-case err - (interactive-form key-binding) - (error nil)) + ((commandp key-binding) (setq this-command key-binding)))) (when (and (or (not (boundp 'saved-overriding-map)) (eq saved-overriding-map t)) @@ -812,10 +781,11 @@ These hooks are deferred to make sure `this-command' is set appropriately.") (condition-case err (progn (when ergoemacs-mode + ;; FIXME Not sure where this is turning off + (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..e8cbfec 100644 --- a/ergoemacs-shortcuts.el +++ b/ergoemacs-shortcuts.el @@ -932,33 +932,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 @@ -967,11 +951,10 @@ FORCE-KEY forces keys like <escape> to work properly. (key-binding key)) ;; Call unbound or global key? (if (eq (lookup-key ergoemacs-unbind-keymap key) 'ergoemacs-undefined) 'ergoemacs-undefined - (let (ergoemacs-read-input-keys) - (if (keymapp (key-binding key)) - (setq ret 'keymap) - (ergoemacs-with-global - (key-binding key))))))) + (if (keymapp (key-binding key)) + (setq ret 'keymap) + (ergoemacs-with-global + (key-binding key)))))) (setq ret (ergoemacs-read-key-lookup-get-ret fn)) (or ret (commandp fn t))) (unless ret @@ -999,9 +982,7 @@ FORCE-KEY forces keys like <escape> to work properly. (when ergoemacs-modal (setq ergoemacs-modal-save ergoemacs-modal)) (setq erogemacs-modal nil) - (set-default 'ergoemacs-modal nil)) - (when ergoemacs-single-command-keys - (setq ergoemacs-read-input-keys nil)))) + (set-default 'ergoemacs-modal nil)))) (defun ergoemacs-read-key-add-translation (key-plist trans) "Adds `ergoemacs-translation-keymap' to KEY-PLIST for TRANS translation.
