emacs: Define a common shared keymap for all of notmuch

This defines a single, currently empty keymap that all other notmuch
mode maps inherit from.
This commit is contained in:
Austin Clements 2013-09-03 17:45:24 -04:00 committed by David Bremner
parent 69c52c56f2
commit c52fee6bcb
4 changed files with 15 additions and 2 deletions

View file

@ -515,8 +515,14 @@ Such a list can be computed with `notmuch-hello-query-counts'."
(defvar notmuch-hello-mode-map (defvar notmuch-hello-mode-map
(let ((map (make-sparse-keymap))) (let ((map (if (fboundp 'make-composed-keymap)
(set-keymap-parent map widget-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) (define-key map "v" (lambda () "Display the notmuch version" (interactive)
(message "notmuch version %s" (notmuch-version)))) (message "notmuch version %s" (notmuch-version))))
(define-key map "?" 'notmuch-help) (define-key map "?" 'notmuch-help)

View file

@ -128,6 +128,11 @@ For example, if you wanted to remove an \"inbox\" tag and add an
:group 'notmuch-search :group 'notmuch-search
:group 'notmuch-show) :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 ;; By default clicking on a button does not select the window
;; containing the button (as opposed to clicking on a widget which ;; containing the button (as opposed to clicking on a widget which
;; does). This means that the button action is then executed in the ;; does). This means that the button action is then executed in the

View file

@ -1243,6 +1243,7 @@ reset based on the original query."
(defvar notmuch-show-mode-map (defvar notmuch-show-mode-map
(let ((map (make-sparse-keymap))) (let ((map (make-sparse-keymap)))
(set-keymap-parent map notmuch-common-keymap)
(define-key map "?" 'notmuch-help) (define-key map "?" 'notmuch-help)
(define-key map "q" 'notmuch-kill-this-buffer) (define-key map "q" 'notmuch-kill-this-buffer)
(define-key map (kbd "<C-tab>") 'widget-backward) (define-key map (kbd "<C-tab>") 'widget-backward)

View file

@ -198,6 +198,7 @@ first line of documentation for the bound function."
(defvar notmuch-search-mode-map (defvar notmuch-search-mode-map
(let ((map (make-sparse-keymap))) (let ((map (make-sparse-keymap)))
(set-keymap-parent map notmuch-common-keymap)
(define-key map "?" 'notmuch-help) (define-key map "?" 'notmuch-help)
(define-key map "q" 'notmuch-kill-this-buffer) (define-key map "q" 'notmuch-kill-this-buffer)
(define-key map "x" 'notmuch-kill-this-buffer) (define-key map "x" 'notmuch-kill-this-buffer)