From: David Bremner <david@tethera.net>
To: Jon Hurst <jon@hursts.org.uk>, notmuch@notmuchmail.org
Subject: Re: Feature request: show destination in tree view when appropriate
Date: Sat, 16 Jul 2022 17:30:25 -0400 [thread overview]
Message-ID: <87cze468zy.fsf@tethera.net> (raw)
In-Reply-To: <877d4dry2i.fsf@hursts.org.uk>
Jon Hurst <jon@hursts.org.uk> writes:
> Many thanks David; just what I needed.
>
>> tested either, but I suppose you would need to write a function like
>> author-or-to that decides for each message which of those to insert.
>
> For the record:
>
>
> (defun -notmuch-authors-or-to (format-string result)
> (let* ((headers (plist-get result :headers))
> (match (plist-get result :match))
> (to (plist-get headers :To))
> (author (notmuch-tree-clean-address (plist-get headers :From)))
> (len (length (format format-string "")))
> (face (if match
> 'notmuch-tree-match-author-face
> 'notmuch-tree-no-match-author-face)))
> (if (string= author "Jon Hurst")
> (setq author (concat "To:" (notmuch-tree-clean-address to))))
> (when (> (length author) len)
> (setq author (substring author 0 len)))
> (propertize (format format-string author) 'face face)))
>
>
> (setq notmuch-tree-result-format
> '(("date" . "%12s ")
> (-notmuch-authors-or-to . "%-25s")
> ((("tree" . "%s")
> ("subject" . "%s"))
> . " %-54s ")
> ("tags" . "(%s)")))
Nice. I hope you don't mind, but I used a modified version of this code
as an example for the the documentation:
https://nmbug.notmuchmail.org/nmweb/show/20220716212228.56432-5-david%40tethera.net
next prev parent reply other threads:[~2022-07-16 21:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-16 9:36 Feature request: show destination in tree view when appropriate Jon Hurst
2022-07-16 11:14 ` David Bremner
2022-07-16 13:23 ` Jon Hurst
2022-07-16 21:30 ` David Bremner [this message]
2022-07-19 9:22 ` inwit
2022-07-19 9:56 ` Jon Hurst
2022-07-21 11:30 ` Jon Hurst
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=87cze468zy.fsf@tethera.net \
--to=david@tethera.net \
--cc=jon@hursts.org.uk \
--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).