notmuch.el: convert sparse keymap to a list in notmuch-substitute-one-command-key-with-prefix

The previous version would crash when a key was bound to a sparse
keymap, since apparently these are not straightforward lists.  The
usage of map-keymap is a bit obscure: it only has side-effects, no
return value.
This commit is contained in:
David Bremner 2010-02-11 23:01:07 -04:00 committed by Carl Worth
parent 1137ce11e1
commit b20bc7028d

View file

@ -1000,8 +1000,12 @@ For a mouse binding, return nil."
(if (mouse-event-p key) (if (mouse-event-p key)
nil nil
(if (keymapp action) (if (keymapp action)
(let ((substitute (apply-partially 'notmuch-substitute-one-command-key-with-prefix (notmuch-prefix-key-description key)))) (let ((substitute (apply-partially 'notmuch-substitute-one-command-key-with-prefix (notmuch-prefix-key-description key)))
(mapconcat substitute (cdr action) "\n")) (as-list))
(map-keymap (lambda (a b)
(push (cons a b) as-list))
action)
(mapconcat substitute as-list "\n"))
(concat prefix (format-kbd-macro (vector key)) (concat prefix (format-kbd-macro (vector key))
"\t" "\t"
(notmuch-documentation-first-line action)))))) (notmuch-documentation-first-line action))))))