Re: [PATCH] Reordering of thread authors to list matching authors first
authorDirk Hohndel <hohndel@infradead.org>
Sat, 24 Apr 2010 17:35:05 +0000 (10:35 +1700)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:36:52 +0000 (09:36 -0800)
cb/6c113132b761141a8586383d2f5d67c8e9921b [new file with mode: 0644]

diff --git a/cb/6c113132b761141a8586383d2f5d67c8e9921b b/cb/6c113132b761141a8586383d2f5d67c8e9921b
new file mode 100644 (file)
index 0000000..9d7785d
--- /dev/null
@@ -0,0 +1,133 @@
+Return-Path: <BATV+28bf489b39c899822e75+2435+infradead.org+hohndel@bombadil.srs.infradead.org>\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 302C8431FC1\r
+       for <notmuch@notmuchmail.org>; Sat, 24 Apr 2010 10:35:09 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -4.2\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-4.2 tagged_above=-999 required=5\r
+       tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3] autolearn=unavailable\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 dLVku3CHUjZ6 for <notmuch@notmuchmail.org>;\r
+       Sat, 24 Apr 2010 10:35:07 -0700 (PDT)\r
+Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34])\r
+       by olra.theworths.org (Postfix) with ESMTP id CFF364196F2\r
+       for <notmuch@notmuchmail.org>; Sat, 24 Apr 2010 10:35:07 -0700 (PDT)\r
+Received: from localhost ([::1] helo=x200.gr8dns.org)\r
+       by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux))\r
+       id 1O5jFy-0006lt-MX; Sat, 24 Apr 2010 17:35:06 +0000\r
+Received: by x200.gr8dns.org (Postfix, from userid 500)\r
+       id 82FDCCC598; Sat, 24 Apr 2010 10:35:05 -0700 (PDT)\r
+From: Dirk Hohndel <hohndel@infradead.org>\r
+To: Carl Worth <cworth@cworth.org>, notmuch <notmuch@notmuchmail.org>\r
+Subject: Re: [PATCH] Reordering of thread authors to list matching authors\r
+       first\r
+In-Reply-To: <87hbn1og2m.fsf@yoom.home.cworth.org>\r
+References: <m31veru7vn.fsf@x200.gr8dns.org> <87zl1d5fc0.fsf@steelpick.2x.cz>\r
+       <m3zl1cfsb4.fsf@x200.gr8dns.org>\r
+       <87aatcysw8.fsf@wsheee.localdomain>\r
+       <m3wrwg6n9y.fsf@x200.gr8dns.org> <m3aaswyw9t.fsf@x200.gr8dns.org>\r
+       <m38w8gyw7w.fsf@x200.gr8dns.org>\r
+       <87hbn1og2m.fsf@yoom.home.cworth.org>\r
+User-Agent: Notmuch/0.2-187-g7c5f017 (http://notmuchmail.org) Emacs/23.1.1\r
+       (i386-redhat-linux-gnu)\r
+Date: Sat, 24 Apr 2010 10:35:05 -0700\r
+Message-ID: <m3633g3gae.fsf@x200.gr8dns.org>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-SRS-Rewrite: SMTP reverse-path rewritten from <hohndel@infradead.org> by\r
+       bombadil.infradead.org See http://www.infradead.org/rpr.html\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: Sat, 24 Apr 2010 17:35:09 -0000\r
+\r
+On Fri, 23 Apr 2010 17:21:53 -0700, Carl Worth <cworth@cworth.org> wrote:\r
+> On Wed, 21 Apr 2010 20:58:27 -0700, Dirk Hohndel <hohndel@infradead.org> wrote:\r
+> > When displaying threads as result of a search it makes sense to list those\r
+> > authors first who match the search. The matching authors are separated from the\r
+> > non-matching ones with a '|' instead of a ','\r
+> \r
+> It seems a reasonable feature to me.\r
+\r
+I switched back to origin/master to help get ready for 0.3 and\r
+tremendously miss this feature :-) \r
\r
+> Some notes on the patch:\r
+> \r
+> > +void\r
+> > +notmuch_message_set_author (notmuch_message_t *message,\r
+> > +                      const char *author)\r
+> > +{\r
+> > +    message->author = talloc_strdup(message, author);\r
+> > +    return;\r
+> > +}\r
+> \r
+> This is leaking any previously set author value, (admittedly, it's only\r
+> a "talloc leak" so it will still get cleaned up when the message is\r
+> cleaned up, but still.\r
+\r
+Fixed in forthcoming revision of this patch\r
+\r
+> \r
+> > +/* Set the author member of 'message' - this is the representation used\r
+> > + * when displaying the message\r
+> > + */\r
+> > +void\r
+> > +notmuch_message_set_author (notmuch_message_t *message, const char *author);\r
+> > +\r
+> > +/* Get the author member of 'message'\r
+> > + */\r
+> > +const char *\r
+> > +notmuch_message_get_author (notmuch_message_t *message);\r
+> \r
+> The notmuch.h file is our publicly installed header file for the library\r
+> interface. I don't think the feature here requires any new library\r
+> interface. Even if it did, we wouldn't want a public function like\r
+> set_author that could simply scramble internal state and change the\r
+> result of future calls to get_author.\r
+\r
+My mistake - moved them to notmuch-private.h\r
+\r
+> > +/*\r
+> > + * move authors of matched messages in the thread to \r
+> > + * the front of the authors list, but keep them in\r
+> > + * existing order within their group\r
+> > + */\r
+> > +static void\r
+> > +_thread_move_matched_author (notmuch_thread_t *thread,\r
+> > +                       const char *author)\r
+> \r
+> The implementation here seems a bit fiddly.\r
+> \r
+> We already have two passes over the messages, (first all messages, and\r
+> then all matched messages). And we're currently calling add_author from\r
+> the first pass.\r
+> \r
+> How about simply calling a new add_matched_author from the second pass\r
+> which would look very much like the existing add_author. Then we could\r
+> change add_author to accumulate authors into an array rather than a\r
+> string. Then, finally, we would append any of these authors not already\r
+> in the matched_authors hash tabled onto the final string.\r
+> \r
+> That should be less code and easier to understand I think.\r
+> \r
+> I can take a whack at that later if you don't beat me to it.\r
+\r
+Maybe I'm misunderstanding your proposed algorithm - but it seems quite\r
+a bit more complicated than what I'm doing today...\r
+\r
+/D\r