aboutsummaryrefslogtreecommitdiffhomepage
path: root/emacs/notmuch.el
diff options
context:
space:
mode:
authorGravatar David Edmondson <dme@dme.org>2011-12-30 11:37:17 +0000
committerGravatar David Bremner <bremner@debian.org>2012-01-09 22:33:19 -0400
commita74ec0edd65f46eca097fd7784aaaef88801267e (patch)
tree29e87b8ca6c4f1669b846c6ac51f9c8ea7411f36 /emacs/notmuch.el
parent980daa26b57bf0285ab740ce49359e29ba898fee (diff)
emacs: Better handling of inherited keymaps for `nomuch-help'.
`notmuch-hello-mode' inherits the keymap for widgets, which confused `notmuch-substitute-command-keys'. Fix the confusion. Simplify `notmuch-substitute-command-keys' a little to make it easier to read.
Diffstat (limited to 'emacs/notmuch.el')
-rw-r--r--emacs/notmuch.el17
1 files changed, 12 insertions, 5 deletions
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index c678c93d..1e617752 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -164,16 +164,23 @@ For a mouse binding, return nil."
"\t"
(notmuch-documentation-first-line action))))))
-(defalias 'notmuch-substitute-one-command-key
- (apply-partially 'notmuch-substitute-one-command-key-with-prefix nil))
+(defun notmuch-substitute-command-keys-one (key)
+ ;; A `keymap' key indicates inheritance from a parent keymap - the
+ ;; inherited mappings follow, so there is nothing to print for
+ ;; `keymap' itself.
+ (when (not (eq key 'keymap))
+ (notmuch-substitute-one-command-key-with-prefix nil key)))
(defun notmuch-substitute-command-keys (doc)
"Like `substitute-command-keys' but with documentation, not function names."
(let ((beg 0))
(while (string-match "\\\\{\\([^}[:space:]]*\\)}" doc beg)
- (let ((map (substring doc (match-beginning 1) (match-end 1))))
- (setq doc (replace-match (mapconcat 'notmuch-substitute-one-command-key
- (cdr (symbol-value (intern map))) "\n") 1 1 doc)))
+ (let* ((keymap-name (substring doc (match-beginning 1) (match-end 1)))
+ (keymap (symbol-value (intern keymap-name))))
+ (setq doc (replace-match
+ (mapconcat #'notmuch-substitute-command-keys-one
+ (cdr keymap) "\n")
+ 1 1 doc)))
(setq beg (match-end 0)))
doc))