mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-22 10:58:10 +01:00
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.
This commit is contained in:
parent
980daa26b5
commit
a74ec0edd6
1 changed files with 12 additions and 5 deletions
|
@ -164,16 +164,23 @@ For a mouse binding, return nil."
|
||||||
"\t"
|
"\t"
|
||||||
(notmuch-documentation-first-line action))))))
|
(notmuch-documentation-first-line action))))))
|
||||||
|
|
||||||
(defalias 'notmuch-substitute-one-command-key
|
(defun notmuch-substitute-command-keys-one (key)
|
||||||
(apply-partially 'notmuch-substitute-one-command-key-with-prefix nil))
|
;; 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)
|
(defun notmuch-substitute-command-keys (doc)
|
||||||
"Like `substitute-command-keys' but with documentation, not function names."
|
"Like `substitute-command-keys' but with documentation, not function names."
|
||||||
(let ((beg 0))
|
(let ((beg 0))
|
||||||
(while (string-match "\\\\{\\([^}[:space:]]*\\)}" doc beg)
|
(while (string-match "\\\\{\\([^}[:space:]]*\\)}" doc beg)
|
||||||
(let ((map (substring doc (match-beginning 1) (match-end 1))))
|
(let* ((keymap-name (substring doc (match-beginning 1) (match-end 1)))
|
||||||
(setq doc (replace-match (mapconcat 'notmuch-substitute-one-command-key
|
(keymap (symbol-value (intern keymap-name))))
|
||||||
(cdr (symbol-value (intern map))) "\n") 1 1 doc)))
|
(setq doc (replace-match
|
||||||
|
(mapconcat #'notmuch-substitute-command-keys-one
|
||||||
|
(cdr keymap) "\n")
|
||||||
|
1 1 doc)))
|
||||||
(setq beg (match-end 0)))
|
(setq beg (match-end 0)))
|
||||||
doc))
|
doc))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue