1 Return-Path: <tomi.ollila@iki.fi>
\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 F3452431FBF
\r
6 for <notmuch@notmuchmail.org>; Tue, 28 Oct 2014 14:37:20 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\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 5EL5BjWDSZRZ for <notmuch@notmuchmail.org>;
\r
16 Tue, 28 Oct 2014 14:37:12 -0700 (PDT)
\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])
\r
18 by olra.theworths.org (Postfix) with ESMTP id 8CECC431FB6
\r
19 for <notmuch@notmuchmail.org>; Tue, 28 Oct 2014 14:37:12 -0700 (PDT)
\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])
\r
21 by guru.guru-group.fi (Postfix) with ESMTP id 4B3B6100051;
\r
22 Tue, 28 Oct 2014 23:36:58 +0200 (EET)
\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>
\r
24 To: Jesse Rosenthal <jrosenthal@jhu.edu>, notmuch@notmuchmail.org
\r
25 Subject: Re: [PATCH] Avoid empty thread names if possible.
\r
26 In-Reply-To: <87oatnakqy.fsf@jhu.edu>
\r
27 References: <87oatnakqy.fsf@jhu.edu>
\r
28 User-Agent: Notmuch/0.18.1+130~ga61922f (http://notmuchmail.org) Emacs/24.3.1
\r
29 (x86_64-unknown-linux-gnu)
\r
30 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL
\r
31 $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F
\r
32 !)g;OY^,BjTbr)Np:%c_o'jj,Z
\r
33 Date: Tue, 28 Oct 2014 23:36:58 +0200
\r
34 Message-ID: <m2fve7dgg5.fsf@guru.guru-group.fi>
\r
36 Content-Type: text/plain
\r
37 X-BeenThere: notmuch@notmuchmail.org
\r
38 X-Mailman-Version: 2.1.13
\r
40 List-Id: "Use and development of the notmuch mail system."
\r
41 <notmuch.notmuchmail.org>
\r
42 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
43 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
44 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
45 List-Post: <mailto:notmuch@notmuchmail.org>
\r
46 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
47 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
48 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
49 X-List-Received-Date: Tue, 28 Oct 2014 21:37:21 -0000
\r
51 On Tue, Oct 07 2014, Jesse Rosenthal wrote:
\r
53 > Currently the thread is named based on either the oldest or newest
\r
54 > matching message (depending on the search order). If this message has
\r
55 > an empty subject, though, the thread will show up with an empty
\r
56 > subject in the search results. (See the thread starting with
\r
57 > `id:1412371140-21051-1-git-send-email-david@tethera.net` for an
\r
60 > This patch changes the behavior to name based on the oldest/newest
\r
61 > matching non-empty subject. This is particularly helpful for patchsets.
\r
62 > If the only subjects are empty, the thread subject will still be empty.
\r
64 > Signed-off-by: Jesse Rosenthal <jrosenthal@jhu.edu>
\r
66 > lib/thread.cc | 6 ++++--
\r
67 > 1 file changed, 4 insertions(+), 2 deletions(-)
\r
69 > diff --git a/lib/thread.cc b/lib/thread.cc
\r
70 > index 8922403..ea10295 100644
\r
71 > --- a/lib/thread.cc
\r
72 > +++ b/lib/thread.cc
\r
73 > @@ -348,18 +348,20 @@ _thread_add_matched_message (notmuch_thread_t *thread,
\r
76 > notmuch_message_t *hashed_message;
\r
77 > + const char *cur_subject;
\r
79 > date = notmuch_message_get_date (message);
\r
80 > + cur_subject = notmuch_thread_get_subject (thread);
\r
82 > if (date < thread->oldest || ! thread->matched_messages) {
\r
83 > thread->oldest = date;
\r
84 > - if (sort == NOTMUCH_SORT_OLDEST_FIRST)
\r
85 > + if (sort == NOTMUCH_SORT_OLDEST_FIRST || strlen(cur_subject) == 0)
\r
87 IMO it is a bit silly to scan through the whole string and use the return
\r
88 value of 0 (vs != 0) to have effect. we should probably have something like
\r
89 #define EMPTY_STRING(s) ((s)[0] == '\0')
\r
90 and use that instead.
\r
92 Also, to keep promise, mentioning 'patch' in commit message referring to
\r
93 the change introduced does IMO also look silly :D
\r
97 > _thread_set_subject_from_message (thread, message);
\r
100 > if (date > thread->newest || ! thread->matched_messages) {
\r
101 > thread->newest = date;
\r
102 > - if (sort != NOTMUCH_SORT_OLDEST_FIRST)
\r
103 > + if (sort != NOTMUCH_SORT_OLDEST_FIRST || strlen(cur_subject) == 0)
\r
104 > _thread_set_subject_from_message (thread, message);
\r
110 > _______________________________________________
\r
111 > notmuch mailing list
\r
112 > notmuch@notmuchmail.org
\r
113 > http://notmuchmail.org/mailman/listinfo/notmuch
\r