From 859bae0f8b268b2a43ea8da88e95dc20539df309 Mon Sep 17 00:00:00 2001 From: Ethan Glasser-Camp Date: Wed, 14 Nov 2012 21:03:44 +1900 Subject: [PATCH] Re: [PATCH v2] emacs: display tags in notmuch-show with links --- f0/be4c3bccb4ffded7f212231e4b1cbd3a981fce | 132 ++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 f0/be4c3bccb4ffded7f212231e4b1cbd3a981fce diff --git a/f0/be4c3bccb4ffded7f212231e4b1cbd3a981fce b/f0/be4c3bccb4ffded7f212231e4b1cbd3a981fce new file mode 100644 index 000000000..e46c459db --- /dev/null +++ b/f0/be4c3bccb4ffded7f212231e4b1cbd3a981fce @@ -0,0 +1,132 @@ +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 1D6A9431FBC + for ; Tue, 13 Nov 2012 18:03:50 -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 1-Q4Uy0Dh4fY for ; + Tue, 13 Nov 2012 18:03:49 -0800 (PST) +Received: from mail-qa0-f53.google.com (mail-qa0-f53.google.com + [209.85.216.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 9B723431FAF + for ; Tue, 13 Nov 2012 18:03:49 -0800 (PST) +Received: by mail-qa0-f53.google.com with SMTP id k31so17301qat.5 + for ; Tue, 13 Nov 2012 18:03:49 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:subject:in-reply-to:references:user-agent:date:message-id + :mime-version:content-type; + bh=g1j4nO3wh8KVUPX+uVwRMNbfCWm3X9pGgJIyNwACcj8=; + b=UWMQyOX3+vvDBXxuOTUSD+zkpDfZhp9tTlJ35O4SXBEboW5T9Ep+SLeENedWzRHiLQ + U765Amksuz9L7JKkHTSbTWfRdfdRJO+Ms5Qp1oGMquWUUN5nkJk/560p0YiizWwY1BwO + Ynvb0xjNmXygCtT3yJpKbbHbWxrAHCiISHODxyg0l1sDXDaSEDYnf4P9EvC7dQ8bveYP + TMLKD7wlbq/dMKAnp7HPwwdPykRyktLyKWQE8Evko1Jmg+0fjeJP4FJYJTzuqfmX9ImA + UyjzOlyZKLeQg3WIpa9/xRYgN+oj8ilwkR81ozTgGi3625XHFQAKKVr8jK2i0lP666PG + MhXA== +Received: by 10.224.109.199 with SMTP id k7mr1497183qap.66.1352858629039; + Tue, 13 Nov 2012 18:03:49 -0800 (PST) +Received: from smtp.gmail.com (mca2d36d0.tmodns.net. [208.54.45.202]) + by mx.google.com with ESMTPS id lk6sm1270337qeb.10.2012.11.13.18.03.47 + (version=TLSv1/SSLv3 cipher=OTHER); + Tue, 13 Nov 2012 18:03:47 -0800 (PST) +From: Ethan Glasser-Camp +To: Damien Cassou , + notmuch mailing list +Subject: Re: [PATCH v2] emacs: display tags in notmuch-show with links +In-Reply-To: <1352565719-12397-1-git-send-email-damien.cassou@gmail.com> +References: <1352565719-12397-1-git-send-email-damien.cassou@gmail.com> +User-Agent: Notmuch/0.14+45~g6ea9330 (http://notmuchmail.org) Emacs/23.4.1 + (x86_64-pc-linux-gnu) +Date: Tue, 13 Nov 2012 21:03:44 -0500 +Message-ID: <87mwyl54an.fsf@betacantrips.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +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: Wed, 14 Nov 2012 02:03:50 -0000 + +Damien Cassou writes: + +> +(defun notmuch-tagger-present-tags (tags &optional headerline) +> + "Return a property list which nicely presents all TAGS. +> + +> +If HEADERLINE is non-nil the returned list will be ready for +> +inclusion in the buffer's header-line. HEADERLINE must be nil in +> +all other cases." +> + (list +> + "(" +> + (notmuch-tagger-separate-elems (notmuch-tagger-format-tags tags headerline) " ") +> + ")")) + +It is kind of appalling that it takes 128 lines just to do this. It +seems like there has to be an easier way, or several easier +ways. Unfortunately, I don't see any. + +> diff --git a/test/emacs b/test/emacs +> index 44f641e..ecdc841 100755 +> --- a/test/emacs +> +++ b/test/emacs +> @@ -820,5 +820,66 @@ Date: Fri, 05 Jan 2001 15:43:57 +0000 +> EOF +> test_expect_equal_file OUTPUT EXPECTED +> +> +test_begin_subtest "Extracting all tags from a thread" +> +add_message \ +> + '[subject]="Extracting all tags from a thread"' \ +> + '[body]="body 1"' +> +parent=${gen_msg_id} +> +add_message \ +> + '[subject]="Extracting all tags from a thread"' \ +> + '[body]="body 2"' \ +> + "[in-reply-to]=\<$parent\>" +> +add_message \ +> + '[subject]="Extracting all tags from a thread"' \ +> + '[body]="body 3"' \ +> + "[in-reply-to]=\<$parent\>" +> +latest=${gen_msg_id} +> +# Extract the thread-id from one of the emails +> +thread_id=$(notmuch search id:${latest} | sed -e "s/thread:\([a-f0-9]*\).*/\1/") + +I think the accepted idiom is to use "notmuch search +--output=threads". This will output just a string like +"thread:00000000000000b9", so if you really need just the ID, you could +still use sed here... + +> +# Add tag "mytagfoo" to one of the emails +> +notmuch tag +mytagfoo id:${latest} +> +test_emacs_expect_t \ +> + "(notmuch-show \"thread:${thread_id}\") + +... but it seems like "thread:..." is good enough for you. + +> + (error \"We must be in notmch-show at this point but we are in %s.\" major-mode)) +> + (push-button) ;; simulate a press on the RET key +> + (if (eq major-mode 'notmuch-search-mode) +> + t +> + (format \"We must be in notmch-search at this point but we are in %s.\" major-mode))" + +s/notmch/notmuch/ here. + +Otherwise I think the code looks fine. I think the design concerns +raised by Mark Walters are probably valid, though. + +Ethan -- 2.26.2