From: Austin Clements Date: Tue, 3 Sep 2013 21:45:24 +0000 (-0400) Subject: emacs: Define a common shared keymap for all of notmuch X-Git-Tag: 0.17_rc1~132 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c52fee6bcb3565ce19801b86d83d5783e48df320;p=notmuch.git 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. --- diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index 6a7b884c..46baf559 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -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) diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 782badb0..2bf1d2f6 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -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 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index cb586e92..53ccc39d 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -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 "") 'widget-backward) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 03040964..e098bd7b 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -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)