aboutsummaryrefslogtreecommitdiffhomepage
path: root/emacs
diff options
context:
space:
mode:
authorGravatar Mark Walters <markwalters1009@gmail.com>2013-11-12 20:10:58 +0000
committerGravatar David Bremner <david@tethera.net>2013-11-13 21:46:50 -0400
commitb5f93cc0dbcd4ce37a190a0bdde2c3871a7b2709 (patch)
tree929548fcd8f74d8475e8272d50c15dfe2a1976f8 /emacs
parent8141555d2540633c9b741993b92d6b9b3030fd83 (diff)
emacs: help: add a special function to deal with remaps
remaps are a rather unusual keymap consisting of "first key" 'remap and then "second-key" the remapped-function. Thus we do the documentation for it separately.
Diffstat (limited to 'emacs')
-rw-r--r--emacs/notmuch-lib.el22
1 files changed, 20 insertions, 2 deletions
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 3eedd710..49fe6445 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -260,6 +260,21 @@ It does not prepend if ACTUAL-KEY is already listed in TAIL."
tail)))
tail)
+(defun notmuch-describe-remaps (remap-keymap ua-keys base-keymap prefix tail)
+ ;; Remappings are represented as a binding whose first "event" is
+ ;; 'remap. Hence, if the keymap has any remappings, it will have a
+ ;; binding whose "key" is 'remap, and whose "binding" is itself a
+ ;; keymap that maps not from keys to commands, but from old (remapped)
+ ;; functions to the commands to use in their stead.
+ (map-keymap
+ (lambda (command binding)
+ (mapc
+ (lambda (actual-key)
+ (setq tail (notmuch-describe-key actual-key binding prefix ua-keys tail)))
+ (where-is-internal command base-keymap)))
+ remap-keymap)
+ tail)
+
(defun notmuch-describe-keymap (keymap ua-keys base-keymap &optional prefix tail)
"Return a list of cons cells, each describing one binding in KEYMAP.
@@ -276,8 +291,11 @@ prefix argument. PREFIX and TAIL are used internally."
(cond ((mouse-event-p key) nil)
((keymapp binding)
(setq tail
- (notmuch-describe-keymap
- binding ua-keys base-keymap (notmuch-prefix-key-description key) tail)))
+ (if (eq key 'remap)
+ (notmuch-describe-remaps
+ binding ua-keys base-keymap prefix tail)
+ (notmuch-describe-keymap
+ binding ua-keys base-keymap (notmuch-prefix-key-description key) tail))))
(binding
(setq tail (notmuch-describe-key (vector key) binding prefix ua-keys tail)))))
keymap)