unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Ethan Glasser-Camp <ethan.glasser.camp@gmail.com>
To: Damien Cassou <damien.cassou@gmail.com>,
	notmuch mailing list <notmuch@notmuchmail.org>
Subject: Re: [PATCH v2] emacs: display tags in notmuch-show with links
Date: Tue, 13 Nov 2012 21:03:44 -0500	[thread overview]
Message-ID: <87mwyl54an.fsf@betacantrips.com> (raw)
In-Reply-To: <1352565719-12397-1-git-send-email-damien.cassou@gmail.com>

Damien Cassou <damien.cassou@gmail.com> 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

  reply	other threads:[~2012-11-14  2:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-10 16:41 [PATCH v2] emacs: display tags in notmuch-show with links Damien Cassou
2012-11-14  2:03 ` Ethan Glasser-Camp [this message]
2012-11-15 15:09   ` Damien Cassou
2012-11-14 12:41 ` Mark Walters
2012-11-15 15:42   ` Damien Cassou
  -- strict thread matches above, loose matches on Subject: below --
2012-11-18 19:18 Damien Cassou
2012-11-18 22:59 ` Ethan Glasser-Camp
2012-11-19  0:10   ` Aaron Ecay
2012-11-20  4:23   ` Austin Clements
2012-11-20  4:50     ` Ethan
2012-11-22 18:11   ` Damien Cassou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mwyl54an.fsf@betacantrips.com \
    --to=ethan.glasser.camp@gmail.com \
    --cc=damien.cassou@gmail.com \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).