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 olra.theworths.org (Postfix) with ESMTP id BED4E431FB6
\r
6 for <notmuch@notmuchmail.org>; Fri, 10 Feb 2012 02:18:03 -0800 (PST)
\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 iC61gopl7lDM for <notmuch@notmuchmail.org>;
\r
16 Fri, 10 Feb 2012 02:17:57 -0800 (PST)
\r
17 Received: from mail-qy0-f181.google.com (mail-qy0-f181.google.com
\r
18 [209.85.216.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id 10B6B431FAE
\r
21 for <notmuch@notmuchmail.org>; Fri, 10 Feb 2012 02:17:57 -0800 (PST)
\r
22 Received: by qcsd17 with SMTP id d17so1764344qcs.26
\r
23 for <notmuch@notmuchmail.org>; Fri, 10 Feb 2012 02:17:55 -0800 (PST)
\r
24 Received: by 10.229.106.221 with SMTP id y29mr3866826qco.88.1328869075300;
\r
25 Fri, 10 Feb 2012 02:17:55 -0800 (PST)
\r
26 Received: from localhost (nikula.org. [92.243.24.172])
\r
27 by mx.google.com with ESMTPS id j17sm11969800qaj.9.2012.02.10.02.17.53
\r
28 (version=SSLv3 cipher=OTHER); Fri, 10 Feb 2012 02:17:54 -0800 (PST)
\r
29 From: Jani Nikula <jani@nikula.org>
\r
30 To: David Edmondson <dme@dme.org>, notmuch@notmuchmail.org
\r
31 Subject: Re: [PATCH v2 1/2] emacs: support defining a list of alternative
\r
33 In-Reply-To: <cunobt7ypdx.fsf@hotblack-desiato.hh.sledj.net>
\r
34 References: <cover.1328719309.git.jani@nikula.org>
\r
35 <ab777cf0fa83778d3399ac52094df9230738819d.1328798471.git.jani@nikula.org>
\r
36 <cunobt7ypdx.fsf@hotblack-desiato.hh.sledj.net>
\r
37 User-Agent: Notmuch/0.11.1+168~g25a7ceb (http://notmuchmail.org) Emacs/23.1.1
\r
39 Date: Fri, 10 Feb 2012 10:17:52 +0000
\r
40 Message-ID: <87ipjff0vj.fsf@nikula.org>
\r
42 Content-Type: text/plain; charset=us-ascii
\r
44 ALoCoQlyn+/0q2IQeatL5U14IgtAMiWagB+XL0SGaZ3OyjMJbp7UMYd6uxZY0iArv/lhPEkiKtFG
\r
45 X-BeenThere: notmuch@notmuchmail.org
\r
46 X-Mailman-Version: 2.1.13
\r
48 List-Id: "Use and development of the notmuch mail system."
\r
49 <notmuch.notmuchmail.org>
\r
50 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
51 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
52 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
53 List-Post: <mailto:notmuch@notmuchmail.org>
\r
54 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
55 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
56 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
57 X-List-Received-Date: Fri, 10 Feb 2012 10:18:03 -0000
\r
59 On Fri, 10 Feb 2012 10:05:46 +0000, David Edmondson <dme@dme.org> wrote:
\r
60 > On Thu, 9 Feb 2012 14:46:02 +0000, Jani Nikula <jani@nikula.org> wrote:
\r
61 > > Make notmuch-show-all-multipart/alternative-parts accept a list of
\r
62 > > regexps to match the part types to determine which parts to show in
\r
63 > > addition to the preferred types. This allows the user to force display
\r
64 > > some alternative part types while normally showing just the preferred
\r
67 > > Signed-off-by: Jani Nikula <jani@nikula.org>
\r
69 > > emacs/notmuch-show.el | 23 ++++++++++++++++++-----
\r
70 > > 1 files changed, 18 insertions(+), 5 deletions(-)
\r
72 > > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
73 > > index 24fde05..5f643f1 100644
\r
74 > > --- a/emacs/notmuch-show.el
\r
75 > > +++ b/emacs/notmuch-show.el
\r
76 > > @@ -94,10 +94,20 @@ any given message."
\r
77 > > :group 'notmuch-show
\r
78 > > :group 'notmuch-hooks)
\r
80 > > -;; Mostly useful for debugging.
\r
81 > > (defcustom notmuch-show-all-multipart/alternative-parts t
\r
82 > > - "Should all parts of multipart/alternative parts be shown?"
\r
83 > > - :type 'boolean
\r
84 > > + "Which parts of multipart/alternative should be shown?
\r
86 > > +This variable determines which parts of multipart/alternative
\r
87 > > +should be displayed. Set to t (the default) to show all
\r
88 > > +parts. Set to nil to only show the preferred parts. Set to a list
\r
89 > > +of regexps to display the preferred parts, and parts matching any
\r
90 > > +of the regexps, for example:
\r
92 > "If set to `t' (the default), all sub-parts of a
\r
93 > \"multipart/alternative\" part are shown. If set to `nil', only the
\r
94 > preferred part is shown. If set to a list of regexps, the preferred part
\r
95 > and all parts whose type matches one of the regexps will be shown."
\r
97 Thank you; this is the best kind of comment on improving documentation.
\r
101 > > + (setq notmuch-show-all-multipart/alternative-parts
\r
102 > > + '(\"text/.*calendar\" \"text/html\"))"
\r
103 > > + :type '(choice (const :tag "Show all parts" t)
\r
104 > > + (const :tag "Show preferred parts" nil)
\r
105 > > + (repeat :tag "Show preferred and parts matching regexps" string))
\r
106 > > :group 'notmuch-show)
\r
108 > > (defcustom notmuch-show-indent-messages-width 1
\r
109 > > @@ -513,8 +523,11 @@ current buffer, if possible."
\r
110 > > ;; should be chosen if there are more than one that match?
\r
111 > > (mapc (lambda (inner-part)
\r
112 > > (let ((inner-type (plist-get inner-part :content-type)))
\r
113 > > - (if (or notmuch-show-all-multipart/alternative-parts
\r
114 > > - (string= chosen-type inner-type))
\r
115 > > + (if (or (equal notmuch-show-all-multipart/alternative-parts t)
\r
116 > > + (string= chosen-type inner-type)
\r
118 > > + notmuch-show-all-multipart/alternative-parts
\r
119 > > + (equal (string-match-p (mapconcat (lambda (s) (format "^%s$" s)) notmuch-show-all-multipart/alternative-parts "\\|") inner-type) 0)))
\r
121 > This is quite messy. How about we add a general helper to "notmuch-lib.el":
\r
123 > (defun notmuch-string-match-list-p (regexps string)
\r
124 > (loop for regexp in regexps
\r
125 > if (string-match-p regexp string)
\r
130 > (if (or (string= chosen-type inner-type)
\r
131 > (equal notmuch-show-all-multipart/alternative-parts t)
\r
132 > (notmuch-string-match-list-p notmuch-show-all-multipart/alternative-parts inner-type))
\r
137 *sigh* I was so happy to make that mapconcat work. And I guess soon I'll
\r
138 have to add "code by dme" in this patch too. ;)
\r
140 But you're right, it will be more readable that way. v3 in a few days.
\r
148 > > (notmuch-show-insert-bodypart msg inner-part depth)
\r
149 > > (notmuch-show-insert-part-header (plist-get inner-part :id) inner-type inner-type nil " (not shown)"))))
\r