From: Mark Walters Date: Wed, 29 Oct 2014 08:34:19 +0000 (+0000) Subject: Re: [PATCH] Avoid empty thread names if possible. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3c80bf11e0b024041f03ecf0266a3b85c149c8d1;p=notmuch-archives.git Re: [PATCH] Avoid empty thread names if possible. --- diff --git a/27/d2ae32ab384247c912b38b990caa514bfe7374 b/27/d2ae32ab384247c912b38b990caa514bfe7374 new file mode 100644 index 000000000..3efd3d1ca --- /dev/null +++ b/27/d2ae32ab384247c912b38b990caa514bfe7374 @@ -0,0 +1,156 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 18CA9431FC2 + for ; Wed, 29 Oct 2014 01:34:37 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -1.098 +X-Spam-Level: +X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5 + tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, + NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id 1NPQ5qt6cz6U for ; + Wed, 29 Oct 2014 01:34:29 -0700 (PDT) +Received: from mail1.qmul.ac.uk (mail1.qmul.ac.uk [138.37.6.7]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id DBC1F431FB6 + for ; Wed, 29 Oct 2014 01:34:28 -0700 (PDT) +Received: from smtp.qmul.ac.uk ([138.37.6.40]) + by mail1.qmul.ac.uk with esmtp (Exim 4.71) + (envelope-from ) + id 1XjOhy-0008Kb-2R; Wed, 29 Oct 2014 08:34:24 +0000 +Received: from 5751dfa2.skybroadband.com ([87.81.223.162] helo=localhost) + by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71) + (envelope-from ) + id 1XjOhx-0001Bh-Mv; Wed, 29 Oct 2014 08:34:21 +0000 +From: Mark Walters +To: Jesse Rosenthal , notmuch@notmuchmail.org +Subject: Re: [PATCH] Avoid empty thread names if possible. +In-Reply-To: <87oatnakqy.fsf@jhu.edu> +References: <87oatnakqy.fsf@jhu.edu> +User-Agent: Notmuch/0.18.1+86~gef5e66a (http://notmuchmail.org) Emacs/23.4.1 + (x86_64-pc-linux-gnu) +Date: Wed, 29 Oct 2014 08:34:19 +0000 +Message-ID: <87tx2nuvec.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Sender-Host-Address: 87.81.223.162 +X-QM-Geographic: According to ripencc, + this message was delivered by a machine in Britain (UK) (GB). +X-QM-SPAM-Info: Sender has good ham record. :) +X-QM-Body-MD5: 1a4550a7ce54ec42d6da23d121094105 (of first 20000 bytes) +X-SpamAssassin-Score: -0.1 +X-SpamAssassin-SpamBar: / +X-SpamAssassin-Report: The QM spam filters have analysed this message to + determine if it is + spam. We require at least 5.0 points to mark a message as spam. + This message scored -0.1 points. + Summary of the scoring: + * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail + provider * (markwalters1009[at]gmail.com) + * -0.1 AWL AWL: From: address is in the auto white-list +X-QM-Scan-Virus: ClamAV says the message is clean +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Wed, 29 Oct 2014 08:34:37 -0000 + + +Hi + +On Tue, 07 Oct 2014, Jesse Rosenthal wrote: +> Currently the thread is named based on either the oldest or newest +> matching message (depending on the search order). If this message has +> an empty subject, though, the thread will show up with an empty +> subject in the search results. (See the thread starting with +> `id:1412371140-21051-1-git-send-email-david@tethera.net` for an +> example.) +> +> This patch changes the behavior to name based on the oldest/newest +> matching non-empty subject. This is particularly helpful for patchsets. +> If the only subjects are empty, the thread subject will still be empty. + +I approve of the change in the output but I am unsure about the +implementation. It would be nice to have a clear rule about which +subject is taken. Eg: + + if sort is oldest first then it is the subject of the oldest + matching message with a non-empty subject. Similarly if sort + is newest first. + +Also, it would be nice if the implementation did not rely on what order +we call _thread_add_matched_message on the matching messages in the +thread. I think in some ways we already rely on the order (for the order +of the author list), but if you want to rely on the order here I think +it at least deserves a comment. + +> +> Signed-off-by: Jesse Rosenthal +> --- +> lib/thread.cc | 6 ++++-- +> 1 file changed, 4 insertions(+), 2 deletions(-) +> +> diff --git a/lib/thread.cc b/lib/thread.cc +> index 8922403..ea10295 100644 +> --- a/lib/thread.cc +> +++ b/lib/thread.cc +> @@ -348,18 +348,20 @@ _thread_add_matched_message (notmuch_thread_t *thread, +> { +> time_t date; +> notmuch_message_t *hashed_message; +> + const char *cur_subject; +> +> date = notmuch_message_get_date (message); +> + cur_subject = notmuch_thread_get_subject (thread); +> +> if (date < thread->oldest || ! thread->matched_messages) { +> thread->oldest = date; +> - if (sort == NOTMUCH_SORT_OLDEST_FIRST) +> + if (sort == NOTMUCH_SORT_OLDEST_FIRST || strlen(cur_subject) == 0) +> _thread_set_subject_from_message (thread, message); +> } +> +> if (date > thread->newest || ! thread->matched_messages) { +> thread->newest = date; +> - if (sort != NOTMUCH_SORT_OLDEST_FIRST) +> + if (sort != NOTMUCH_SORT_OLDEST_FIRST || strlen(cur_subject) == 0) +> _thread_set_subject_from_message (thread, message); +> } + +So looking at the above I think the oldest first gives the subject in +my suggestion above (since the messages are supplied in oldest first +order). But newest first may not: indeed if the subject starts out as +something and becomes empty then this will set the subject empty and +then leave it empty. + +(Note _thread_set_subject_from_message calls notmuch_message_get_header +which returns an empty string "" if the subject line is empty or not +present). + +Best wishes + +Mark + + +> +> -- +> 2.1.2 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch