unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Austin Clements <amdragon@MIT.EDU>
To: notmuch@notmuchmail.org
Subject: [PATCH 4/4] emacs: Bind MIME part commands to "." submap
Date: Mon, 27 May 2013 16:46:34 -0400	[thread overview]
Message-ID: <1369687594-31774-5-git-send-email-amdragon@mit.edu> (raw)
In-Reply-To: <1369687594-31774-1-git-send-email-amdragon@mit.edu>

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.  These key bindings
are still available without the prefix when point is over a part
button.
---
 emacs/notmuch-show.el |   27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index b33d92d..380b144 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -471,17 +471,6 @@ message at DEPTH in the current thread."
   '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 ": "))
@@ -1195,6 +1184,21 @@ 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-part-button-map
+  (make-composed-keymap notmuch-show-part-map button-map)
+  "Keymap for part button commands")
+(fset 'notmuch-show-part-button-map notmuch-show-part-button-map)
+
 (defvar notmuch-show-mode-map
       (let ((map (make-sparse-keymap)))
 	(define-key map "?" 'notmuch-help)
@@ -1237,6 +1241,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)
-- 
1.7.10.4

  parent reply	other threads:[~2013-05-27 20:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-27 20:46 [PATCH 0/4] emacs: Part command improvements Austin Clements
2013-05-27 20:46 ` [PATCH 1/4] emacs: Retain text properties when toggling buttons Austin Clements
2013-05-27 20:46 ` [PATCH 2/4] emacs: Record part p-list in a text property Austin Clements
2013-05-27 22:19   ` Mark Walters
2013-05-27 20:46 ` [PATCH 3/4] emacs: Simplify MIME part command implementation Austin Clements
2013-05-27 20:46 ` Austin Clements [this message]
2013-05-27 22:30 ` [PATCH 0/4] emacs: Part command improvements Mark Walters
2013-05-30  1:01   ` Austin Clements

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1369687594-31774-5-git-send-email-amdragon@mit.edu \
    --to=amdragon@mit.edu \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).