Re: [PATCH] emacs: display tags in notmuch-show's header-line with links to search
authorDamien Cassou <damien.cassou@gmail.com>
Thu, 8 Nov 2012 13:37:53 +0000 (14:37 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:50:27 +0000 (09:50 -0800)
63/52e9c8c860bf19eb263481203d912960a31ebd [new file with mode: 0644]

diff --git a/63/52e9c8c860bf19eb263481203d912960a31ebd b/63/52e9c8c860bf19eb263481203d912960a31ebd
new file mode 100644 (file)
index 0000000..5248bae
--- /dev/null
@@ -0,0 +1,146 @@
+Return-Path: <damien.cassou@gmail.com>\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 C6784431FB6\r
+       for <notmuch@notmuchmail.org>; Thu,  8 Nov 2012 05:38:15 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] 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 T3owA99tiM8g for <notmuch@notmuchmail.org>;\r
+       Thu,  8 Nov 2012 05:38:14 -0800 (PST)\r
+Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com\r
+       [209.85.220.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 705D3431FAE\r
+       for <notmuch@notmuchmail.org>; Thu,  8 Nov 2012 05:38:14 -0800 (PST)\r
+Received: by mail-vc0-f181.google.com with SMTP id n11so2790652vch.26\r
+       for <notmuch@notmuchmail.org>; Thu, 08 Nov 2012 05:38:13 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=mime-version:in-reply-to:references:from:date:message-id:subject:to\r
+       :cc:content-type;\r
+       bh=bKfy1pZ9Gwm5ZUh5/eWD6ySalWJqwUvlCx5cc18UlvU=;\r
+       b=CiJkegTGQc5dbDplI8yqmWBjRh/Clmeu1k7g8EudifSyhqid5p3Vi4QGZ/xzk0czz0\r
+       6IGKX6VhKtht/3mD5t0pd535KogD2CCqazztk95NkjzYWoGWKFjz8xZpzb+ISBfF6U7T\r
+       3G+I72btX+0CJlE/3or2nkuZn56TuMI3AC4cUpSOAUoxCCTb3lNGZG65UbfRqnZlL2X8\r
+       bHg2XdY4VL4TLM2/seVXrmAzwxOCDESma5dDLfDqW4BlmhwKkQMldBFRtSs7zxVH36Fq\r
+       2wkDWcK35WD39R4+wO9f2bq+mc3dHlkq+9J2K8MDuUX6ociQ1rqE4lZBXMLIDUttGWdI\r
+       XCFg==\r
+Received: by 10.52.100.229 with SMTP id fb5mr6197678vdb.103.1352381893757;\r
+       Thu, 08 Nov 2012 05:38:13 -0800 (PST)\r
+MIME-Version: 1.0\r
+Received: by 10.58.143.51 with HTTP; Thu, 8 Nov 2012 05:37:53 -0800 (PST)\r
+In-Reply-To: <87txt2z5lq.fsf@qmul.ac.uk>\r
+References: <1352234344-28119-1-git-send-email-damien.cassou@gmail.com>\r
+       <87txt2z5lq.fsf@qmul.ac.uk>\r
+From: Damien Cassou <damien.cassou@gmail.com>\r
+Date: Thu, 8 Nov 2012 14:37:53 +0100\r
+Message-ID:\r
+ <CA+y5ggiEyKgYeDuwB7uAwnERVCaTBe595skYz3wH6E5pExByVA@mail.gmail.com>\r
+Subject: Re: [PATCH] emacs: display tags in notmuch-show's header-line with\r
+       links to search\r
+To: Mark Walters <markwalters1009@gmail.com>\r
+Content-Type: text/plain; charset=ISO-8859-1\r
+Cc: notmuch mailing list <notmuch@notmuchmail.org>\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: Thu, 08 Nov 2012 13:38:15 -0000\r
+\r
+Hi\r
+\r
+On Wed, Nov 7, 2012 at 12:14 AM, Mark Walters <markwalters1009@gmail.com> wrote:\r
+> This is not a full review: just a couple of thoughts. It basically seems\r
+> to work as expected. I am not quite sure what behaviour you would expect\r
+> in a couple of corner cases:\r
+>\r
+> 1) what it the user toggles the display of matching messages (elide\r
+> mode)? Do you still want all tags from all messages including those not\r
+> visible?\r
+> 2) What about any tags from excluded messages? Should they show up? What\r
+> if they would be excluded but aren't because of the particular search?\r
+\r
+\r
+to me, a thread's tags should be independent of what is visible and\r
+thus should be stable. For example, when I want to star a thread, I\r
+star the message I'm currently seeing and I expect the thread to be\r
+starred for the rest of its life, even if the particular mail is not\r
+currently visible. What is the opinion of others?\r
+\r
+>>  emacs/notmuch-tager.el |   76 +++++++++++++++++++++++++++\r
+>\r
+> I would go for tagger rather than tager (but others can disagree).\r
+\r
+\r
+I don't care and can change it without problem. I picked 'tager'\r
+because it's shorter and I like to have a lot of information in my\r
+function names. What is the opinion of others?\r
+\r
+>> +(defun notmuch-query-thread-tags-from-id (thread-id)\r
+>> +  "Return the tags of thread whose id is THREAD-ID.\r
+>> +The thread tags are the union of the tags of emails in the\r
+>> +thread."\r
+>> +  (let ((tag-lists\r
+>> +      (notmuch-query-map-forest\r
+>> +       (lambda (msg) (plist-get msg :tags))\r
+>> +       (car (notmuch-query-get-threads\r
+>> +             (list (concat "thread:" thread-id)))))))\r
+>> +    (case (length tag-lists)\r
+>> +      (0 nil)\r
+>> +      (1 (car tag-lists))\r
+>> +      (otherwise (reduce (lambda (l1 l2)\r
+>> +                        (union l1 l2 :test 'string=))\r
+>> +                      tag-lists)))))\r
+>\r
+> Couldn't you do this with notmuch-show-mapc and avoid the extra call to\r
+> notmuch? It also probably helps some cases of excluded tags and elide\r
+> mode.\r
+>\r
+\r
+\r
+That would not work for my definition of a thread's tags. But if we\r
+change the definition, I can change the implementation of this\r
+function and avoid a call to notmuch.\r
+\r
+\r
+> If for some reason the query is better than I think you work\r
+> to remove the thread: from the thread-id below and then add it back in\r
+> here?\r
+\r
+\r
+I know and it is on purpose :-). When I first had a look at notmuch\r
+sources, I was confused by all those thread-id and mail-id everywhere\r
+that are sometimes ids (e.g., "000012") and sometimes queries (e.g.,\r
+"thread:000012"). To me, the code should use ids everywhere and build\r
+a query out of that when calling notmuch or when displaying a query.\r
+This would also avoid the use of the optional `bare' parameter in some\r
+existing functions.\r
+\r
+\r
+Thank you for your review. So, I'm waiting for more opinions because\r
+changing anything.\r
+\r
+Best\r
+\r
+--\r
+Damien Cassou\r
+http://damiencassou.seasidehosting.st\r
+\r
+"Success is the ability to go from one failure to another without\r
+losing enthusiasm."\r
+Winston Churchill\r