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