Re: [PATCH] Avoid empty thread names if possible.
authorMark Walters <markwalters1009@gmail.com>
Wed, 29 Oct 2014 15:15:29 +0000 (15:15 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 18:05:50 +0000 (10:05 -0800)
58/07c068cedb89fba7337b16c6f25727a69533e2 [new file with mode: 0644]

diff --git a/58/07c068cedb89fba7337b16c6f25727a69533e2 b/58/07c068cedb89fba7337b16c6f25727a69533e2
new file mode 100644 (file)
index 0000000..3f94c81
--- /dev/null
@@ -0,0 +1,167 @@
+Return-Path: <m.walters@qmul.ac.uk>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id E218C431FC2\r
+       for <notmuch@notmuchmail.org>; Wed, 29 Oct 2014 08:15:40 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.098\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
+       tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
+       NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id 9sDaPYZ9ez9M for <notmuch@notmuchmail.org>;\r
+       Wed, 29 Oct 2014 08:15:36 -0700 (PDT)\r
+Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
+       (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id CECF8431FB6\r
+       for <notmuch@notmuchmail.org>; Wed, 29 Oct 2014 08:15:35 -0700 (PDT)\r
+Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
+       by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
+       (envelope-from <m.walters@qmul.ac.uk>)\r
+       id 1XjUyA-0004fQ-5C; Wed, 29 Oct 2014 15:15:30 +0000\r
+Received: from 5751dfa2.skybroadband.com ([87.81.223.162] helo=localhost)\r
+       by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)\r
+       (envelope-from <m.walters@qmul.ac.uk>)\r
+       id 1XjUy9-0006Fi-Of; Wed, 29 Oct 2014 15:15:29 +0000\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: Jesse Rosenthal <jrosenthal@jhu.edu>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH] Avoid empty thread names if possible.\r
+In-Reply-To: <87ppdb9eqs.fsf@jhu.edu>\r
+References: <87oatnakqy.fsf@jhu.edu> <87tx2nuvec.fsf@qmul.ac.uk>\r
+       <87ppdb9eqs.fsf@jhu.edu>\r
+User-Agent: Notmuch/0.18.1+86~gef5e66a (http://notmuchmail.org) Emacs/23.4.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Wed, 29 Oct 2014 15:15:29 +0000\r
+Message-ID: <87tx2maovi.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Sender-Host-Address: 87.81.223.162\r
+X-QM-Geographic: According to ripencc,\r
+       this message was delivered by a machine in Britain (UK) (GB).\r
+X-QM-SPAM-Info: Sender has good ham record.  :)\r
+X-QM-Body-MD5: 95ba90fb2b3b95c06b27d3b844fe64cd (of first 20000 bytes)\r
+X-SpamAssassin-Score: -0.1\r
+X-SpamAssassin-SpamBar: /\r
+X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
+       determine if it is\r
+       spam. We require at least 5.0 points to mark a message as spam.\r
+       This message scored -0.1 points.\r
+       Summary of the scoring: \r
+       * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
+       provider *      (markwalters1009[at]gmail.com)\r
+       * -0.1 AWL AWL: From: address is in the auto white-list\r
+X-QM-Scan-Virus: ClamAV says the message is clean\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 29 Oct 2014 15:15:41 -0000\r
+\r
+\r
+Hi\r
+\r
+On Wed, 29 Oct 2014, Jesse Rosenthal <jrosenthal@jhu.edu> wrote:\r
+> [I'm not sure why the below reply did not go to the list. Later replies\r
+> did, so I assume there must have been so problem in the sending. Mark,\r
+> apologies if you get this twice.]\r
+>\r
+> Hi,\r
+>\r
+> Thanks for taking a look at this.\r
+>\r
+> Mark Walters <markwalters1009@gmail.com> writes:\r
+>> I approve of the change in the output but I am unsure about the\r
+>> implementation. It would be nice to have a clear rule about which\r
+>> subject is taken. Eg: \r
+>>\r
+>>         if sort is oldest first then it is the subject of the oldest\r
+>>         matching message with a non-empty subject. Similarly if sort\r
+>>         is newest first.\r
+>\r
+> The rule is actually in a four-year-old commit message (4971b85c4), in\r
+> almost exactly the same words you used:\r
+>\r
+>     ...name threads based on (a) matches for the query, and (b) the\r
+>     search order. If the search order is oldest-first (as in the default\r
+>     inbox) it chooses the oldest matching message as the subject. If the\r
+>     search order is newest-first it chooses the newest one.\r
+>\r
+>     Reply prefixes ("Re: ", "Aw: ", "Sv: ", "Vs: ") are ignored\r
+>     (case-insensitively) so a Re: won't change the subject.\r
+>\r
+> So we would, essentially, just need to add "non-empty" to this\r
+> phrasing. Where would be the right place to put it? Commit message?\r
+> NEWS? `search` man page?\r
+\r
+First I just wanted to check that I knew exactly what behaviour was\r
+intended. Having the new rule in the commit message might well be\r
+sufficient.\r
+\r
+>> Also, it would be nice if the implementation did not rely on what order\r
+>> we call _thread_add_matched_message on the matching messages in the\r
+>> thread. I think in some ways we already rely on the order (for the order\r
+>> of the author list), but if you want to rely on the order here I think\r
+>> it at least deserves a comment.\r
+>\r
+> That would require a rethinking, I think, of naming -- since it's\r
+> traditionally worked in terms of renaming. When a better option comes,\r
+> we throw out the old one. So order is pretty essential. (Not saying\r
+> that's the best way, just pointing out that it's the way it's been done\r
+> since Carl's initial alpha release.)\r
+\r
+I think that the current code does not depend on the order the messages\r
+are given to _thread_add_matched_message: regardless of the order the\r
+thread will get the subject of the oldest matching message (in\r
+sort=oldest first)\r
+\r
+In contrast your code will give different subjects depending in the\r
+order the messages are fed to _thread_add_matched_message.\r
+\r
+>> So looking at the above I think the oldest first gives the subject in\r
+>> my suggestion above (since the messages are supplied in oldest first\r
+>> order). But newest first may not: indeed if the subject starts out as\r
+>> something and becomes empty then this will set the subject empty and\r
+>> then leave it\r
+>\r
+>> (Note b_thread_set_subject_from_message calls notmuch_message_get_header\r
+>> which returns an empty string "" if the subject line is empty or not\r
+>> present).\r
+>\r
+> Hmmm... I was looking at the following line in\r
+> _thread_set_subject_from_message:\r
+>\r
+>     subject = notmuch_message_get_header (message, "subject");\r
+>     if (! subject)\r
+>      return;\r
+\r
+but subject="" is not null; subject is only null if\r
+notmuch_message_get_header throws an error. See the documentation for\r
+notmuch_message_get_header.\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+\r
+\r
+>\r
+> So, I don't think we ever actually change a content-ful string subject\r
+> to an empty one, as you describe above? If there's a non-empty string\r
+> there, and we get an empty subject, we leave the non-empty string in\r
+> place, right?\r
+>\r
+> Best,\r
+> Jesse\r