Re: [PATCH v4 13/16] add indexopts to notmuch python bindings.
[notmuch-archives.git] / fb / d06d7cedc39729ef1e552ffef30b6b373260ee
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 767AB431FC9\r
6         for <notmuch@notmuchmail.org>; Thu, 22 Jan 2015 23:21:51 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 1.739\r
10 X-Spam-Level: *\r
11 X-Spam-Status: No, score=1.739 tagged_above=-999 required=5\r
12         tests=[DNS_FROM_AHBL_RHSBL=2.438, RCVD_IN_DNSWL_LOW=-0.7,\r
13         UNPARSEABLE_RELAY=0.001] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id hPiP5WAt5Uox for <notmuch@notmuchmail.org>;\r
17         Thu, 22 Jan 2015 23:21:48 -0800 (PST)\r
18 Received: from mail-wg0-f50.google.com (mail-wg0-f50.google.com\r
19  [74.125.82.50])        (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
20  certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
21  E4869431FBC    for <notmuch@notmuchmail.org>; Thu, 22 Jan 2015 23:21:47 -0800\r
22  (PST)\r
23 Received: by mail-wg0-f50.google.com with SMTP id b13so5800777wgh.9\r
24         for <notmuch@notmuchmail.org>; Thu, 22 Jan 2015 23:21:45 -0800 (PST)\r
25 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
26         d=1e100.net; s=20130820;\r
27         h=x-gm-message-state:to:subject:in-reply-to:references:user-agent\r
28         :from:date:message-id:mime-version:content-type;\r
29         bh=ZWkq4RgDijFIFhWnPzuaOUtP0AiINqFRJw7h3U8rqKY=;\r
30         b=AyHISFp1x66MPgeD95O1QL2swJKYE61yjHkWzOjoqXTP2FgGrVGGcmRZ4YgZYq3m+q\r
31         WPE8kov10m14OnK9YU8dz8810rsxPs8mjUyMpC9Fie6Zd4+OelRTEOpqDRXXhFYyES1S\r
32         Z7rjRx1z79RFpksQQsGEBXTPs8laPJXf7Hsvlgrh1N7i6grRWzhlfifdqHHfAW61/JpK\r
33         noQu4K641Ambpc2JWGHpuhQ/99CLGTWYgEdmXIPMnXf4thVC2fGFG5AGtaTPdnlp1ge7\r
34         bG9i5u50Je6jfyeAfX+pk+oDG2yi57pCvPlMLiJR+Ol4Nw+ZpxA/dXTeTwOfyz6OcdzX\r
35         3OXw==\r
36 X-Gm-Message-State:\r
37  ALoCoQmFACvyd8hkO6Vj5Z99cLBuMAMplLCjAuDC7j0Z2lNhidpox6jLQpT+JakSvYGRV/NN6KXr\r
38 X-Received: by 10.194.120.40 with SMTP id kz8mr10658929wjb.21.1421997704085;\r
39         Thu, 22 Jan 2015 23:21:44 -0800 (PST)\r
40 Received: from disaster-area.hh.sledj.net\r
41         ([2a01:348:1a2:1:ea39:35ff:fe2c:a227])\r
42         by mx.google.com with ESMTPSA id ei5sm639444wid.2.2015.01.22.23.21.42\r
43         (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
44         Thu, 22 Jan 2015 23:21:42 -0800 (PST)\r
45 Received: from localhost (30000@localhost [local]);\r
46         by localhost (OpenSMTPD) with ESMTPA id 2b5df55d;\r
47         Fri, 23 Jan 2015 07:21:41 +0000 (UTC)\r
48 To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org\r
49 Subject: Re: [PATCH] emacs: show: allow user to hide some mime types by\r
50         default.\r
51 In-Reply-To: <1421960852-26424-1-git-send-email-markwalters1009@gmail.com>\r
52 References: <1421960852-26424-1-git-send-email-markwalters1009@gmail.com>\r
53 User-Agent: none\r
54 From: David Edmondson <dme@dme.org>\r
55 Date: Fri, 23 Jan 2015 07:21:41 +0000\r
56 Message-ID: <cun8ugu3qt6.fsf@gargravarr.hh.sledj.net>\r
57 MIME-Version: 1.0\r
58 Content-Type: text/plain\r
59 X-BeenThere: notmuch@notmuchmail.org\r
60 X-Mailman-Version: 2.1.13\r
61 Precedence: list\r
62 List-Id: "Use and development of the notmuch mail system."\r
63         <notmuch.notmuchmail.org>\r
64 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
65         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
66 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
67 List-Post: <mailto:notmuch@notmuchmail.org>\r
68 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
69 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
70         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
71 X-List-Received-Date: Fri, 23 Jan 2015 07:21:51 -0000\r
72 \r
73 On Thu, Jan 22 2015, Mark Walters wrote:\r
74 > This commit adds a customize variable that allows the user to choose\r
75 > to hide some mime types by default. They can still choose to view the\r
76 > part by toggling the part button.\r
77 >\r
78 > One use is for hiding all text/html parts. This would mean that some\r
79 > explicit user action was required before the part was loaded which\r
80 > would mitigate some of the problems of remote image loading by the\r
81 > emacs html renderer as detailed by dkg in\r
82 > id:87ppa7q25w.fsf@alice.fifthhorseman.net.\r
83 \r
84 Whilst I think that having this knob is a good thing, I don't think that\r
85 it's a solution to the 'text/html renderers access the network'\r
86 problem. I can't sensibly (and don't wish to) disable the display of\r
87 text/html parts by default (colleagues generate too many text/html\r
88 messages to make that feasible, and I have rss2imap generate a bunch of\r
89 text/html messages that I want to see in their full glory), but would\r
90 definitely like to choose whether a message can sell me out to\r
91 advertisers.\r
92 \r
93 I'm trying to say that this is good, but let's not get into the habit of\r
94 telling someone that complains about network access that adding\r
95 text/html to `notmuch-show-always-hide-types' is the solution.\r
96 \r
97 > ---\r
98 >\r
99 > I think this might be useful anyway (dkg asked for it before he found\r
100 > the bug) but seems particularly relevant now.\r
101 >\r
102 > To use set the variable notmuch-show-always-hide-types to '(text/html)\r
103 > or use the customize setting to add text/html to the list.\r
104 >\r
105 > Given the lack of control we have over the emacs renderers (so\r
106 > possibility of future problems) we could even set this by default.\r
107 >\r
108 > Best wishes\r
109 >\r
110 > Mark\r
111 >\r
112 > emacs/notmuch-show.el | 18 +++++++++++++++++-\r
113 >  1 file changed, 17 insertions(+), 1 deletion(-)\r
114 >\r
115 > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
116 > index 9f6fe07..8f49f17 100644\r
117 > --- a/emacs/notmuch-show.el\r
118 > +++ b/emacs/notmuch-show.el\r
119 > @@ -234,6 +234,15 @@ every user interaction with notmuch."\r
120 >    :type 'function\r
121 >    :group 'notmuch-show)\r
122 >  \r
123 > +(defcustom notmuch-show-always-hide-types nil\r
124 > +  "List of mime types that should always be hidden.\r
125 > +\r
126 > +This is a list of mime types that should be initally displayed in\r
127 > +the show buffer as hidden parts; they can be displayed by\r
128 > +toggling the part button. Wildcards are allowed in the list."\r
129 > +  :type '(repeat string)\r
130 > +  :group 'notmuch-show)\r
131 > +\r
132 >  (defmacro with-current-notmuch-show-message (&rest body)\r
133 >    "Evaluate body with current buffer set to the text of current message"\r
134 >    `(save-excursion\r
135 > @@ -798,6 +807,12 @@ message at DEPTH in the current thread."\r
136 >               (intern (concat "notmuch-show-insert-part-" content-type))))\r
137 >      result))\r
138 >  \r
139 > +(defun notmuch-show-always-hide (mime-type)\r
140 > +  "Is mime-type in notmuch-show-always-hide-types"\r
141 > +  (let (match)\r
142 > +    (dolist (type notmuch-show-always-hide-types match)\r
143 > +      (setq match (or match (notmuch-match-content-type mime-type type))))))\r
144 > +\r
145 >  ;; \f\r
146 \r
147 >  \r
148 >  (defun notmuch-show-insert-bodypart-internal (msg part content-type nth depth button)\r
149 > @@ -900,7 +915,8 @@ useful for quoting in replies)."\r
150 >        (nth (plist-get part :id))\r
151 >        (beg (point))\r
152 >        ;; Hide the part initially if HIDE is t.\r
153 > -      (show-part (not (equal hide t)))\r
154 > +      (show-part (and (not (equal hide t))\r
155 > +                      (not (notmuch-show-always-hide mime-type))))\r
156 >        ;; We omit the part button for the first (or only) part if\r
157 >        ;; this is text/plain, or HIDE is 'no-buttons.\r
158 >        (button (unless (or (equal hide 'no-buttons)\r
159 > -- \r
160 > 2.1.4\r
161 >\r
162 > _______________________________________________\r
163 > notmuch mailing list\r
164 > notmuch@notmuchmail.org\r
165 > http://notmuchmail.org/mailman/listinfo/notmuch\r