1 Return-Path: <dme@dme.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 6E689431FC7
\r
6 for <notmuch@notmuchmail.org>; Mon, 12 May 2014 05:29:38 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id 2SbHk87qUGlj for <notmuch@notmuchmail.org>;
\r
16 Mon, 12 May 2014 05:29:33 -0700 (PDT)
\r
17 Received: from mail-wg0-f42.google.com (mail-wg0-f42.google.com
\r
18 [74.125.82.42]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client
\r
19 certificate requested) by olra.theworths.org (Postfix) with ESMTPS id
\r
20 B6FB4431FC2 for <notmuch@notmuchmail.org>; Mon, 12 May 2014 05:29:32 -0700
\r
22 Received: by mail-wg0-f42.google.com with SMTP id y10so6620213wgg.13
\r
23 for <notmuch@notmuchmail.org>; Mon, 12 May 2014 05:29:31 -0700 (PDT)
\r
24 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
\r
25 d=1e100.net; s=20130820;
\r
26 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
\r
28 bh=k7lGn+r3PVEj5mpRiYdGS0/uH6KAbWHS3chP1tmr6Vw=;
\r
29 b=QQpoJBF40LNRJ2QS+o0/1Ug+ALUBWEkxVPhcwuQUnvQ4UVljnGQNHtkZeZa+QpIAu0
\r
30 gNmAkyAOtLjVUL1rkcrvQtbJ9J4GV3HRic/raWb8ARjF+wJZH3z7PRwf9JjTD5PD/r+i
\r
31 agKkCGQ6AzlwHPNSyY2/dekoHge7eC/WHx87/UEH1vJxsajMzcBWR+xWZ9iizChLqDfn
\r
32 +Aec+WRP/dkpawmPyN5C1qqPX38XIWQboe3BY2YD4XjTB+LRIsrFOu+JfruaEQ45ssem
\r
33 pZygDVdT3ov1ZOYJHQzOjlLuoaUmfKRAHPchpxHV+R3mAerecBdRhOMNUV/xKG32Elo0
\r
36 ALoCoQnr+eaKInQwXKlzlVRr76S6c2Cc0nxZlQcjTdz+y/NGYao2haDwpkwngsU4HmhGFT+uzoTf
\r
37 X-Received: by 10.180.88.129 with SMTP id bg1mr15477163wib.51.1399897771348;
\r
38 Mon, 12 May 2014 05:29:31 -0700 (PDT)
\r
39 Received: from hotblack-desiato.hh.sledj.net (disaster-area.hh.sledj.net.
\r
41 by mx.google.com with ESMTPSA id d6sm15890108wiz.4.2014.05.12.05.29.29
\r
42 for <notmuch@notmuchmail.org>
\r
43 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
\r
44 Mon, 12 May 2014 05:29:30 -0700 (PDT)
\r
45 Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000)
\r
46 id 3F37210B328; Mon, 12 May 2014 13:29:29 +0100 (BST)
\r
47 From: David Edmondson <dme@dme.org>
\r
48 To: notmuch@notmuchmail.org
\r
49 Subject: [PATCH v3 4/9] emacs/mua: Generate improved cited text for replies
\r
50 Date: Mon, 12 May 2014 13:29:24 +0100
\r
51 Message-Id: <1399897769-26809-5-git-send-email-dme@dme.org>
\r
52 X-Mailer: git-send-email 2.0.0.rc0
\r
53 In-Reply-To: <1399897769-26809-1-git-send-email-dme@dme.org>
\r
54 References: <87sixdujkv.fsf@qmul.ac.uk>
\r
55 <1399897769-26809-1-git-send-email-dme@dme.org>
\r
56 X-BeenThere: notmuch@notmuchmail.org
\r
57 X-Mailman-Version: 2.1.13
\r
59 List-Id: "Use and development of the notmuch mail system."
\r
60 <notmuch.notmuchmail.org>
\r
61 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
62 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
63 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
64 List-Post: <mailto:notmuch@notmuchmail.org>
\r
65 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
66 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
67 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
68 X-List-Received-Date: Mon, 12 May 2014 12:29:38 -0000
\r
70 Use the message display code to generate message text to cite in
\r
73 emacs/notmuch-mua.el | 38 ++++++++------------------------------
\r
74 1 file changed, 8 insertions(+), 30 deletions(-)
\r
76 diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
\r
77 index 95e4a4d..09c922f 100644
\r
78 --- a/emacs/notmuch-mua.el
\r
79 +++ b/emacs/notmuch-mua.el
\r
82 (eval-when-compile (require 'cl))
\r
84 -(declare-function notmuch-show-insert-bodypart "notmuch-show" (msg part depth &optional hide))
\r
85 +(declare-function notmuch-show-insert-body "notmuch-show" (msg body depth))
\r
89 @@ -123,31 +123,6 @@ list."
\r
90 else if (notmuch-match-content-type (plist-get part :content-type) "multipart/*")
\r
91 do (notmuch-mua-reply-crypto (plist-get part :content))))
\r
93 -(defun notmuch-mua-get-quotable-parts (parts)
\r
94 - (loop for part in parts
\r
95 - if (notmuch-match-content-type (plist-get part :content-type) "multipart/alternative")
\r
96 - collect (let* ((subparts (plist-get part :content))
\r
97 - (types (mapcar (lambda (part) (plist-get part :content-type)) subparts))
\r
98 - (chosen-type (car (notmuch-multipart/alternative-choose types))))
\r
99 - (loop for part in (reverse subparts)
\r
100 - if (notmuch-match-content-type (plist-get part :content-type) chosen-type)
\r
102 - else if (notmuch-match-content-type (plist-get part :content-type) "multipart/*")
\r
103 - append (notmuch-mua-get-quotable-parts (plist-get part :content))
\r
104 - else if (notmuch-match-content-type (plist-get part :content-type) "text/*")
\r
107 -(defun notmuch-mua-insert-quotable-part (message part)
\r
108 - ;; We don't want text properties leaking from the show renderer into
\r
109 - ;; the reply so we use a temp buffer. Also we don't want hooks, such
\r
110 - ;; as notmuch-wash-*, to be run on the quotable part so we set
\r
111 - ;; notmuch-show-insert-text/plain-hook to nil.
\r
112 - (insert (with-temp-buffer
\r
113 - (let ((notmuch-show-insert-text/plain-hook nil))
\r
114 - ;; Show the part but do not add buttons.
\r
115 - (notmuch-show-insert-bodypart message part 0 'no-buttons))
\r
116 - (buffer-substring-no-properties (point-min) (point-max)))))
\r
118 ;; There is a bug in emacs 23's message.el that results in a newline
\r
119 ;; not being inserted after the References header, so the next header
\r
120 ;; is concatenated to the end of it. This function fixes the problem,
\r
121 @@ -225,10 +200,13 @@ list."
\r
122 (insert "From: " from "\n")
\r
123 (insert "Date: " date "\n\n")
\r
125 - ;; Get the parts of the original message that should be quoted; this includes
\r
126 - ;; all the text parts, except the non-preferred ones in a multipart/alternative.
\r
127 - (let ((quotable-parts (notmuch-mua-get-quotable-parts (plist-get original :body))))
\r
128 - (mapc (apply-partially 'notmuch-mua-insert-quotable-part original) quotable-parts))
\r
129 + (insert (with-temp-buffer
\r
130 + ;; Don't attempt to clean up messages, excerpt
\r
131 + ;; citations, etc. in the original message before
\r
133 + (let ((notmuch-show-insert-text/plain-hook nil))
\r
134 + (notmuch-show-insert-body original (plist-get original :body) 0)
\r
135 + (buffer-substring-no-properties (point-min) (point-max)))))
\r