notmuch show: Parsing message depth in thread from JSON

Subject: notmuch show: Parsing message depth in thread from JSON

Date: Sat, 28 Dec 2024 08:20:49 +0300

To: notmuch@notmuchmail.org

Cc:

From: Yousef Akbar


Hi List Members,

I am writing a `Neovim` plugin [1] that provides an interface for
`notmuch` inside of nvim. Currently, it displays threads with a
`notmuch show` command and displays the default text output with some
formatting cleanups and indentation for depth, which works fine. But
I'm curious to try json outputs since neovim/lua supports converting
the json to lua object nicely.

However, in the default text output, I was heavily relying on the
"depth" field in the message header. In the json output (with
`--format=json`), the output doesn't indicate depth in any of the
fields.

Question: Any idea or hints for how to parse the depth of each message
in a thread with json output of notmuch show?

I searched the manual and various forums/sites but didn't find much. I
tried figuring out if there was a hierarchy to the json objects
embedded. There seems to be some pattern of levels of root message
followed by a list of replies, but I am not sure if it's intentional,
but please correct me if I'm wrong.

Many thanks for `notmuch` and appreciate any help I can get.

[1]: https://github.com/yousefakbar/notmuch.nvim

--
Yousef
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: