Re: [PATCH v4 08/16] reorganize indexing of multipart/signed and multipart/encrypted
[notmuch-archives.git] / d2 / 4ec90ce99d0e139f4f3f52b01225a4c1eff057
1 Return-Path: <jani@nikula.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 arlo.cworth.org (Postfix) with ESMTP id 637636DE0C5F\r
6  for <notmuch@notmuchmail.org>; Mon,  7 Mar 2016 09:18:13 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.55\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.55 tagged_above=-999 required=5 tests=[AWL=0.170, \r
12  DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7,\r
13  RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled\r
14 Received: from arlo.cworth.org ([127.0.0.1])\r
15  by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
16  with ESMTP id jrmEbRjBUylY for <notmuch@notmuchmail.org>;\r
17  Mon,  7 Mar 2016 09:18:07 -0800 (PST)\r
18 Received: from mail-wm0-f52.google.com (mail-wm0-f52.google.com\r
19  [74.125.82.52]) by arlo.cworth.org (Postfix) with ESMTPS id 844E86DE021D for\r
20  <notmuch@notmuchmail.org>; Mon,  7 Mar 2016 09:18:06 -0800 (PST)\r
21 Received: by mail-wm0-f52.google.com with SMTP id p65so117353470wmp.1\r
22  for <notmuch@notmuchmail.org>; Mon, 07 Mar 2016 09:18:06 -0800 (PST)\r
23 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
24  d=nikula-org.20150623.gappssmtp.com; s=20150623;\r
25  h=from:to:subject:in-reply-to:references:user-agent:date:message-id\r
26  :mime-version; bh=LIUbFU5noZuXk5mCkx6GyWjTUt78Ri+c3y7DHFR4swo=;\r
27  b=Jxqp1MwAO9UmiSakFPj4uEHRWjUQlDzTLZWEDV/JSmHaHSfjIVwsFtYnzKwAwZbajh\r
28  lECpFdTvIqO7M1k+4QXMs1fyKlCAfOzqJvHYohV6WK4oOmhVr4ABQbcnA66nkMEOBUGG\r
29  G2va5xL5YEeTdotNoct6PzbIIvCWMPAVF6oRvGWz0P3K4WseU+tU0uGEX7n405Z3hM7/\r
30  kfYxAIb41b4safX2lNX2S0z7DxAt94vG6ayGqOmK5MZP1u7vlLTOcrwPg+BJu8EMNezu\r
31  rGSiG678A9a6aGk5wMNxQzNEoXY76qdCxUR5Egj3VQ18MRZ/ZpTRnGlVssIUiZQ0cbpi\r
32  XBsw==\r
33 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
34  d=1e100.net; s=20130820;\r
35  h=x-gm-message-state:from:to:subject:in-reply-to:references\r
36  :user-agent:date:message-id:mime-version;\r
37  bh=LIUbFU5noZuXk5mCkx6GyWjTUt78Ri+c3y7DHFR4swo=;\r
38  b=fDawC2binuxuJoh4Di6QUR91+fiA3hehJsKc2gwHgrdez+Kb4Bn6/dTA9CYR/BXEyq\r
39  eyMdgIxOT+DTfVymo9bz/MM6PXOWPXnKNsOhZXo2pXUkanrdlRQ1SRiISBN2NHw3Y4tV\r
40  OX66yhmqetMaCHJfSY8vOHI72e6R/rVhlgfjnTiAcjKTj0odHygCZxECT7dLOOOP2UzQ\r
41  CitfQatj5n4Vplqb6qW5Ff0ZfkUX9JkWqPmsTsoLB/wmrSF/Ao68ukWhaDX3xiy+xS5S\r
42  fW0LvlPhbLfX9Cmuh6xntAqZgrDpurOqajBopYLWvWL6UlauyE2+uCBz1EaUcqPXoV+B\r
43  Zb5w==\r
44 X-Gm-Message-State:\r
45  AD7BkJKa4ylDgo95xBjFdp0cC2HQiUG5wDbySzFkvgvfIkFwpu5qQIodRHQWWoaySOFKDA==\r
46 X-Received: by 10.28.221.9 with SMTP id u9mr9024627wmg.92.1457371083772;\r
47  Mon, 07 Mar 2016 09:18:03 -0800 (PST)\r
48 Received: from localhost (mobile-access-bcee39-255.dhcp.inet.fi.\r
49  [188.238.57.255])\r
50  by smtp.gmail.com with ESMTPSA id hx10sm18875182wjb.25.2016.03.07.09.18.02\r
51  (version=TLSv1/SSLv3 cipher=OTHER);\r
52  Mon, 07 Mar 2016 09:18:02 -0800 (PST)\r
53 From: Jani Nikula <jani@nikula.org>\r
54 To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org\r
55 Subject: Re: [PATCH v6 6/6] emacs/mua: Let user specify which parts get a\r
56  header in citations.\r
57 In-Reply-To: <1455992680-24978-7-git-send-email-markwalters1009@gmail.com>\r
58 References: <1455992680-24978-1-git-send-email-markwalters1009@gmail.com>\r
59  <1455992680-24978-7-git-send-email-markwalters1009@gmail.com>\r
60 User-Agent: Notmuch/0.21+73~gf8cc320 (http://notmuchmail.org) Emacs/24.4.1\r
61  (x86_64-pc-linux-gnu)\r
62 Date: Mon, 07 Mar 2016 19:17:00 +0200\r
63 Message-ID: <87y49uqkc3.fsf@nikula.org>\r
64 MIME-Version: 1.0\r
65 Content-Type: text/plain\r
66 X-BeenThere: notmuch@notmuchmail.org\r
67 X-Mailman-Version: 2.1.20\r
68 Precedence: list\r
69 List-Id: "Use and development of the notmuch mail system."\r
70  <notmuch.notmuchmail.org>\r
71 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
72  <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
73 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
74 List-Post: <mailto:notmuch@notmuchmail.org>\r
75 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
76 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
77  <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
78 X-List-Received-Date: Mon, 07 Mar 2016 17:18:13 -0000\r
79 \r
80 On Sat, 20 Feb 2016, Mark Walters <markwalters1009@gmail.com> wrote:\r
81 > [ text/plain ]\r
82 \r
83 This patch (or, bisected commit d27d90875dfb emacs/mua: Let user specify\r
84 which parts get a header in citations.) causes the above to be added to\r
85 all replies. Why?\r
86 \r
87 I don't understand what "header" the patch is talking about. If it's the\r
88 [ text/plain ] above and it's intentional, *shudder*. Who would want\r
89 that?\r
90 \r
91 BR,\r
92 Jani.\r
93 \r
94 \r
95 > From: David Edmondson <dme@dme.org>\r
96 >\r
97 > Add a customizable function specifying which parts get a header when\r
98 > replying, and give some sensible possiblities. These are,\r
99 >\r
100 > 1) all parts except multipart/*. (Subparts of a multipart part do\r
101 > receive a header button.)\r
102 >\r
103 > 2) only included text/* parts.\r
104 >\r
105 > 3) Exactly as in the show buffer.\r
106 >\r
107 > 4) None at all. This means the reply contains a mish-mash of all the\r
108 > original message's parts.\r
109 >\r
110 > In the test suite we set the choice to option 4 to match the\r
111 > previous behaviour.\r
112 > ---\r
113 >  emacs/notmuch-mua.el  | 19 ++++++++++++++++++-\r
114 >  emacs/notmuch-show.el | 10 ++++++++++\r
115 >  test/test-lib.el      |  4 ++++\r
116 >  3 files changed, 32 insertions(+), 1 deletion(-)\r
117 >\r
118 > diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
119 > index ecc5bec..fcb3e95 100644\r
120 > --- a/emacs/notmuch-mua.el\r
121 > +++ b/emacs/notmuch-mua.el\r
122 > @@ -93,6 +93,23 @@ (defcustom notmuch-mua-cite-function 'message-cite-original\r
123 >    :link '(custom-manual "(message)Insertion Variables")\r
124 >    :group 'notmuch-reply)\r
125 >  \r
126 > +(defcustom notmuch-mua-reply-insert-header-p-function\r
127 > +  'notmuch-show-reply-insert-header-p-trimmed\r
128 > +  "Function to decide which parts get a header when replying.\r
129 > +\r
130 > +This function specifies which parts of a mime message with\r
131 > +mutiple parts get a header."\r
132 > +  :type '(radio (const :tag "All except multipart/* and hidden parts"\r
133 > +                            notmuch-show-reply-insert-header-p-trimmed)\r
134 > +             (const :tag "Only for included text parts"\r
135 > +                            notmuch-show-reply-insert-header-p-minimal)\r
136 > +             (const :tag "Exactly as in show view"\r
137 > +                            notmuch-show-insert-header-p)\r
138 > +             (const :tag "No part headers"\r
139 > +                            notmuch-show-reply-insert-header-p-never)\r
140 > +             (function :tag "Other"))\r
141 > +  :group 'notmuch-reply)\r
142 > +\r
143 >  ;;\r
144 >  \r
145 >  (defun notmuch-mua-get-switch-function ()\r
146 > @@ -231,7 +248,7 @@ (defun notmuch-mua-reply (query-string &optional sender reply-all)\r
147 >                      ;; Don't omit long parts.\r
148 >                      (notmuch-show-max-text-part-size 0)\r
149 >                      ;; Insert headers for parts as appropriate for replying.\r
150 > -                    (notmuch-show-insert-header-p-function #'notmuch-show-reply-insert-header-p-never))\r
151 > +                    (notmuch-show-insert-header-p-function notmuch-mua-reply-insert-header-p-function))\r
152 >                   (notmuch-show-insert-body original (plist-get original :body) 0)\r
153 >                   (buffer-substring-no-properties (point-min) (point-max)))))\r
154 >  \r
155 > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
156 > index 2a81ec1..371e62d 100644\r
157 > --- a/emacs/notmuch-show.el\r
158 > +++ b/emacs/notmuch-show.el\r
159 > @@ -954,6 +954,16 @@ (defun notmuch-show-insert-header-p (part hide)\r
160 >  (defun notmuch-show-reply-insert-header-p-never (part hide)\r
161 >    nil)\r
162 >  \r
163 > +(defun notmuch-show-reply-insert-header-p-trimmed (part hide)\r
164 > +  (let ((mime-type (notmuch-show-mime-type part)))\r
165 > +    (and (not (notmuch-match-content-type mime-type "multipart/*"))\r
166 > +      (not hide))))\r
167 > +\r
168 > +(defun notmuch-show-reply-insert-header-p-minimal (part hide)\r
169 > +  (let ((mime-type (notmuch-show-mime-type part)))\r
170 > +    (and (notmuch-match-content-type mime-type "text/*")\r
171 > +      (not hide))))\r
172 > +\r
173 >  (defun notmuch-show-insert-bodypart (msg part depth &optional hide)\r
174 >    "Insert the body part PART at depth DEPTH in the current thread.\r
175 >  \r
176 > diff --git a/test/test-lib.el b/test/test-lib.el\r
177 > index 596a705..02e020c 100644\r
178 > --- a/test/test-lib.el\r
179 > +++ b/test/test-lib.el\r
180 > @@ -184,6 +184,10 @@ (defmacro notmuch-test-progn (&rest body)\r
181 >  (setq notmuch-tag-deleted-formats\r
182 >        '((".*" nil)))\r
183 >  \r
184 > +;; For historical reasonse we don't print part headers when replying\r
185 > +;; in the tests suite\r
186 > +(setq notmuch-mua-reply-insert-header-p-function 'notmuch-show-reply-insert-header-p-never)\r
187 > +\r
188 >  ;; force a common html renderer, to avoid test variations between\r
189 >  ;; environments\r
190 >  \r
191 > -- \r
192 > 2.1.4\r
193 >\r
194 > _______________________________________________\r
195 > notmuch mailing list\r
196 > notmuch@notmuchmail.org\r
197 > https://notmuchmail.org/mailman/listinfo/notmuch\r