notmuch.el: convert sparse keymap to a list in notmuch-substitute-one-command-key...
authorDavid Bremner <bremner@unb.ca>
Fri, 12 Feb 2010 03:01:07 +0000 (23:01 -0400)
committerCarl Worth <cworth@cworth.org>
Sat, 20 Feb 2010 20:20:54 +0000 (12:20 -0800)
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.

notmuch.el

index 342ce6abe6c55bb49f709a1c716452ad4fb09561..82471b57dc9b4cabb7271e73b61e4a80a4ada3a9 100644 (file)
@@ -1000,8 +1000,12 @@ For a mouse binding, return nil."
     (if (mouse-event-p key)
        nil
       (if (keymapp action)
-         (let ((substitute (apply-partially 'notmuch-substitute-one-command-key-with-prefix (notmuch-prefix-key-description key))))
-           (mapconcat substitute (cdr action) "\n"))
+         (let ((substitute (apply-partially 'notmuch-substitute-one-command-key-with-prefix (notmuch-prefix-key-description key)))
+               (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))
                "\t"
                (notmuch-documentation-first-line action))))))