unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Damien Cassou <damien.cassou@gmail.com>
To: Mark Walters <markwalters1009@gmail.com>
Cc: notmuch mailing list <notmuch@notmuchmail.org>
Subject: Re: [PATCH] emacs: display tags in notmuch-show's header-line with links to search
Date: Thu, 8 Nov 2012 14:37:53 +0100	[thread overview]
Message-ID: <CA+y5ggiEyKgYeDuwB7uAwnERVCaTBe595skYz3wH6E5pExByVA@mail.gmail.com> (raw)
In-Reply-To: <87txt2z5lq.fsf@qmul.ac.uk>

Hi

On Wed, Nov 7, 2012 at 12:14 AM, Mark Walters <markwalters1009@gmail.com> 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

  reply	other threads:[~2012-11-08 13:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-06 20:39 [PATCH] emacs: display tags in notmuch-show's header-line with links to search Damien Cassou
2012-11-06 23:14 ` Mark Walters
2012-11-08 13:37   ` Damien Cassou [this message]
2012-11-08 14:01     ` David Bremner
2012-11-07 16:27 ` Jameson Graef Rollins
2012-11-07 16:39   ` Mark Walters
2012-11-07 17:21     ` Jameson Graef Rollins
2012-11-10 16:51 ` 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=CA+y5ggiEyKgYeDuwB7uAwnERVCaTBe595skYz3wH6E5pExByVA@mail.gmail.com \
    --to=damien.cassou@gmail.com \
    --cc=markwalters1009@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).