[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 19/287: Added `ergoemacs-read-key--echo-command`
From: |
Matthew Fidler |
Subject: |
[elpa] 19/287: Added `ergoemacs-read-key--echo-command` |
Date: |
Wed, 02 Jul 2014 14:44:15 +0000 |
mlf176f2 pushed a commit to branch externals/ergoemacs-mode
in repository elpa.
commit 3b091d1d072bdc3096ec890a5b96242f40354136
Author: Matthew L. Fidler <address@hidden>
Date: Tue May 27 11:32:53 2014 -0500
Added `ergoemacs-read-key--echo-command`
---
ergoemacs-shortcuts.el | 133 ++++++++++++++----------------------------------
1 files changed, 39 insertions(+), 94 deletions(-)
diff --git a/ergoemacs-shortcuts.el b/ergoemacs-shortcuts.el
index 29761f0..5931e04 100644
--- a/ergoemacs-shortcuts.el
+++ b/ergoemacs-shortcuts.el
@@ -740,6 +740,24 @@ to the appropriate values for `ergoemacs-read-key'.
(setq ret (ergoemacs-read-key-lookup-get-ret---universal fn)))
ret))
+(defun ergoemacs-read-key--echo-command (pretty-key command)
+ "Echo that PRETTY-KEY is COMMAND"
+ (when (and ergoemacs-echo-function
+ (boundp 'pretty-key-undefined)
+ (not (or this-command-keys-shift-translated
+ ergoemacs-shift-translated)))
+ (let (message-log-max)
+ (if (string= pretty-key-undefined pretty-key)
+ (when (eq ergoemacs-echo-function t)
+ (message "%s%s%s" pretty-key
+ (ergoemacs-unicode-char "→" "->")
+ command))
+ (message "%s%s%s (from %s)"
+ pretty-key
+ (ergoemacs-unicode-char "→" "->")
+ command
+ pretty-key-undefined)))))
+
(defun ergoemacs-read-key-lookup (prior-key prior-pretty-key key pretty-key
force-key)
"Lookup KEY and run if necessary.
@@ -834,30 +852,14 @@ FORCE-KEY forces keys like <escape> to work properly.
((and (vectorp tmp)
(progn
(setq fn (key-binding tmp))
- (when (condition-case err
- (string-match "self-insert" (symbol-name
fn))
- (error nil))
+ (when (and (symbolp fn) (string-match "self-insert"
(symbol-name fn)))
(setq fn nil))
- (condition-case err
- (interactive-form fn)
- (error nil))))
+ (commandp fn t)))
(setq fn (or (command-remapping fn (point)) fn))
(setq ergoemacs-single-command-keys key)
- (when (and ergoemacs-echo-function
- (boundp 'pretty-key-undefined)
- (not (or this-command-keys-shift-translated
- ergoemacs-shift-translated)))
- (let (message-log-max)
- (if (string= pretty-key-undefined pretty-key)
- (when (eq ergoemacs-echo-function t)
- (message "%s%s%s" pretty-key
- (ergoemacs-unicode-char "→" "->")
- (symbol-name fn)))
- (message "%s%s%s (from %s)"
- pretty-key
- (ergoemacs-unicode-char "→" "->")
- (symbol-name fn)
- pretty-key-undefined))))
+ (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 'translate-fn))
@@ -870,21 +872,8 @@ FORCE-KEY forces keys like <escape> to work properly.
(setq unread-command-events (append (listify-key-sequence
tmp) unread-command-events))
(ergoemacs-defer-post-command-hook)
(reset-this-command-lengths)
- (when (and ergoemacs-echo-function
- (boundp 'pretty-key-undefined)
- (not (or this-command-keys-shift-translated
- ergoemacs-shift-translated)))
- (let (message-log-max)
- (if (string= pretty-key-undefined pretty-key)
- (when (eq ergoemacs-echo-function t)
- (message "%s%s%s" pretty-key
- (ergoemacs-unicode-char "→" "->")
- (ergoemacs-pretty-key (key-description
tmp))))
- (message "%s%s%s (from %s)"
- pretty-key
- (ergoemacs-unicode-char "→" "->")
- (ergoemacs-pretty-key (key-description tmp))
- pretty-key-undefined))))
+ (ergoemacs-read-key--echo-command
+ pretty-key (ergoemacs-pretty-key (key-description tmp)))
(when lookup
(define-key lookup [ergoemacs-single-command-keys] 'ignore)
(setq ergoemacs-read-key-overriding-terminal-local-save
overriding-terminal-local-map)
@@ -894,7 +883,7 @@ FORCE-KEY forces keys like <escape> to work properly.
((progn
(setq fn (ergoemacs-get-override-function key))
(setq ret (ergoemacs-read-key-lookup-get-ret fn))
- (or ret (condition-case err (interactive-form fn) nil)))
+ (or ret (commandp fn t)))
(unless ret
(ergoemacs-read-key-call fn nil key)
(setq ret 'local-function-override)))
@@ -903,10 +892,7 @@ FORCE-KEY forces keys like <escape> to work properly.
(setq hash (gethash key ergoemacs-command-shortcuts-hash))
(setq fn (key-binding key))
(setq ret (ergoemacs-read-key-lookup-get-ret fn))
- (or ret
- (condition-case err
- (interactive-form fn)
- nil)))
+ (or ret (commandp fn t)))
(unless ret
(cond
((and hash (eq 'string (type-of (nth 0 hash)))
@@ -934,49 +920,20 @@ FORCE-KEY forces keys like <escape> to work properly.
(setq
ergoemacs-read-key-overriding-terminal-local-save overriding-terminal-local-map)
(setq overriding-terminal-local-map lookup)))
(setq ret 'kbd-shortcut))
- ((and hash
- (condition-case err
- (interactive-form (nth 0 hash))
- (error nil)))
- (when (and ergoemacs-echo-function
- (boundp 'pretty-key-undefined)
- (not (or this-command-keys-shift-translated
- ergoemacs-shift-translated)))
- (let (message-log-max)
- (if (string= pretty-key-undefined pretty-key)
- (when (eq ergoemacs-echo-function t)
- (message "%s%s%s" pretty-key
- (ergoemacs-unicode-char "→" "->")
- (symbol-name (nth 0 hash))))
- (message "%s%s%s (from %s)"
- pretty-key
- (ergoemacs-unicode-char "→" "->")
- (symbol-name (nth 0 hash))
- pretty-key-undefined))))
+ ((and hash (commandp (nth 0 hash) t))
+ (ergoemacs-read-key--echo-command
+ pretty-key (or (and (symbolp (nth 0 hash)) (symbol-name
(nth 0 hash)))
+ (ergoemacs-unicode-char "λ" "lambda")))
(ergoemacs-shortcut-remap (nth 0 hash))
(setq ergoemacs-single-command-keys nil)
(setq ret 'function-remap))
((and ergoemacs-shortcut-keys (not ergoemacs-describe-key)
(not ergoemacs-single-command-keys))
- (when (and ergoemacs-echo-function
- (boundp 'pretty-key-undefined)
- (not (or this-command-keys-shift-translated
- ergoemacs-shift-translated)))
- (let (message-log-max)
- (if (nth 0 hash)
- (setq fn (nth 0 hash))
- (setq fn (key-binding key))
- (setq fn (or (command-remapping fn (point)) fn)))
- (if (string= pretty-key-undefined pretty-key)
- (when (eq ergoemacs-echo-function t)
- (message "%s%s%s;" pretty-key
- (ergoemacs-unicode-char "→" "->")
- fn))
- (message "%s%s%s (from %s);"
- pretty-key
- (ergoemacs-unicode-char "→" "->")
- fn
- pretty-key-undefined))))
+ (if (nth 0 hash)
+ (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
@@ -1002,21 +959,9 @@ FORCE-KEY forces keys like <escape> to work properly.
(setq ret (ergoemacs-read-key-lookup-get-ret---universal
fn)))
(unless ret
(setq ergoemacs-single-command-keys key)
- (when (and ergoemacs-echo-function
- (boundp 'pretty-key-undefined)
- (not (or this-command-keys-shift-translated
- ergoemacs-shift-translated)))
- (let (message-log-max)
- (if (string= pretty-key-undefined pretty-key)
- (when (eq ergoemacs-echo-function t)
- (message "%s%s%s" pretty-key
- (ergoemacs-unicode-char "→" "->")
- (symbol-name fn)))
- (message "%s%s%s (from %s)"
- pretty-key
- (ergoemacs-unicode-char "→" "->")
- (symbol-name fn)
- pretty-key-undefined))))
+ (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))))))
- [elpa] 14/287: Fix `ergoemacs-populate-pre-command-hook', (continued)
- [elpa] 14/287: Fix `ergoemacs-populate-pre-command-hook', Matthew Fidler, 2014/07/02
- [elpa] 12/287: no-ergoemacs-advice -> ergoemacs-ignore-advice, Matthew Fidler, 2014/07/02
- [elpa] 15/287: Use strinp consp and vectorp, Matthew Fidler, 2014/07/02
- [elpa] 18/287: Load ergoemacs-test for clean ergoemacs-mode load., Matthew Fidler, 2014/07/02
- [elpa] 06/287: Don't use symbol-value, Matthew Fidler, 2014/07/02
- [elpa] 16/287: ergoemacs--key-message, Matthew Fidler, 2014/07/02
- [elpa] 17/287: fix some let bindings., Matthew Fidler, 2014/07/02
- [elpa] 20/287: Add requires for byte-compile, Matthew Fidler, 2014/07/02
- [elpa] 21/287: Remove unused ergoemacs-define-key, Matthew Fidler, 2014/07/02
- [elpa] 22/287: Some cleanups for ergoemacs-setup-translation, Matthew Fidler, 2014/07/02
- [elpa] 19/287: Added `ergoemacs-read-key--echo-command`,
Matthew Fidler <=
- [elpa] 24/287: Revert ergoemacs-translate, Matthew Fidler, 2014/07/02
- [elpa] 26/287: Fix ergoemacs-extras Issue #225., Matthew Fidler, 2014/07/02
- [elpa] 27/287: Added cl require for ergoemacs-functions (Issue #225)., Matthew Fidler, 2014/07/02
- [elpa] 28/287: Merge branch 'master' into eieio, Matthew Fidler, 2014/07/02
- [elpa] 25/287: Started allowing parsing of the ergoemacs-mode key objects., Matthew Fidler, 2014/07/02
- [elpa] 01/287: Stefan Monnier's Patch, Matthew Fidler, 2014/07/02
- [elpa] 30/287: Started adding modes and setq assignments., Matthew Fidler, 2014/07/02
- [elpa] 32/287: Fix Issue #226, Matthew Fidler, 2014/07/02
- [elpa] 33/287: Merge branch 'master' into eieio, Matthew Fidler, 2014/07/02
- [elpa] 04/287: Revert "Stefan Monnier's Patch", Matthew Fidler, 2014/07/02