Re: [PATCH] Reordering of thread authors to list matching authors first
authorCarl Worth <cworth@cworth.org>
Sat, 24 Apr 2010 00:21:53 +0000 (17:21 +1700)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:36:51 +0000 (09:36 -0800)
b3/3311bcd3ace8b09bb5a7c3b820586935c1fb97 [new file with mode: 0644]

diff --git a/b3/3311bcd3ace8b09bb5a7c3b820586935c1fb97 b/b3/3311bcd3ace8b09bb5a7c3b820586935c1fb97
new file mode 100644 (file)
index 0000000..bb261a5
--- /dev/null
@@ -0,0 +1,134 @@
+Return-Path: <cworth@cworth.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 DDE3C4196F3\r
+       for <notmuch@notmuchmail.org>; Fri, 23 Apr 2010 17:21:54 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.89\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.89 tagged_above=-999 required=5\r
+       tests=[ALL_TRUSTED=-1, BAYES_00=-1.9, T_MIME_NO_TEXT=0.01]\r
+       autolearn=ham\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 f0rMPS1V1VLU; Fri, 23 Apr 2010 17:21:54 -0700 (PDT)\r
+Received: from yoom.home.cworth.org (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 0BF5C431FC1;\r
+       Fri, 23 Apr 2010 17:21:54 -0700 (PDT)\r
+Received: by yoom.home.cworth.org (Postfix, from userid 1000)\r
+       id AABA7568DE4; Fri, 23 Apr 2010 17:21:53 -0700 (PDT)\r
+From: Carl Worth <cworth@cworth.org>\r
+To: Dirk Hohndel <hohndel@infradead.org>, notmuch <notmuch@notmuchmail.org>\r
+Subject: Re: [PATCH] Reordering of thread authors to list matching authors\r
+       first\r
+In-Reply-To: <m38w8gyw7w.fsf@x200.gr8dns.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
+User-Agent: Notmuch/0.2-164-g57926bc (http://notmuchmail.org) Emacs/23.1.1\r
+       (i486-pc-linux-gnu)\r
+Date: Fri, 23 Apr 2010 17:21:53 -0700\r
+Message-ID: <87hbn1og2m.fsf@yoom.home.cworth.org>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/signed; boundary="=-=-=";\r
+       micalg=pgp-sha1; protocol="application/pgp-signature"\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 00:21:55 -0000\r
+\r
+--=-=-=\r
+Content-Transfer-Encoding: quoted-printable\r
+\r
+On Wed, 21 Apr 2010 20:58:27 -0700, Dirk Hohndel <hohndel@infradead.org> wr=\r
+ote:\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 fr=\r
+om the\r
+> non-matching ones with a '|' instead of a ','\r
+\r
+It seems a reasonable feature to me.\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 =3D 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
+> +/* 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 *auth=\r
+or);\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
+> +/*\r
+> + * move authors of matched messages in the thread to=20\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
+=2DCarl\r
+\r
+--=-=-=\r
+Content-Type: application/pgp-signature\r
+\r
+-----BEGIN PGP SIGNATURE-----\r
+Version: GnuPG v1.4.10 (GNU/Linux)\r
+\r
+iD8DBQFL0jmh6JDdNq8qSWgRAhb6AKCijZXXjFjK0PlhlhzTMeyMUKZL+ACdH/Df\r
+jkwAfLTN/kl3TnNA19WmZTU=\r
+=Fi+A\r
+-----END PGP SIGNATURE-----\r
+--=-=-=--\r