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