[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 17/287: fix some let bindings.
From: |
Matthew Fidler |
Subject: |
[elpa] 17/287: fix some let bindings. |
Date: |
Wed, 02 Jul 2014 14:44:14 +0000 |
mlf176f2 pushed a commit to branch externals/ergoemacs-mode
in repository elpa.
commit 6769a4c041763cbfadd399fbf8c1245c50804045
Author: Matthew L. Fidler <address@hidden>
Date: Sat May 24 00:43:50 2014 +0800
fix some let bindings.
---
ergoemacs-shortcuts.el | 159 ++++++++++++++++++++++++++++++++----------------
1 files changed, 107 insertions(+), 52 deletions(-)
diff --git a/ergoemacs-shortcuts.el b/ergoemacs-shortcuts.el
index 1e0215b..29761f0 100644
--- a/ergoemacs-shortcuts.el
+++ b/ergoemacs-shortcuts.el
@@ -524,45 +524,47 @@ It will replace anything defined by
`ergoemacs-translation'"
(defun ergoemacs-read-key-next-key-is-alt (&optional type pretty-key)
"The next key read is an Alt+ key. (or M- )"
(interactive)
- (let* ((next-key (ergoemacs-translate
- (vector
- (ergoemacs-read-event nil pretty-key ergoemacs-alt-text))))
- (key (plist-get next-key ':alt-key))
- (pretty (plist-get next-key ':alt-pretty))
- (kbd (plist-get next-key ':alt)))
- (ergoemacs-read-key-install-next-key next-key key pretty kbd)))
+ (when (and type pretty-key)
+ (let* ((next-key (ergoemacs-translate
+ (vector
+ (ergoemacs-read-event nil pretty-key
ergoemacs-alt-text))))
+ (key (plist-get next-key ':alt-key))
+ (pretty (plist-get next-key ':alt-pretty))
+ (kbd (plist-get next-key ':alt)))
+ (ergoemacs-read-key-install-next-key next-key key pretty kbd))))
(defun ergoemacs-read-key-next-key-is-ctl (&optional type pretty-key)
"The next key read is an Ctrl+ key. (or C- )"
(interactive)
- (let* ((next-key (ergoemacs-translate
- (vector
- (ergoemacs-read-event nil pretty-key
ergoemacs-ctl-text))))
- (key (plist-get next-key ':ctl-key))
- (pretty (plist-get next-key ':ctl-pretty))
- (kbd (plist-get next-key ':ctl)))
- (ergoemacs-read-key-install-next-key next-key key pretty kbd)))
+ (when (and type pretty-key)
+ (let* ((next-key (ergoemacs-translate
+ (vector
+ (ergoemacs-read-event nil pretty-key
ergoemacs-ctl-text))))
+ (key (plist-get next-key ':ctl-key))
+ (pretty (plist-get next-key ':ctl-pretty))
+ (kbd (plist-get next-key ':ctl)))
+ (ergoemacs-read-key-install-next-key next-key key pretty kbd))))
(defun ergoemacs-read-key-next-key-is-alt-ctl (&optional type pretty-key)
"The next key read is an Alt+Ctrl+ key. (or C-M- )"
(interactive)
- (let* ((next-key (ergoemacs-translate
- (vector
- (ergoemacs-read-event nil pretty-key
ergoemacs-alt-ctl-text))))
- (key (plist-get next-key ':alt-ctl-key))
- (pretty (plist-get next-key ':alt-ctl-pretty))
- (kbd (plist-get next-key ':alt-ctl)))
- (ergoemacs-read-key-install-next-key next-key key pretty kbd)))
+ (when (and type pretty-key)
+ (let* ((next-key (ergoemacs-translate
+ (vector
+ (ergoemacs-read-event nil pretty-key
ergoemacs-alt-ctl-text))))
+ (key (plist-get next-key ':alt-ctl-key))
+ (pretty (plist-get next-key ':alt-ctl-pretty))
+ (kbd (plist-get next-key ':alt-ctl)))
+ (ergoemacs-read-key-install-next-key next-key key pretty kbd))))
(defun ergoemacs-read-key-next-key-is-quoted (&optional type pretty-key)
"The next key read is quoted."
(interactive)
(when (and type pretty-key)
- (let* ((next-key (ergoemacs-translate
- (vector (ergoemacs-read-event nil pretty-key ""))))
- (key (plist-get next-key ':normal-key))
- (pretty (plist-get next-key ':normal-pretty))
- (kbd (plist-get next-key ':normal)))
+ (let* ((next-key (ergoemacs-translate (vector (ergoemacs-read-event nil
pretty-key ""))))
+ (key (plist-get next-key ':normal-key))
+ (pretty (plist-get next-key ':normal-pretty))
+ (kbd (plist-get next-key ':normal)))
(ergoemacs-read-key-install-next-key next-key key pretty kbd))))
(defun ergoemacs-read-key-help ()
@@ -619,7 +621,6 @@ It will replace anything defined by `ergoemacs-translation'"
(set-default 'post-command-hook nil))
(defun ergoemacs-restore-post-command-hook ()
- "Restores `post-command-hook'."
(when (or (default-value 'ergoemacs-defer-post-command-hook)
ergoemacs-defer-post-command-hook)
(set-default 'post-command-hook (default-value
'ergoemacs-defer-post-command-hook))
@@ -739,26 +740,6 @@ to the appropriate values for `ergoemacs-read-key'.
(setq ret (ergoemacs-read-key-lookup-get-ret---universal fn)))
ret))
-(defun ergoemacs--key-message (pretty-key dest)
- "Prints the key command that was called.
-PRETTY-KEY is the key displayed
-DEST is the function being called."
- (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 "→" "->")
- dest))
- (message "%s%s%s (from %s)"
- pretty-key
- (ergoemacs-unicode-char "→" "->")
- dest
- pretty-key-undefined)))))
-
(defun ergoemacs-read-key-lookup (prior-key prior-pretty-key key pretty-key
force-key)
"Lookup KEY and run if necessary.
@@ -862,7 +843,21 @@ FORCE-KEY forces keys like <escape> to work properly.
(error nil))))
(setq fn (or (command-remapping fn (point)) fn))
(setq ergoemacs-single-command-keys key)
- (ergoemacs--key-message pretty-key fn)
+ (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-call fn nil key)
(setq ergoemacs-single-command-keys nil)
(setq ret 'translate-fn))
@@ -875,7 +870,21 @@ 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)
- (ergoemacs--key-message pretty-key (ergoemacs-pretty-key
(key-description tmp)))
+ (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))))
(when lookup
(define-key lookup [ergoemacs-single-command-keys] 'ignore)
(setq ergoemacs-read-key-overriding-terminal-local-save
overriding-terminal-local-map)
@@ -929,13 +938,45 @@ FORCE-KEY forces keys like <escape> to work properly.
(condition-case err
(interactive-form (nth 0 hash))
(error nil)))
- (ergoemacs--key-message pretty-key (symbol-name (nth 0
hash)))
+ (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))))
(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))
- (ergoemacs--key-message pretty-key fn)
+ (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))))
;; 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
@@ -961,7 +1002,21 @@ 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)
- (ergoemacs--key-message pretty-key (symbol-name fn))
+ (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-call fn nil key)
(setq ergoemacs-single-command-keys nil)
(setq ret 'function))))))
- [elpa] 11/287: No longer wrap in unwind-protect, (continued)
- [elpa] 11/287: No longer wrap in unwind-protect, Matthew Fidler, 2014/07/02
- [elpa] 09/287: Took out unknown signatory advice :(. Cleaned up advices., Matthew Fidler, 2014/07/02
- [elpa] 10/287: Took out usless argument to ergoemacs-global-set-key-after, Matthew Fidler, 2014/07/02
- [elpa] 13/287: Activate advices in definitions., Matthew Fidler, 2014/07/02
- [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 <=
- [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, 2014/07/02
- [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