Re: Feature request: show destination in tree view when appropriate

Subject: Re: Feature request: show destination in tree view when appropriate

Date: Sat, 16 Jul 2022 17:30:25 -0400

To: Jon Hurst, notmuch@notmuchmail.org

Cc:

From: David Bremner


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
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: