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

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

Date: Tue, 19 Jul 2022 11:22:43 +0200

To: Jon Hurst, David Bremner, notmuch@notmuchmail.org

Cc:

From: inwit


On Sat Jul 16, 2022 at 3:23 PM CEST, Jon Hurst wrote:
> 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)")))
Yay!! I've been hoping for this functionality, which also has been discussed
over at IRC. Thanks, Jon!

With my very basic elisp knowledge, I've tried to adapt this to the search (and
unthreaded) views, with no luck. I have trouble understanding the face part.
Since afaik in the search and unthreaded views there's no change in face for
matching messages, I thought I could get away by removing that part. But this
doesn't work:

(defun inwit/notmuch-search-authors-or-to (format-string result)
  (let* ((headers (plist-get result :headers))
         (to (plist-get headers :To))
         (author (plist-get headers :From)))
   (format format-string
        (if (string-match "inwit" author)
        (concat "To: " (notmuch-tree-clean-address to))
                      author))))

(setq notmuch-search-result-format
     '(("date" . "%12s ")
       ("count" . "%-7s ")
       (inwit/notmuch-search-authors-or-to . "%-20s")
       ("subject" . "%s ")
       ("tags" . "(%s)")))

Any help would be greatly appreciated.
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: