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 arlo.cworth.org (Postfix) with ESMTP id 7C7B06DE02DB
\r
6 for <notmuch@notmuchmail.org>; Fri, 10 Jun 2016 16:03:57 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
11 X-Spam-Status: No, score=-0.337 tagged_above=-999 required=5 tests=[AWL=0.233,
\r
12 DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7,
\r
14 RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001]
\r
16 Received: from arlo.cworth.org ([127.0.0.1])
\r
17 by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)
\r
18 with ESMTP id wtglnB6TC_gw for <notmuch@notmuchmail.org>;
\r
19 Fri, 10 Jun 2016 16:03:49 -0700 (PDT)
\r
20 Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com
\r
21 [74.125.82.67]) by arlo.cworth.org (Postfix) with ESMTPS id A4D1D6DE02B0 for
\r
22 <notmuch@notmuchmail.org>; Fri, 10 Jun 2016 16:03:11 -0700 (PDT)
\r
23 Received: by mail-wm0-f67.google.com with SMTP id n184so1714263wmn.1
\r
24 for <notmuch@notmuchmail.org>; Fri, 10 Jun 2016 16:03:11 -0700 (PDT)
\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
\r
26 h=from:to:cc:subject:date:message-id:in-reply-to:references;
\r
27 bh=pp1RSXCfv2ceqixYzO11izXYsYYj4rhW8xqXg1BdG1E=;
\r
28 b=yXqyXhsOkAD+0K9VifqfFu5f3JgvBgwIgBORmpp2Qbo2wdkW3iTXXMOecp7q0hBw4r
\r
29 Iv5EO/Xup33CQWSqZtJnyJbsnnx/bHwAqmndFSF9UX1EMuElR9GqtENr1P5fTwSm9o38
\r
30 nEIGQyiNXaqZgARNwibRMT0uaE81lcB+yaff8R1ElhLYdwJUGhejE0iSAPtj+jI6mLhD
\r
31 DqJVOa/2e8lP8k13SQ6MOb926dv9se7v8E2jCyc8HqwcUEWaUCnZF6pGBBT07sYgrxNw
\r
32 +q38Yy/6jhgNNnK9P7L/m8Z/0yOKftknDIDKROsX7t/RnhyEMZix7CMo+Y9PDiZcfOUU
\r
34 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
\r
35 d=1e100.net; s=20130820;
\r
36 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
\r
38 bh=pp1RSXCfv2ceqixYzO11izXYsYYj4rhW8xqXg1BdG1E=;
\r
39 b=Dqs/E7dLSJP71jQQr1hQxzG442NmovKPkUwbK4mA33ZO90Wzc1PaYci2sbVhMlkXbH
\r
40 XxqgXV9pbXP29xuWs5GEirmN/EUbbgBuQ8X5V85WIvBC71/F18lVKFwg9nMCtE6YK1DW
\r
41 hwgaih/1Vo6Tt5raCAdUsion/YLffa+WsY850UQ4OsdvetwzzGS+sU8E+/23f7dt3ytO
\r
42 a/e+64037s7wpm5Lhe0bJP0JBC4yzMMDCHIW/GmorSfwgZEwMxyJJq43tJ+eb2xrlU/q
\r
43 Yo9nUxNgcTCoOyHdn2+TLqQESbrnhOSzhPAFb35saD8wjV/eid+TwOEUao+ZippgYk9o
\r
46 ALyK8tL0V4OAHdR+BpaEZPMWT6x0uIJYYcYO3DDcDb0orvHkjt9ZavLDMTmuHhWJKsvW5A==
\r
47 X-Received: by 10.28.4.7 with SMTP id 7mr1093599wme.77.1465599790321;
\r
48 Fri, 10 Jun 2016 16:03:10 -0700 (PDT)
\r
49 Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162])
\r
50 by smtp.gmail.com with ESMTPSA id s10sm14487020wjt.29.2016.06.10.16.03.09
\r
51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
\r
52 Fri, 10 Jun 2016 16:03:09 -0700 (PDT)
\r
53 From: Mark Walters <markwalters1009@gmail.com>
\r
54 To: notmuch@notmuchmail.org
\r
55 Subject: [PATCH 5/6] Modify our local copy of message-do-fcc
\r
56 Date: Sat, 11 Jun 2016 00:02:51 +0100
\r
57 Message-Id: <1465599772-10297-6-git-send-email-markwalters1009@gmail.com>
\r
58 X-Mailer: git-send-email 2.1.4
\r
59 In-Reply-To: <1465599772-10297-1-git-send-email-markwalters1009@gmail.com>
\r
60 References: <1465599772-10297-1-git-send-email-markwalters1009@gmail.com>
\r
61 X-BeenThere: notmuch@notmuchmail.org
\r
62 X-Mailman-Version: 2.1.20
\r
64 List-Id: "Use and development of the notmuch mail system."
\r
65 <notmuch.notmuchmail.org>
\r
66 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,
\r
67 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
68 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>
\r
69 List-Post: <mailto:notmuch@notmuchmail.org>
\r
70 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
71 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,
\r
72 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
73 X-List-Received-Date: Fri, 10 Jun 2016 23:03:57 -0000
\r
75 Since we also need to use this code for the draft handling we split
\r
76 message-do-fcc into convenient sub-chunks (functions or macros as
\r
79 emacs/notmuch-maildir-fcc.el | 71 ++++++++++++++++++++++++++------------------
\r
80 1 file changed, 42 insertions(+), 29 deletions(-)
\r
82 diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
\r
83 index 7b3f232..fc645c5 100644
\r
84 --- a/emacs/notmuch-maildir-fcc.el
\r
85 +++ b/emacs/notmuch-maildir-fcc.el
\r
86 @@ -124,43 +124,56 @@ by notmuch-mua-mail"
\r
87 ;; Functions for saving a message either using notmuch insert or file
\r
88 ;; fcc. First functions common to the two cases.
\r
90 +(defmacro with-temporary-notmuch-message-buffer (&rest body)
\r
91 + "Set-up a temporary copy of the current message-mode buffer."
\r
92 + `(let ((case-fold-search t)
\r
93 + (buf (current-buffer))
\r
94 + (mml-externalize-attachments message-fcc-externalize-attachments))
\r
95 + (with-current-buffer (get-buffer-create " *message temp*")
\r
97 + (insert-buffer-substring buf)
\r
100 +(defun notmuch-maildir-setup-message-for-saving ()
\r
101 + "Setup message for saving. Should be called on a temporary copy.
\r
103 +This is taken from the function message-do-fcc."
\r
104 + (message-encode-message-body)
\r
105 + (save-restriction
\r
106 + (message-narrow-to-headers)
\r
107 + (let ((mail-parse-charset message-default-charset)
\r
108 + (rfc2047-header-encoding-alist
\r
109 + (cons '("Newsgroups" . default)
\r
110 + rfc2047-header-encoding-alist)))
\r
111 + (mail-encode-encoded-word-buffer)))
\r
112 + (goto-char (point-min))
\r
113 + (when (re-search-forward
\r
114 + (concat "^" (regexp-quote mail-header-separator) "$")
\r
116 + (replace-match "" t t )))
\r
118 (defun notmuch-maildir-message-do-fcc ()
\r
119 "Process Fcc headers in the current buffer.
\r
121 -This is a direct copy from message-mode's message-do-fcc."
\r
122 - (let ((case-fold-search t)
\r
123 - (buf (current-buffer))
\r
125 - (mml-externalize-attachments message-fcc-externalize-attachments))
\r
126 +This is a rearranged version of message mode's message-do-fcc."
\r
130 (message-narrow-to-headers)
\r
131 (setq file (message-fetch-field "fcc" t)))
\r
133 - (set-buffer (get-buffer-create " *message temp*"))
\r
135 - (insert-buffer-substring buf)
\r
136 - (message-encode-message-body)
\r
137 - (save-restriction
\r
138 - (message-narrow-to-headers)
\r
139 - (while (setq file (message-fetch-field "fcc" t))
\r
141 - (message-remove-header "fcc" nil t))
\r
142 - (let ((mail-parse-charset message-default-charset)
\r
143 - (rfc2047-header-encoding-alist
\r
144 - (cons '("Newsgroups" . default)
\r
145 - rfc2047-header-encoding-alist)))
\r
146 - (mail-encode-encoded-word-buffer)))
\r
147 - (goto-char (point-min))
\r
148 - (when (re-search-forward
\r
149 - (concat "^" (regexp-quote mail-header-separator) "$")
\r
151 - (replace-match "" t t ))
\r
152 - ;; Process FCC operations.
\r
154 - (setq file (pop list))
\r
155 - (notmuch-fcc-handler file))
\r
156 - (kill-buffer (current-buffer))))))
\r
157 + (with-temporary-notmuch-message-buffer
\r
158 + (save-restriction
\r
159 + (message-narrow-to-headers)
\r
160 + (while (setq file (message-fetch-field "fcc" t))
\r
162 + (message-remove-header "fcc" nil t)))
\r
163 + (notmuch-maildir-setup-message-for-saving)
\r
164 + ;; Process FCC operations.
\r
166 + (setq file (pop list))
\r
167 + (notmuch-fcc-handler file))
\r
168 + (kill-buffer (current-buffer)))))))
\r
170 (defun notmuch-fcc-handler (fcc-header)
\r
171 "Store message with file fcc."
\r