1 Return-Path: <markwalters1009@gmail.com>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id D1867431FB6
\r
6 for <notmuch@notmuchmail.org>; Mon, 7 May 2012 00:33:29 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0.201 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,
\r
14 RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
15 Received: from olra.theworths.org ([127.0.0.1])
\r
16 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
17 with ESMTP id 4MO3reEpkEaq for <notmuch@notmuchmail.org>;
\r
18 Mon, 7 May 2012 00:33:29 -0700 (PDT)
\r
19 Received: from mail-we0-f181.google.com (mail-we0-f181.google.com
\r
20 [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
21 (No client certificate requested)
\r
22 by olra.theworths.org (Postfix) with ESMTPS id 289D5431FAE
\r
23 for <notmuch@notmuchmail.org>; Mon, 7 May 2012 00:33:28 -0700 (PDT)
\r
24 Received: by werm13 with SMTP id m13so3555582wer.26
\r
25 for <notmuch@notmuchmail.org>; Mon, 07 May 2012 00:33:27 -0700 (PDT)
\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
\r
27 h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;
\r
28 bh=HFkmsJJYhJTnEW7EVXTWzV5EMvQSIkzfUes+kBo3hXs=;
\r
29 b=VQafU+bZgMxIWqfi6OsWIeQNiPIDZJblbFbRs4DJxae3m3gZleegjG2TIDJYTrcEQS
\r
30 6erUelHa1aB40myPOwh0OkTLm81Zs7WZh7WKGr1DzMtO3fYh1PjQ62Gv0vQvcETEFyuA
\r
31 2QoCAd66FNwpz/P62RBBt0YwcU1vVVpKy3RuE/QkMKqQGZjovRlplvl8czoCsO7VUgt1
\r
32 CVorb2kh6tOfgzCDzXNSeIbjv71AEM2ReLQMBnQ/AVT0aMEDEqFygQomByLqMjScpIJd
\r
33 n57BsPfNHckbx002pxO02h009c2GPahnSq3RhUIUpNtN2jstpM6zuAd+AI/YApPYjUtt
\r
35 Received: by 10.216.135.131 with SMTP id u3mr8919003wei.46.1336376007521;
\r
36 Mon, 07 May 2012 00:33:27 -0700 (PDT)
\r
37 Received: from localhost (94-192-233-223.zone6.bethere.co.uk.
\r
38 [94.192.233.223]) by mx.google.com with ESMTPS id
\r
39 j3sm31391138wiw.1.2012.05.07.00.33.25 (version=TLSv1/SSLv3 cipher=OTHER);
\r
40 Mon, 07 May 2012 00:33:26 -0700 (PDT)
\r
41 From: Mark Walters <markwalters1009@gmail.com>
\r
42 To: notmuch@notmuchmail.org
\r
43 Subject: [Patch v2] emacs: add pipe attachment command
\r
44 Date: Mon, 7 May 2012 08:33:28 +0100
\r
45 Message-Id: <1336376008-13014-1-git-send-email-markwalters1009@gmail.com>
\r
46 X-Mailer: git-send-email 1.7.9.1
\r
47 In-Reply-To: <1336374129-10225-1-git-send-email-jrollins@finestructure.net>
\r
48 References: <1336374129-10225-1-git-send-email-jrollins@finestructure.net>
\r
49 X-BeenThere: notmuch@notmuchmail.org
\r
50 X-Mailman-Version: 2.1.13
\r
52 List-Id: "Use and development of the notmuch mail system."
\r
53 <notmuch.notmuchmail.org>
\r
54 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
55 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
56 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
57 List-Post: <mailto:notmuch@notmuchmail.org>
\r
58 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
59 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
60 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
61 X-List-Received-Date: Mon, 07 May 2012 07:33:30 -0000
\r
63 Allow the user to pipe the attachment somewhere. Bound to '|' on the
\r
67 Thanks for the review!
\r
69 Here is a rebased to current master version of the previous patch: no
\r
76 emacs/notmuch-show.el | 27 +++++++++++++++++++++++++++
\r
77 1 files changed, 27 insertions(+), 0 deletions(-)
\r
79 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
80 index d318430..b6a1980 100644
\r
81 --- a/emacs/notmuch-show.el
\r
82 +++ b/emacs/notmuch-show.el
\r
83 @@ -453,6 +453,7 @@ message at DEPTH in the current thread."
\r
84 (define-key map "s" 'notmuch-show-part-button-save)
\r
85 (define-key map "v" 'notmuch-show-part-button-view)
\r
86 (define-key map "o" 'notmuch-show-part-button-interactively-view)
\r
87 + (define-key map "|" 'notmuch-show-part-button-pipe)
\r
89 "Submap for button commands")
\r
90 (fset 'notmuch-show-part-button-map notmuch-show-part-button-map)
\r
91 @@ -524,6 +525,28 @@ message at DEPTH in the current thread."
\r
92 (let ((handle (mm-make-handle (current-buffer) (list content-type))))
\r
93 (mm-interactively-view-part handle))))
\r
95 +(defun notmuch-show-pipe-part (message-id nth &optional filename content-type)
\r
96 + (notmuch-with-temp-part-buffer message-id nth
\r
97 + (let ((handle (mm-make-handle (current-buffer) (list content-type))))
\r
98 + (mm-pipe-part handle))))
\r
100 +(defun notmuch-show-mm-display-part-inline (msg part nth content-type)
\r
101 + "Use the mm-decode/mm-view functions to display a part in the
\r
102 +current buffer, if possible."
\r
103 + (let ((display-buffer (current-buffer)))
\r
104 + (with-temp-buffer
\r
105 + (let* ((charset (plist-get part :content-charset))
\r
106 + (handle (mm-make-handle (current-buffer) `(,content-type (charset . ,charset)))))
\r
107 + ;; If the user wants the part inlined, insert the content and
\r
108 + ;; test whether we are able to inline it (which includes both
\r
109 + ;; capability and suitability tests).
\r
110 + (when (mm-inlined-p handle)
\r
111 + (insert (notmuch-get-bodypart-content msg part nth notmuch-show-process-crypto))
\r
112 + (when (mm-inlinable-p handle)
\r
113 + (set-buffer display-buffer)
\r
114 + (mm-display-part handle)
\r
117 (defun notmuch-show-multipart/*-to-list (part)
\r
118 (mapcar (lambda (inner-part) (plist-get inner-part :content-type))
\r
119 (plist-get part :content)))
\r
120 @@ -1874,6 +1897,10 @@ the user (see `notmuch-show-stash-mlarchive-link-alist')."
\r
122 (notmuch-show-part-button-internal button #'notmuch-show-interactively-view-part))
\r
124 +(defun notmuch-show-part-button-pipe (&optional button)
\r
126 + (notmuch-show-part-button-internal button #'notmuch-show-pipe-part))
\r
128 (defun notmuch-show-part-button-internal (button handler)
\r
129 (let ((button (or button (button-at (point)))))
\r