[PATCH] emacs: notmuch-hello: respect notmuch-help's wishes

Subject: [PATCH] emacs: notmuch-hello: respect notmuch-help's wishes

Date: Sat, 16 Apr 2011 15:12:43 +0200

To: notmuch@notmuchmail.org


From: Pieter Praet

Calling notmuch-help in notmuch-hello-mode results in error
"apply: Wrong type argument: listp, keymap"

As this is the very first screen new users see, a failing
notmuch-help can be considered a marketing catastrophe.

Appears to be in introduced in commit 9ccd978665103a20
(patch id:"1273857338-20127-1-git-send-email-nelhage@mit.edu").

This patch makes notmuch-hello-mode-map consistent with
notmuch-show-mode-map and notmuch-search-mode-map.

To keep everything in working order, awaiting a real fix,
I copied in widget-keymap's bindings (as defined in "wid-edit.el").

Signed-off-by: Pieter Praet <pieter@praet.org>
 emacs/notmuch-hello.el |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index e58dd24..1193f74 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -290,7 +290,17 @@ should be. Returns a cons cell `(tags-per-line width)'."
 (defvar notmuch-hello-mode-map
   (let ((map (make-sparse-keymap)))
-    (set-keymap-parent map widget-keymap)
+    ; TODO make this play nice with notmuch-help:
+    ; (set-keymap-parent map widget-keymap)
+    ; In the meantime, make due with a copy of widget-keymap's contents:
+    (define-key map "\t" 'widget-forward)
+    (define-key map "\e\t" 'widget-backward)
+    (define-key map [(shift tab)] 'advertised-widget-backward)
+    (define-key map [backtab] 'widget-backward)
+    (define-key map [down-mouse-2] 'widget-button-click)
+    (define-key map [down-mouse-1] 'widget-button-click)
+    (define-key map [(control ?m)] 'widget-button-press)
+    ; end of widget-keymap's contents
     (define-key map "v" '(lambda () "Display the notmuch version" (interactive)
                            (message "notmuch version %s" (notmuch-version))))
     (define-key map "?" 'notmuch-help)