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 74E046DE1AC9
\r
6 for <notmuch@notmuchmail.org>; Sun, 14 Feb 2016 10:40:25 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
11 X-Spam-Status: No, score=-0.246 tagged_above=-999 required=5 tests=[AWL=0.324,
\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 fKeVQVrWHz6d for <notmuch@notmuchmail.org>;
\r
19 Sun, 14 Feb 2016 10:40:23 -0800 (PST)
\r
20 Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com
\r
21 [74.125.82.66]) by arlo.cworth.org (Postfix) with ESMTPS id D7BC46DE1A2F for
\r
22 <notmuch@notmuchmail.org>; Sun, 14 Feb 2016 10:40:19 -0800 (PST)
\r
23 Received: by mail-wm0-f66.google.com with SMTP id b205so4795550wmb.1
\r
24 for <notmuch@notmuchmail.org>; Sun, 14 Feb 2016 10:40:19 -0800 (PST)
\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=SLPZtgUXjVnynhWVP1tT8bXXJa+S2YrOZeXC6uMpJBU=;
\r
28 b=yXX4ChvnYs/EoVFa12gVObwBMABh0wWGPkXDQRBBRc0hPkRSzR+GPVex9Yap8X3DjP
\r
29 mSQ6rz61dzeWdxZvtRaeFLPQKTfOGz6fKPUe6fLEbPjIh+hKkmcheoxImDck+LE5axF9
\r
30 rf9Bd/tSFpO5ruTDNc4PplKJuA+p6vqy76r1UVr8dZ9epcHsNh1yDcLuIdZZ2UINBiPH
\r
31 4xiZA4BTkjXNMoAXrH6dOSNvgzNbDiiJklHRYjNXoAdsMVuo7Jjn0MgEVP+3J0ydOH+V
\r
32 YPPqYyDwbHxlBijbAtRSsU2EhBnUPBVZO1mFVUVZeojjPGaqDKiDdO32eDgmky49crX6
\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=SLPZtgUXjVnynhWVP1tT8bXXJa+S2YrOZeXC6uMpJBU=;
\r
39 b=CmkIjwwR76/Rv01bZ8FL6fRla9CLKSHvyCpo3hogQoIHLZ5lIDHUw/68h5N2sh6/iD
\r
40 fzqtmOxCkCFCBa2OFrbBivn0gNzxG1GwG0BSdogz4EjFHsd6l2DqT+ElZ0lIdXYdYVN3
\r
41 qtHUM9xEQhNsO79KpGKP+C2IqfQgf5WVZ0BMwu4WgIql/1sj/oirucNSL49jGxsJ2J5P
\r
42 5tY9NOGqU1Nd1eJVf8qne61/K8Dc/PhC+gdfkQZosS6Xy7ePm9h0dEffNbbkMSom1ilm
\r
43 yPn/XiOyif0SPQ5YQyFYwfPfBjfmdOHBqqB3jk6VNKA3dv1mHAbyC1CH1nblSUWNNuEk
\r
46 AG10YORQEKkqz1ll6yfksjXSPKh27ah0aW9E70M0nKqsEL8O7wcapRsYqx/144XCiZhtJw==
\r
47 X-Received: by 10.195.12.113 with SMTP id ep17mr11795496wjd.102.1455475218586;
\r
48 Sun, 14 Feb 2016 10:40:18 -0800 (PST)
\r
49 Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162])
\r
50 by smtp.gmail.com with ESMTPSA id e77sm12107568wma.18.2016.02.14.10.40.17
\r
51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
\r
52 Sun, 14 Feb 2016 10:40:18 -0800 (PST)
\r
53 From: Mark Walters <markwalters1009@gmail.com>
\r
54 To: notmuch@notmuchmail.org
\r
55 Subject: [PATCH v5 3/7] emacs/mua: Generate improved cited text for replies
\r
56 Date: Sun, 14 Feb 2016 18:39:55 +0000
\r
57 Message-Id: <1455475199-32622-4-git-send-email-markwalters1009@gmail.com>
\r
58 X-Mailer: git-send-email 2.1.4
\r
59 In-Reply-To: <1455475199-32622-1-git-send-email-markwalters1009@gmail.com>
\r
60 References: <1455475199-32622-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: Sun, 14 Feb 2016 18:40:25 -0000
\r
75 From: David Edmondson <dme@dme.org>
\r
77 Use the message display code to generate message text to cite in
\r
80 emacs/notmuch-mua.el | 38 ++++++++------------------------------
\r
81 1 file changed, 8 insertions(+), 30 deletions(-)
\r
83 diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
\r
84 index d4fad7b..a386d43 100644
\r
85 --- a/emacs/notmuch-mua.el
\r
86 +++ b/emacs/notmuch-mua.el
\r
89 (eval-when-compile (require 'cl))
\r
91 -(declare-function notmuch-show-insert-bodypart "notmuch-show" (msg part depth &optional hide))
\r
92 +(declare-function notmuch-show-insert-body "notmuch-show" (msg body depth))
\r
93 (declare-function notmuch-fcc-header-setup "notmuch-maildir-fcc" ())
\r
94 (declare-function notmuch-fcc-handler "notmuch-maildir-fcc" (destdir))
\r
96 @@ -144,31 +144,6 @@ Note that these functions use `mail-citation-hook' if that is non-nil."
\r
97 else if (notmuch-match-content-type (plist-get part :content-type) "multipart/*")
\r
98 do (notmuch-mua-reply-crypto (plist-get part :content))))
\r
100 -(defun notmuch-mua-get-quotable-parts (parts)
\r
101 - (loop for part in parts
\r
102 - if (notmuch-match-content-type (plist-get part :content-type) "multipart/alternative")
\r
103 - collect (let* ((subparts (plist-get part :content))
\r
104 - (types (mapcar (lambda (part) (plist-get part :content-type)) subparts))
\r
105 - (chosen-type (car (notmuch-multipart/alternative-choose types))))
\r
106 - (loop for part in (reverse subparts)
\r
107 - if (notmuch-match-content-type (plist-get part :content-type) chosen-type)
\r
109 - else if (notmuch-match-content-type (plist-get part :content-type) "multipart/*")
\r
110 - append (notmuch-mua-get-quotable-parts (plist-get part :content))
\r
111 - else if (notmuch-match-content-type (plist-get part :content-type) "text/*")
\r
114 -(defun notmuch-mua-insert-quotable-part (message part)
\r
115 - ;; We don't want text properties leaking from the show renderer into
\r
116 - ;; the reply so we use a temp buffer. Also we don't want hooks, such
\r
117 - ;; as notmuch-wash-*, to be run on the quotable part so we set
\r
118 - ;; notmuch-show-insert-text/plain-hook to nil.
\r
119 - (insert (with-temp-buffer
\r
120 - (let ((notmuch-show-insert-text/plain-hook nil))
\r
121 - ;; Show the part but do not add buttons.
\r
122 - (notmuch-show-insert-bodypart message part 0 'no-buttons))
\r
123 - (buffer-substring-no-properties (point-min) (point-max)))))
\r
125 ;; There is a bug in emacs 23's message.el that results in a newline
\r
126 ;; not being inserted after the References header, so the next header
\r
127 ;; is concatenated to the end of it. This function fixes the problem,
\r
128 @@ -247,10 +222,13 @@ Note that these functions use `mail-citation-hook' if that is non-nil."
\r
129 (insert "From: " from "\n")
\r
130 (insert "Date: " date "\n\n")
\r
132 - ;; Get the parts of the original message that should be quoted; this includes
\r
133 - ;; all the text parts, except the non-preferred ones in a multipart/alternative.
\r
134 - (let ((quotable-parts (notmuch-mua-get-quotable-parts (plist-get original :body))))
\r
135 - (mapc (apply-partially 'notmuch-mua-insert-quotable-part original) quotable-parts))
\r
136 + (insert (with-temp-buffer
\r
137 + ;; Don't attempt to clean up messages, excerpt
\r
138 + ;; citations, etc. in the original message before
\r
140 + (let ((notmuch-show-insert-text/plain-hook nil))
\r
141 + (notmuch-show-insert-body original (plist-get original :body) 0)
\r
142 + (buffer-substring-no-properties (point-min) (point-max)))))
\r