Re: Flat search and threaded views
[notmuch-archives.git] / be / 4d8e2f3fec4488f9b778a6c3f9c1d0689ff575
1 Return-Path: <amdragon@mit.edu>\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 1A110431FB6\r
6         for <notmuch@notmuchmail.org>; Fri,  4 May 2012 12:05:12 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \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 spuVHow3GV2V for <notmuch@notmuchmail.org>;\r
16         Fri,  4 May 2012 12:05:11 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-4.mit.edu (DMZ-MAILSEC-SCANNER-4.MIT.EDU\r
18         [18.9.25.15])\r
19         by olra.theworths.org (Postfix) with ESMTP id 3400F431FAE\r
20         for <notmuch@notmuchmail.org>; Fri,  4 May 2012 12:05:11 -0700 (PDT)\r
21 X-AuditID: 1209190f-b7f4f6d00000092b-66-4fa428657d90\r
22 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
23         by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id 87.2E.02347.56824AF4; Fri,  4 May 2012 15:05:09 -0400 (EDT)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id q44J59Kf000362; \r
27         Fri, 4 May 2012 15:05:09 -0400\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
29         (authenticated bits=0)\r
30         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
31         by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q44J57wP017437\r
32         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
33         Fri, 4 May 2012 15:05:08 -0400 (EDT)\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)\r
35         (envelope-from <amdragon@mit.edu>)\r
36         id 1SQNoR-0005PT-NA; Fri, 04 May 2012 15:05:07 -0400\r
37 From: Austin Clements <amdragon@MIT.EDU>\r
38 To: Adam Wolfe Gordon <awg+notmuch@xvx.ca>, notmuch@notmuchmail.org\r
39 Subject: Re: [PATCH 2/2] emacs: Correctly quote non-text/plain parts in reply\r
40 In-Reply-To: <1335056093-17621-3-git-send-email-awg+notmuch@xvx.ca>\r
41 References: <1335056093-17621-1-git-send-email-awg+notmuch@xvx.ca>\r
42         <1335056093-17621-3-git-send-email-awg+notmuch@xvx.ca>\r
43 User-Agent: Notmuch/0.12+132~gf2f390b (http://notmuchmail.org) Emacs/23.3.1\r
44         (i486-pc-linux-gnu)\r
45 Date: Fri, 04 May 2012 15:05:07 -0400\r
46 Message-ID: <87obq3ahss.fsf@awakening.csail.mit.edu>\r
47 MIME-Version: 1.0\r
48 Content-Type: text/plain; charset=us-ascii\r
49 X-Brightmail-Tracker:\r
50  H4sIAAAAAAAAA+NgFnrEIsWRmVeSWpSXmKPExsUixG6nrpuqscTf4OtVK4sje2axW1y/OZPZ\r
51         gcnj2apbzB5NPxazBjBFcdmkpOZklqUW6dslcGUsnHiYqaBDsaJ310W2BsabUl2MnBwSAiYS\r
52         11ZuZoWwxSQu3FvP1sXIxSEksI9RYsvX/ywQznpGiQl3NjJDOCeYJKZt+M8E4SxhlLi78zE7\r
53         SD+bgIbEtv3LGUFsEQFniS3HXrOB2MICvhIvNp0A28EJFL+wZR1YXEigUuLnnYVMILaoQLzE\r
54         n97NYHEWAVWJ5bc6wep5ge7r+L6QHcIWlDg58wkLiM0soCVx499LpgmMArOQpGYhSS1gZFrF\r
55         KJuSW6Wbm5iZU5yarFucnJiXl1qka6KXm1mil5pSuokRFJSckvw7GL8dVDrEKMDBqMTDm8G7\r
56         xF+INbGsuDL3EKMkB5OSKG+APFCILyk/pTIjsTgjvqg0J7X4EKMEB7OSCG/S18X+QrwpiZVV\r
57         qUX5MClpDhYlcV41rXd+QgLpiSWp2ampBalFMFkZDg4lCd6J6kBDBYtS01Mr0jJzShDSTByc\r
58         IMN5gIYvA6nhLS5IzC3OTIfIn2JUlBLnnQuSEABJZJTmwfXCksYrRnGgV4R5t4NU8QATDlz3\r
59         K6DBTECDpQ0WgQwuSURISTUwSn5wm97gIfSb//Pv2K1ial+37Q8t7Ddojc274/3J6+Oio8f9\r
60         ZhZU85kkcNwqONlnY3qp5/uCE4+zH7ppJxvsSXH6uWbrxJnRm7jXrWmf5Rj7wihh38mXSd+/\r
61         vbFQF4gOOcL6N33d1DtTvrU0vTkWEyF2vdjs9LU/qa/0nORmHtz0PqfnyTXteiWW4oxEQy3m\r
62         ouJEAGjPyyn1AgAA\r
63 X-BeenThere: notmuch@notmuchmail.org\r
64 X-Mailman-Version: 2.1.13\r
65 Precedence: list\r
66 List-Id: "Use and development of the notmuch mail system."\r
67         <notmuch.notmuchmail.org>\r
68 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
69         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
70 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
71 List-Post: <mailto:notmuch@notmuchmail.org>\r
72 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
73 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
74         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
75 X-List-Received-Date: Fri, 04 May 2012 19:05:12 -0000\r
76 \r
77 Personally I think the narrowing trick is clever, but I worry that it\r
78 assumes too much about how mm-display-part works, since mm-display-part\r
79 just takes a buffer in the handle.  Is there a reason this doesn't\r
80 simply use notmuch-show-mm-display-part-inline?  Something like\r
81 (untested)\r
82 \r
83 (defun notmuch-mua-insert-quotable-part (message part)\r
84   (notmuch-show-mm-display-part-inline \r
85    message part (plist-get part :id) (plist-get part :content-type)))\r
86 \r
87 You might not even need notmuch-mua-insert-quotable-part.  (Why does\r
88 notmuch-show-mm-display-part-inline take all of those redundant\r
89 arguments?)\r
90 \r
91 If there's a reason that doesn't work, I still think it would be better\r
92 to use a temporary buffer; something like (untested)\r
93 \r
94 (defun notmuch-mua-insert-quotable-part (message part)\r
95   (let ((orig-buffer (current-buffer)))\r
96     (notmuch-with-temp-part-buffer message (plist-get part :id)\r
97       (let ((handle ...))\r
98         (with-current-buffer orig-buffer\r
99            (mm-display-part handle))))))\r
100 \r
101 In general, I feel like the reply code should share more structure with\r
102 the notmuch-show code.  I worry that the quoted text people wind up with\r
103 may not resemble the text they saw in the show buffer because the two\r
104 code paths use different rules.  But addressing that (if it's\r
105 addressable) should be done in a later series.\r
106 \r
107 On Sat, 21 Apr 2012, Adam Wolfe Gordon <awg+notmuch@xvx.ca> wrote:\r
108 > Quote non-text parts nicely by displaying them with mm-display-part\r
109 > before calling message-cite-original to quote them. HTML-only emails\r
110 > can now be quoted correctly.\r
111 >\r
112 > Mark the test for this feature as not broken.\r
113 > ---\r
114 >  emacs/notmuch-mua.el |   20 +++++++++++++++-----\r
115 >  test/emacs           |    1 -\r
116 >  2 files changed, 15 insertions(+), 6 deletions(-)\r
117 >\r
118 > diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
119 > index 87bd88d..f7af789 100644\r
120 > --- a/emacs/notmuch-mua.el\r
121 > +++ b/emacs/notmuch-mua.el\r
122 > @@ -21,6 +21,7 @@\r
123 >  \r
124 >  (require 'json)\r
125 >  (require 'message)\r
126 > +(require 'mm-view)\r
127 >  (require 'format-spec)\r
128 >  \r
129 >  (require 'notmuch-lib)\r
130 > @@ -90,6 +91,19 @@ list."\r
131 >       else if (notmuch-match-content-type (plist-get part :content-type) "text/*")\r
132 >         collect part))\r
133 >  \r
134 > +(defun notmuch-mua-insert-quotable-part (message part)\r
135 > +  (save-restriction\r
136 > +    (narrow-to-region (point) (point))\r
137 > +    (insert (notmuch-get-bodypart-content message part\r
138 > +                                       (plist-get part :id)\r
139 > +                                       notmuch-show-process-crypto))\r
140 > +    (let ((handle (mm-make-handle (current-buffer)\r
141 > +                               (list (plist-get part :content-type))))\r
142 > +       (end-of-orig (point-max)))\r
143 > +      (mm-display-part handle)\r
144 > +      (kill-region (point-min) end-of-orig))\r
145 > +    (goto-char (point-max))))\r
146 > +\r
147 >  ;; There is a bug in emacs 23's message.el that results in a newline\r
148 >  ;; not being inserted after the References header, so the next header\r
149 >  ;; is concatenated to the end of it. This function fixes the problem,\r
150 > @@ -169,11 +183,7 @@ list."\r
151 >       ;; Get the parts of the original message that should be quoted; this includes\r
152 >       ;; all the text parts, except the non-preferred ones in a multipart/alternative.\r
153 >       (let ((quotable-parts (notmuch-mua-get-quotable-parts (plist-get original :body))))\r
154 > -       (mapc (lambda (part)\r
155 > -               (insert (notmuch-get-bodypart-content original part\r
156 > -                                                     (plist-get part :id)\r
157 > -                                                     notmuch-show-process-crypto)))\r
158 > -             quotable-parts))\r
159 > +       (mapc (apply-partially 'notmuch-mua-insert-quotable-part original) quotable-parts))\r
160 >  \r
161 >       (set-mark (point))\r
162 >       (goto-char start)\r
163 > diff --git a/test/emacs b/test/emacs\r
164 > index e648f80..579844f 100755\r
165 > --- a/test/emacs\r
166 > +++ b/test/emacs\r
167 > @@ -445,7 +445,6 @@ EOF\r
168 >  test_expect_equal_file OUTPUT EXPECTED\r
169 >  \r
170 >  test_begin_subtest "Reply within emacs to an html-only message"\r
171 > -test_subtest_known_broken\r
172 >  add_message '[content-type]="text/html"' \\r
173 >           '[body]="Hi,<br />This is an <b>HTML</b> test message.<br /><br />OK?"'\r
174 >  test_emacs "(let ((message-hidden-headers '()))\r
175 > -- \r
176 > 1.7.5.4\r
177 >\r
178 > _______________________________________________\r
179 > notmuch mailing list\r
180 > notmuch@notmuchmail.org\r
181 > http://notmuchmail.org/mailman/listinfo/notmuch\r