unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Ciprian Dorin Craciun <ciprian.craciun@gmail.com>
To: David Bremner <david@tethera.net>
Cc: notmuch@notmuchmail.org
Subject: Re: Add support for `thread` field in `notmuch show`
Date: Fri, 1 May 2020 15:17:14 +0300	[thread overview]
Message-ID: <CA+Tk8fyWpiLiH04eBLPQ9nM-Hok3RkGfjb45+ptRs5JmwbKZgg@mail.gmail.com> (raw)
In-Reply-To: <87h7wzj1r4.fsf@tethera.net>

On Fri, May 1, 2020 at 3:09 PM David Bremner <david@tethera.net> wrote:
> Ciprian Dorin Craciun <ciprian.craciun@gmail.com> writes:
> > I know that one can use `thread:{id:MESSAGE_ID}` to achieve the same
> > result, however:
> > * it is somewhat cumbersome for the integrator;
>
> Out of curiousity, what is harder about it? In both cases you have to
> extra one value from the JSON.


It is cumbersome because:
* for once, now you need for each email to run a new `notmuch search`
instance to get that email's thread id;  this is very sub-optimal when
you have more than a handful emails;
* secondly, it adds more code to the client;

To understand my use-case:  I currently intend to use `notmuch show
--format=json` to search my emails, and based on that to generate a
nice HTML page, displaying all found emails.  Now I want to include in
each email's section a link to only display the thread.

In order to do that, I either have to generate (by usin the technique
described above) the `thread:...` for each of those emails, which in
turn generates one CLI call per email.  (And 99% of the time perhaps I
don't even click the thread.)  (Another option would be to use the
`thread:{id:...}` for that link, but I find this quite a hack.)



> > * having the thread identifier explicitly, could be used as a key in a
> > cache, or other internal lookups;
> >
> > In fact the only way one can extract the thread identifier via the
> > `notmuch` CLI is to use `notmuch search --output=threads --
> > id:MESSAGE_ID`
>
> Offhand I have no strong objection to someone (who is not me) adding
> this. I think it's important to be aware that thread id's are ephemeral,
> and subject to change e.g. if the database is re-built from
> scratch.

I understand that `thread:...` is tied to a particular database, but
that shouldn't be an issue, as people don't regenerate often their
databases, and the caches are usually short-lived.


This weekend I'll try to take a stab at adding this to `notmuch`.

Ciprian.

      parent reply	other threads:[~2020-05-01 12:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-29 16:18 Add support for `thread` field in `notmuch show` Ciprian Dorin Craciun
2020-05-01 12:09 ` David Bremner
2020-05-01 12:14   ` David Bremner
2020-05-01 12:17   ` Ciprian Dorin Craciun [this message]

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+Tk8fyWpiLiH04eBLPQ9nM-Hok3RkGfjb45+ptRs5JmwbKZgg@mail.gmail.com \
    --to=ciprian.craciun@gmail.com \
    --cc=david@tethera.net \
    --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).