aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Walters <markwalters1009@gmail.com>2012-05-07 00:02:09 -0700
committerDavid Bremner <bremner@debian.org>2012-06-22 07:40:49 -0300
commitae1940cedc16a551b9f20d9ef77400dae26f8020 (patch)
tree8b686326a579765e8837cb44e0a63c122e62726c
parentd094153a264a69bc560366198a0febfa96c1ceb5 (diff)
emacs: add pipe attachment command
Allow the user to pipe the attachment somewhere. Bound to '|' on the attachment button. Signed-off-by: Jameson Graef Rollins <jrollins@finestructure.net>
-rw-r--r--emacs/notmuch-show.el10
1 files changed, 10 insertions, 0 deletions
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 36cad93..4349836 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -453,6 +453,7 @@ message at DEPTH in the current thread."
(define-key map "s" 'notmuch-show-part-button-save)
(define-key map "v" 'notmuch-show-part-button-view)
(define-key map "o" 'notmuch-show-part-button-interactively-view)
+ (define-key map "|" 'notmuch-show-part-button-pipe)
map)
"Submap for button commands")
(fset 'notmuch-show-part-button-map notmuch-show-part-button-map)
@@ -524,6 +525,11 @@ message at DEPTH in the current thread."
(let ((handle (mm-make-handle (current-buffer) (list content-type))))
(mm-interactively-view-part handle))))
+(defun notmuch-show-pipe-part (message-id nth &optional filename content-type)
+ (notmuch-with-temp-part-buffer message-id nth
+ (let ((handle (mm-make-handle (current-buffer) (list content-type))))
+ (mm-pipe-part handle))))
+
(defun notmuch-show-multipart/*-to-list (part)
(mapcar (lambda (inner-part) (plist-get inner-part :content-type))
(plist-get part :content)))
@@ -1874,6 +1880,10 @@ the user (see `notmuch-show-stash-mlarchive-link-alist')."
(interactive)
(notmuch-show-part-button-internal button #'notmuch-show-interactively-view-part))
+(defun notmuch-show-part-button-pipe (&optional button)
+ (interactive)
+ (notmuch-show-part-button-internal button #'notmuch-show-pipe-part))
+
(defun notmuch-show-part-button-internal (button handler)
(let ((button (or button (button-at (point)))))
(if button