RE: Reply all - issue
[notmuch-archives.git] / 3d / b246fa970fa85a1dc62afd2406b870b1e0e639
1 Return-Path: <camalot@picnicpark.org>\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 12D09431FC9\r
6         for <notmuch@notmuchmail.org>; Fri, 27 Nov 2009 05:30:42 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 Received: from olra.theworths.org ([127.0.0.1])\r
9         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
10         with ESMTP id 3f6OlCT4Bcat for <notmuch@notmuchmail.org>;\r
11         Fri, 27 Nov 2009 05:30:40 -0800 (PST)\r
12 Received: from mout.perfora.net (mout.perfora.net [74.208.4.194])\r
13         by olra.theworths.org (Postfix) with ESMTP id 583F1431FC4\r
14         for <notmuch@notmuchmail.org>; Fri, 27 Nov 2009 05:30:40 -0800 (PST)\r
15 Received: from vps.nicira.com (66.7.219.28.static.dimenoc.com [66.7.219.28])\r
16         by mx.perfora.net (node=mxus1) with ESMTP (Nemesis)\r
17         id 0MAPDO-1NK6lh2rco-00BZ3S for notmuch@notmuchmail.org;\r
18         Fri, 27 Nov 2009 08:30:39 -0500\r
19 Received: from [76.210.240.177] (port=36296 helo=kea-nicira-lt)\r
20         by vps.nicira.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69)\r
21         (envelope-from <camalot@picnicpark.org>)\r
22         id 1NE0uD-00048p-SB; Fri, 27 Nov 2009 08:30:39 -0500\r
23 Received: by kea-nicira-lt (sSMTP sendmail emulation);\r
24         Fri, 27 Nov 2009 05:30:36 -0800\r
25 From: camalot@picnicpark.org\r
26 To: notmuch@notmuchmail.org\r
27 Date: Fri, 27 Nov 2009 05:30:10 -0800\r
28 Message-Id: <1259328615-1445-5-git-send-email-camalot@picnicpark.org>\r
29 X-Mailer: git-send-email 1.6.5.3\r
30 In-Reply-To: <1259328615-1445-4-git-send-email-camalot@picnicpark.org>\r
31 References: <1259328615-1445-1-git-send-email-camalot@picnicpark.org>\r
32         <1259328615-1445-2-git-send-email-camalot@picnicpark.org>\r
33         <1259328615-1445-3-git-send-email-camalot@picnicpark.org>\r
34         <1259328615-1445-4-git-send-email-camalot@picnicpark.org>\r
35 X-AntiAbuse: This header was added to track abuse,\r
36         please include it with any abuse report\r
37 X-AntiAbuse: Primary Hostname - vps.nicira.com\r
38 X-AntiAbuse: Original Domain - notmuchmail.org\r
39 X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]\r
40 X-AntiAbuse: Sender Address Domain - picnicpark.org\r
41 X-Source: \r
42 X-Source-Args: \r
43 X-Source-Dir: \r
44 Cc: Keith Amidon <keith@nicira.com>\r
45 Subject: [notmuch] [PATCH 4/9] Factor out message buffer mgmt from\r
46         notmuch-show-view-all-mime-parts\r
47 X-BeenThere: notmuch@notmuchmail.org\r
48 X-Mailman-Version: 2.1.12\r
49 Precedence: list\r
50 List-Id: "Use and development of the notmuch mail system."\r
51         <notmuch.notmuchmail.org>\r
52 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
53         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
54 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
55 List-Post: <mailto:notmuch@notmuchmail.org>\r
56 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
57 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
58         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
59 X-List-Received-Date: Fri, 27 Nov 2009 13:30:42 -0000\r
60 \r
61 From: Keith Amidon <keith@nicira.com>\r
62 \r
63 The ability to temporarily create a buffer containing only the\r
64 contents of the currently selected message in notmuch show mode is\r
65 generally useful.  This commit factors the majority of the code\r
66 required to do so out of notmuch-show-view-all-mime-parts into a macro\r
67 called with-current-notmuch-show-message and rewrites the original\r
68 function in terms of the macro.\r
69 \r
70 A future set of commits will provide additional functionality using\r
71 the macro as well.\r
72 ---\r
73  notmuch.el |   20 ++++++++++++--------\r
74  1 files changed, 12 insertions(+), 8 deletions(-)\r
75 \r
76 diff --git a/notmuch.el b/notmuch.el\r
77 index cd6609d..a71a9f7 100644\r
78 --- a/notmuch.el\r
79 +++ b/notmuch.el\r
80 @@ -283,17 +283,21 @@ buffer."\r
81    (interactive)\r
82    (view-file (notmuch-show-get-filename)))\r
83  \r
84 +(defmacro with-current-notmuch-show-message (&rest body)\r
85 +  "Evaluate body with current buffer set to the text of current message"\r
86 +  `(save-excursion\r
87 +     (let ((filename (notmuch-show-get-filename)))\r
88 +       (let ((buf (generate-new-buffer (concat "*notmuch-msg-" filename "*"))))\r
89 +         (with-current-buffer buf\r
90 +           (insert-file-contents filename nil nil nil t)\r
91 +           ,@body)\r
92 +        (kill-buffer buf)))))\r
93 +\r
94  (defun notmuch-show-view-all-mime-parts ()\r
95    "Use external viewers (according to mailcap) to view all MIME-encoded parts."\r
96    (interactive)\r
97 -  (save-excursion\r
98 -    (let ((filename (notmuch-show-get-filename)))\r
99 -      (switch-to-buffer (generate-new-buffer (concat "*notmuch-mime-"\r
100 -                                                    filename\r
101 -                                                    "*")))\r
102 -      (insert-file-contents filename nil nil nil t)\r
103 -      (mm-display-parts (mm-dissect-buffer))\r
104 -      (kill-this-buffer))))\r
105 +  (with-current-notmuch-show-message\r
106 +   (mm-display-parts (mm-dissect-buffer))))\r
107  \r
108  (defun notmuch-reply (query-string)\r
109    (switch-to-buffer (generate-new-buffer "notmuch-draft"))\r
110 -- \r
111 1.6.5.3\r
112 \r