Re: [PATCH 9/9] add has: query prefix to search for specific properties
[notmuch-archives.git] / bb / 0d6fdf30e7e58e000b9debe2c20a3bb5578ebb
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 3CFD46DE186C\r
6  for <notmuch@notmuchmail.org>; Sat, 20 Feb 2016 10:25:12 -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.283\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.283 tagged_above=-999 required=5 tests=[AWL=0.287,\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
15  autolearn=disabled\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 ltAAbA91NZsz for <notmuch@notmuchmail.org>;\r
19  Sat, 20 Feb 2016 10:25:10 -0800 (PST)\r
20 Received: from mail-wm0-f42.google.com (mail-wm0-f42.google.com\r
21  [74.125.82.42]) by arlo.cworth.org (Postfix) with ESMTPS id 020776DE1870 for\r
22  <notmuch@notmuchmail.org>; Sat, 20 Feb 2016 10:24:58 -0800 (PST)\r
23 Received: by mail-wm0-f42.google.com with SMTP id g62so119130553wme.1\r
24  for <notmuch@notmuchmail.org>; Sat, 20 Feb 2016 10:24:57 -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=PuatqE2r1DYn8sGzmyv2nf6yNe13REoAKmYPDsoHUVA=;\r
28  b=MdCkUsAthsmG7hL+BufC49vmpt0IOasEbNM5YgNdQjfPPT1rA8iWZhH7w7ypCRPPY6\r
29  OGJzoee9QkCf8S3ZonkbSBtBZfVPyb6NSJnDC5aWAKcyrnIldHgCctLtq0KLPQCAQspQ\r
30  6p4cjMlyHtdZonjNfNXDMs6n/8+n6WKwmqdZQp1HhCLtl2G1zSlM0HUNyPAU4GuXTg07\r
31  HChFNqD95JaQah2MLdISNQiSYUb7iuKjCGxc8u0eFKZ9MSEyI+/DkRVNC7bqMv3aInQF\r
32  TMBgWEj2+/8LjBo+Tm5vvxw4JQMz37o2SzOfox/zCIUnpNMBfwYOSmev82VHluUVm55i\r
33  bL/Q==\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
37  :references;\r
38  bh=PuatqE2r1DYn8sGzmyv2nf6yNe13REoAKmYPDsoHUVA=;\r
39  b=lH8O4VF7pJ4/9qWpK6Aqw4n43iX94pJJLY+pz0q6zcUMNJTwPpdG2WtbqOFwD5lvKZ\r
40  0Kg4HheczCUUOMGhlL+n0XQjpMmsa0/My8cMlm8oqUSPIYKC7Onk8/XIWHvT0X6lUsTJ\r
41  +L8TNsnAA/7wBolyX0OHccLg6Ee5PqAmw7is27OReuqupl4zdY7Ma7Mo6nkVIRoVVWoB\r
42  cgtZyxOvXTgmwHIFOcYlYWDlbjB2Svbav82SJTrMTtARb9807SdU7qqOA3v1JdaaHKBg\r
43  g3yPs9SdJXbaaCtUiFSbziIjN4XLTzPPTDL8Bf6mUDodf8ardKk5+WrFOBH9wwe5KDiN\r
44  b62Q==\r
45 X-Gm-Message-State:\r
46  AG10YOSbkMmns0m5oR2YWVpq8H++IjPxKxPFlZKe6+9HKYEEkijaEH9Z/G6p0ltc+WiiiQ==\r
47 X-Received: by 10.194.189.71 with SMTP id gg7mr19509578wjc.127.1455992696707; \r
48  Sat, 20 Feb 2016 10:24:56 -0800 (PST)\r
49 Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162])\r
50  by smtp.gmail.com with ESMTPSA id s8sm16676143wje.35.2016.02.20.10.24.55\r
51  (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
52  Sat, 20 Feb 2016 10:24:56 -0800 (PST)\r
53 From: Mark Walters <markwalters1009@gmail.com>\r
54 To: notmuch@notmuchmail.org\r
55 Subject: [PATCH v6 6/6] emacs/mua: Let user specify which parts get a header\r
56  in citations.\r
57 Date: Sat, 20 Feb 2016 18:24:40 +0000\r
58 Message-Id: <1455992680-24978-7-git-send-email-markwalters1009@gmail.com>\r
59 X-Mailer: git-send-email 2.1.4\r
60 In-Reply-To: <1455992680-24978-1-git-send-email-markwalters1009@gmail.com>\r
61 References: <1455992680-24978-1-git-send-email-markwalters1009@gmail.com>\r
62 X-BeenThere: notmuch@notmuchmail.org\r
63 X-Mailman-Version: 2.1.20\r
64 Precedence: list\r
65 List-Id: "Use and development of the notmuch mail system."\r
66  <notmuch.notmuchmail.org>\r
67 List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
68  <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
69 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
70 List-Post: <mailto:notmuch@notmuchmail.org>\r
71 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
72 List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
73  <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
74 X-List-Received-Date: Sat, 20 Feb 2016 18:25:12 -0000\r
75 \r
76 From: David Edmondson <dme@dme.org>\r
77 \r
78 Add a customizable function specifying which parts get a header when\r
79 replying, and give some sensible possiblities. These are,\r
80 \r
81 1) all parts except multipart/*. (Subparts of a multipart part do\r
82 receive a header button.)\r
83 \r
84 2) only included text/* parts.\r
85 \r
86 3) Exactly as in the show buffer.\r
87 \r
88 4) None at all. This means the reply contains a mish-mash of all the\r
89 original message's parts.\r
90 \r
91 In the test suite we set the choice to option 4 to match the\r
92 previous behaviour.\r
93 ---\r
94  emacs/notmuch-mua.el  | 19 ++++++++++++++++++-\r
95  emacs/notmuch-show.el | 10 ++++++++++\r
96  test/test-lib.el      |  4 ++++\r
97  3 files changed, 32 insertions(+), 1 deletion(-)\r
98 \r
99 diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
100 index ecc5bec..fcb3e95 100644\r
101 --- a/emacs/notmuch-mua.el\r
102 +++ b/emacs/notmuch-mua.el\r
103 @@ -93,6 +93,23 @@ (defcustom notmuch-mua-cite-function 'message-cite-original\r
104    :link '(custom-manual "(message)Insertion Variables")\r
105    :group 'notmuch-reply)\r
106  \r
107 +(defcustom notmuch-mua-reply-insert-header-p-function\r
108 +  'notmuch-show-reply-insert-header-p-trimmed\r
109 +  "Function to decide which parts get a header when replying.\r
110 +\r
111 +This function specifies which parts of a mime message with\r
112 +mutiple parts get a header."\r
113 +  :type '(radio (const :tag "All except multipart/* and hidden parts"\r
114 +                              notmuch-show-reply-insert-header-p-trimmed)\r
115 +               (const :tag "Only for included text parts"\r
116 +                              notmuch-show-reply-insert-header-p-minimal)\r
117 +               (const :tag "Exactly as in show view"\r
118 +                              notmuch-show-insert-header-p)\r
119 +               (const :tag "No part headers"\r
120 +                              notmuch-show-reply-insert-header-p-never)\r
121 +               (function :tag "Other"))\r
122 +  :group 'notmuch-reply)\r
123 +\r
124  ;;\r
125  \r
126  (defun notmuch-mua-get-switch-function ()\r
127 @@ -231,7 +248,7 @@ (defun notmuch-mua-reply (query-string &optional sender reply-all)\r
128                        ;; Don't omit long parts.\r
129                        (notmuch-show-max-text-part-size 0)\r
130                        ;; Insert headers for parts as appropriate for replying.\r
131 -                      (notmuch-show-insert-header-p-function #'notmuch-show-reply-insert-header-p-never))\r
132 +                      (notmuch-show-insert-header-p-function notmuch-mua-reply-insert-header-p-function))\r
133                     (notmuch-show-insert-body original (plist-get original :body) 0)\r
134                     (buffer-substring-no-properties (point-min) (point-max)))))\r
135  \r
136 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
137 index 2a81ec1..371e62d 100644\r
138 --- a/emacs/notmuch-show.el\r
139 +++ b/emacs/notmuch-show.el\r
140 @@ -954,6 +954,16 @@ (defun notmuch-show-insert-header-p (part hide)\r
141  (defun notmuch-show-reply-insert-header-p-never (part hide)\r
142    nil)\r
143  \r
144 +(defun notmuch-show-reply-insert-header-p-trimmed (part hide)\r
145 +  (let ((mime-type (notmuch-show-mime-type part)))\r
146 +    (and (not (notmuch-match-content-type mime-type "multipart/*"))\r
147 +        (not hide))))\r
148 +\r
149 +(defun notmuch-show-reply-insert-header-p-minimal (part hide)\r
150 +  (let ((mime-type (notmuch-show-mime-type part)))\r
151 +    (and (notmuch-match-content-type mime-type "text/*")\r
152 +        (not hide))))\r
153 +\r
154  (defun notmuch-show-insert-bodypart (msg part depth &optional hide)\r
155    "Insert the body part PART at depth DEPTH in the current thread.\r
156  \r
157 diff --git a/test/test-lib.el b/test/test-lib.el\r
158 index 596a705..02e020c 100644\r
159 --- a/test/test-lib.el\r
160 +++ b/test/test-lib.el\r
161 @@ -184,6 +184,10 @@ (defmacro notmuch-test-progn (&rest body)\r
162  (setq notmuch-tag-deleted-formats\r
163        '((".*" nil)))\r
164  \r
165 +;; For historical reasonse we don't print part headers when replying\r
166 +;; in the tests suite\r
167 +(setq notmuch-mua-reply-insert-header-p-function 'notmuch-show-reply-insert-header-p-never)\r
168 +\r
169  ;; force a common html renderer, to avoid test variations between\r
170  ;; environments\r
171  \r
172 -- \r
173 2.1.4\r
174 \r