]> git.notmuchmail.org Git - notmuch/commitdiff
emacs: Define a common shared keymap for all of notmuch
authorAustin Clements <amdragon@MIT.EDU>
Tue, 3 Sep 2013 21:45:24 +0000 (17:45 -0400)
committerDavid Bremner <bremner@debian.org>
Tue, 10 Sep 2013 11:07:28 +0000 (08:07 -0300)
This defines a single, currently empty keymap that all other notmuch
mode maps inherit from.

emacs/notmuch-hello.el
emacs/notmuch-lib.el
emacs/notmuch-show.el
emacs/notmuch.el

index 6a7b884c5c433a056cfecaaf96b322a365ae2217..46baf559c237a83dba02057d18b1dde386fa1969 100644 (file)
@@ -515,8 +515,14 @@ Such a list can be computed with `notmuch-hello-query-counts'."
 
 
 (defvar notmuch-hello-mode-map
-  (let ((map (make-sparse-keymap)))
-    (set-keymap-parent map widget-keymap)
+  (let ((map (if (fboundp 'make-composed-keymap)
+                ;; Inherit both widget-keymap and notmuch-common-keymap
+                (make-composed-keymap widget-keymap)
+              ;; Before Emacs 24, keymaps didn't support multiple
+              ;; inheritance,, so just copy the widget keymap since
+              ;; it's unlikely to change.
+              (copy-keymap widget-keymap))))
+    (set-keymap-parent map notmuch-common-keymap)
     (define-key map "v" (lambda () "Display the notmuch version" (interactive)
                          (message "notmuch version %s" (notmuch-version))))
     (define-key map "?" 'notmuch-help)
index 782badb0d5857155e5dd19e2aae0b8b7989d8d26..2bf1d2f69ccec3516fdf2a8f9838764db385ae16 100644 (file)
@@ -128,6 +128,11 @@ For example, if you wanted to remove an \"inbox\" tag and add an
   :group 'notmuch-search
   :group 'notmuch-show)
 
+(defvar notmuch-common-keymap
+  (let ((map (make-sparse-keymap)))
+    map)
+  "Keymap shared by all notmuch modes.")
+
 ;; By default clicking on a button does not select the window
 ;; containing the button (as opposed to clicking on a widget which
 ;; does). This means that the button action is then executed in the
index cb586e9246f96a4e4cb48669eabae04e7f059317..53ccc39d1e91486f79c68a1407ec6750134fed65 100644 (file)
@@ -1243,6 +1243,7 @@ reset based on the original query."
 
 (defvar notmuch-show-mode-map
       (let ((map (make-sparse-keymap)))
+       (set-keymap-parent map notmuch-common-keymap)
        (define-key map "?" 'notmuch-help)
        (define-key map "q" 'notmuch-kill-this-buffer)
        (define-key map (kbd "<C-tab>") 'widget-backward)
index 03040964ab34a31f13ec7618e3cc8839c70930af..e098bd7bb1b98a8a3d700b2ce8ed69c7452707da 100644 (file)
@@ -198,6 +198,7 @@ first line of documentation for the bound function."
 
 (defvar notmuch-search-mode-map
   (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map notmuch-common-keymap)
     (define-key map "?" 'notmuch-help)
     (define-key map "q" 'notmuch-kill-this-buffer)
     (define-key map "x" 'notmuch-kill-this-buffer)