[PATCH] emacs: add pipe attachment command
authorMark Walters <markwalters1009@gmail.com>
Sat, 5 May 2012 12:31:16 +0000 (13:31 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:46:55 +0000 (09:46 -0800)
65/235e6cc2946dabadd4cc74a3fb1b82db2df522 [new file with mode: 0644]

diff --git a/65/235e6cc2946dabadd4cc74a3fb1b82db2df522 b/65/235e6cc2946dabadd4cc74a3fb1b82db2df522
new file mode 100644 (file)
index 0000000..5ff18e0
--- /dev/null
@@ -0,0 +1,110 @@
+Return-Path: <markwalters1009@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 77BE2431FB6\r
+       for <notmuch@notmuchmail.org>; Sat,  5 May 2012 05:31:08 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.201\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
+       RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id SFgcvsPCv8Zr for <notmuch@notmuchmail.org>;\r
+       Sat,  5 May 2012 05:31:08 -0700 (PDT)\r
+Received: from mail-wg0-f45.google.com (mail-wg0-f45.google.com\r
+ [74.125.82.45])       (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
+ certificate requested)        by olra.theworths.org (Postfix) with ESMTPS id\r
+ C97EE431FAE   for <notmuch@notmuchmail.org>; Sat,  5 May 2012 05:31:07 -0700\r
+ (PDT)\r
+Received: by wgbdt14 with SMTP id dt14so2898698wgb.2\r
+       for <notmuch@notmuchmail.org>; Sat, 05 May 2012 05:31:06 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=from:to:cc:subject:date:message-id:x-mailer;\r
+       bh=9GLDEoNaO2zUfYSmes7Z/R/U3krLvKYr1k+lpVBbMz4=;\r
+       b=N4Rq1zq4FSRDHjDLaRckCyUoINJicOWm2DovCaJLhvB6C79JSS7hrnJNtrZQbed/xt\r
+       390DJ/9qxPVwLQESQoQKY/eYDXxq/NEdLWrw2Feq6omU2JKx9s3CiT8ev7gGpqrpykpO\r
+       exDkdbJpG2RqbHeyrOIiG308r2VrqigRIerV/zaQ9EY0mOGAgsUN9p+ghspPzuo17bCq\r
+       jOtyFUa7imOt9NHBYCy4IFvaqW+VcM8C8er5qxyjPtTfHPuAcSGYalcVv22p0tbb/Hwn\r
+       ZKPgJ0lCUHacu1pINej2nMxBYyCLeR90z1ufln4FLXgN/eCbFJDrQwoOI3uzyjR3jsCc\r
+       5CCQ==\r
+Received: by 10.180.83.198 with SMTP id s6mr20900575wiy.8.1336221066321;\r
+       Sat, 05 May 2012 05:31:06 -0700 (PDT)\r
+Received: from localhost (94-192-233-223.zone6.bethere.co.uk.\r
+ [94.192.233.223])     by mx.google.com with ESMTPS id\r
+ 17sm5612417wis.0.2012.05.05.05.31.04  (version=TLSv1/SSLv3 cipher=OTHER);     Sat,\r
+ 05 May 2012 05:31:04 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] emacs: add pipe attachment command\r
+Date: Sat,  5 May 2012 13:31:16 +0100\r
+Message-Id: <1336221076-3671-1-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 05 May 2012 12:31:08 -0000\r
+\r
+Allow the user to pipe the attachment somewhere. Bound to '|' on the\r
+attachment button.\r
+---\r
+\r
+I found myself missing this functionality. It uses mm-pipe-part which\r
+is nice as it sends single line output to the minibuffer and multiline\r
+output to a new emacs buffer.\r
+\r
+\r
+ emacs/notmuch-show.el |   10 ++++++++++\r
+ 1 files changed, 10 insertions(+), 0 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index 37f0ebb..55aa505 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -453,6 +453,7 @@ message at DEPTH in the current thread."\r
+     (define-key map "s" 'notmuch-show-part-button-save)\r
+     (define-key map "v" 'notmuch-show-part-button-view)\r
+     (define-key map "o" 'notmuch-show-part-button-interactively-view)\r
++    (define-key map "|" 'notmuch-show-part-button-pipe)\r
+     map)\r
+   "Submap for button commands")\r
+ (fset 'notmuch-show-part-button-map notmuch-show-part-button-map)\r
+@@ -524,6 +525,11 @@ message at DEPTH in the current thread."\r
+     (let ((handle (mm-make-handle (current-buffer) (list content-type))))\r
+       (mm-interactively-view-part handle))))\r
+ \r
++(defun notmuch-show-pipe-part (message-id nth &optional filename content-type)\r
++  (notmuch-with-temp-part-buffer message-id nth\r
++    (let ((handle (mm-make-handle (current-buffer) (list content-type))))\r
++      (mm-pipe-part handle))))\r
++\r
+ (defun notmuch-show-mm-display-part-inline (msg part nth content-type)\r
+   "Use the mm-decode/mm-view functions to display a part in the\r
+ current buffer, if possible."\r
+@@ -1891,6 +1897,10 @@ the user (see `notmuch-show-stash-mlarchive-link-alist')."\r
+   (interactive)\r
+   (notmuch-show-part-button-internal button #'notmuch-show-interactively-view-part))\r
+ \r
++(defun notmuch-show-part-button-pipe (&optional button)\r
++  (interactive)\r
++  (notmuch-show-part-button-internal button #'notmuch-show-pipe-part))\r
++\r
+ (defun notmuch-show-part-button-internal (button handler)\r
+   (let ((button (or button (button-at (point)))))\r
+     (if button\r
+-- \r
+1.7.9.1\r
+\r