emacs: Bind MIME part commands to "." submap

Since the part commands are no longer tied to a button, but can be
applied with point anywhere within a part, bind the part commands
keymap to "." everywhere in the show buffer.  This lets you save or
view parts without having to navigate to the part button, and is
particularly useful for parts that have no button.

This removes the un-prefixed MIME part commands from the part button
keymap, but that's okay because those clashed in annoying ways with
show buffer bindings like "s" for search.  RET on part buttons is
unaffected, which is the most important part button binding.
This commit is contained in:
Austin Clements 2013-05-29 21:13:47 -04:00 committed by David Bremner
parent 1546387d72
commit edc740857f

View file

@ -466,22 +466,10 @@ message at DEPTH in the current thread."
(define-button-type 'notmuch-show-part-button-type
'action 'notmuch-show-part-button-default
'keymap 'notmuch-show-part-button-map
'follow-link t
'face 'message-mml
:supertype 'notmuch-button-type)
(defvar notmuch-show-part-button-map
(let ((map (make-sparse-keymap)))
(set-keymap-parent map button-map)
(define-key map "s" 'notmuch-show-save-part)
(define-key map "v" 'notmuch-show-view-part)
(define-key map "o" 'notmuch-show-interactively-view-part)
(define-key map "|" 'notmuch-show-pipe-part)
map)
"Submap for button commands")
(fset 'notmuch-show-part-button-map notmuch-show-part-button-map)
(defun notmuch-show-insert-part-header (nth content-type declared-type &optional name comment)
(let ((button)
(base-label (concat (when name (concat name ": "))
@ -1202,6 +1190,16 @@ reset based on the original query."
"Submap for stash commands")
(fset 'notmuch-show-stash-map notmuch-show-stash-map)
(defvar notmuch-show-part-map
(let ((map (make-sparse-keymap)))
(define-key map "s" 'notmuch-show-save-part)
(define-key map "v" 'notmuch-show-view-part)
(define-key map "o" 'notmuch-show-interactively-view-part)
(define-key map "|" 'notmuch-show-pipe-part)
map)
"Submap for part commands")
(fset 'notmuch-show-part-map notmuch-show-part-map)
(defvar notmuch-show-mode-map
(let ((map (make-sparse-keymap)))
(define-key map "?" 'notmuch-help)
@ -1244,6 +1242,7 @@ reset based on the original query."
(define-key map "$" 'notmuch-show-toggle-process-crypto)
(define-key map "<" 'notmuch-show-toggle-thread-indentation)
(define-key map "t" 'toggle-truncate-lines)
(define-key map "." 'notmuch-show-part-map)
map)
"Keymap for \"notmuch show\" buffers.")
(fset 'notmuch-show-mode-map notmuch-show-mode-map)