[PATCH] emacs: notmuch-hello: Use our own keymap.

Nelson Elhage nelhage at ksplice.com
Thu May 13 19:46:15 PDT 2010


Previously, we were adding our bindings directly to `widget-keymap',
resulting in them being shared by anything else that used that keymap.
---
 emacs/notmuch-hello.el |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 6a1c56e..56906c8 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -70,6 +70,19 @@
 
 (defvar notmuch-hello-recent-searches nil)
 
+(defvar notmuch-hello-mode-map
+  (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map widget-keymap)
+    (define-key map "=" 'notmuch-hello-update)
+    (define-key map "G" 'notmuch-hello-poll-and-update)
+    (define-key map "m" 'notmuch-mua-mail)
+    (define-key map "q" '(lambda () (interactive) (kill-buffer (current-buffer))))
+    (define-key map "s" 'notmuch-hello-goto-search)
+    (define-key map "v" '(lambda () (interactive)
+                           (message "notmuch version %s" (notmuch-version))))
+    map)
+  "Keymap for notmuch-hello buffer")
+
 (defun notmuch-hello-remember-search (search)
   (if (not (member search notmuch-hello-recent-searches))
       (push search notmuch-hello-recent-searches))
@@ -397,14 +410,7 @@ diagonal."
 	(let ((fill-column (- (window-width) notmuch-hello-indent)))
 	  (center-region start (point))))
 
-      (use-local-map widget-keymap)
-      (local-set-key "=" 'notmuch-hello-update)
-      (local-set-key "G" 'notmuch-hello-poll-and-update)
-      (local-set-key "m" 'notmuch-mua-mail)
-      (local-set-key "q" '(lambda () (interactive) (kill-buffer (current-buffer))))
-      (local-set-key "s" 'notmuch-hello-goto-search)
-      (local-set-key "v" '(lambda () (interactive)
-			    (message "notmuch version %s" (notmuch-version))))
+      (use-local-map notmuch-hello-mode-map)
 
       (widget-setup)
 
-- 
1.6.6.30.g1e6fd



More information about the notmuch mailing list