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 07:14:41 -0400

To: Jon Hurst, notmuch@notmuchmail.org

Cc:

From: David Bremner


Jon Hurst <jon@hursts.org.uk> writes:

> Hi,
>
> In the emacs front end, I can specify authors in the format for search
> results and trees. This is great when looking at received mail, but when
> looking at sent mail it is not optimal. I have used mutt in the past,
> and this puts "To: xxx*xxxx.xxx" in this field for sent mail, which is
> much more useful.
>
> Is there any way to achieve this behaviour with notmuch, and if not, may
> I request it as a feature.

For notmuch-search-mode, it is achievable by using a function in
notmuch-search-result-format. Unfortunately this seems only documented
in a commit message, which I append at the end of the message.  A
similar approach should work for notmuch-tree-result-format. I have not
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.


;; from 4f4ec48df25c8d2963e7124d2781b13e5a7f6a78

If the car of an element in notmuch-search-result-format is a
function, insert the result of calling the function into the buffer.

This allows a user to generate custom fields in the output of a search
result. For example, with:

(defun -notmuch-result-flags (format-string result)
  (let ((tags-to-letters '(("flagged" . "!")
			   ("unread" . "u")
			   ("mine" . "m")
			   ("sent" . "s")
			   ("replied" . "r")))
	(tags (plist-get result :tags)))

    (format format-string
	    (mapconcat (lambda (t2l)
			 (if (member (car t2l) tags)
			     (cdr t2l)
			   " "))
		       tags-to-letters ""))))

(setq notmuch-search-result-format '((-notmuch-result-flags . "%s ")
				     ("date" . "%12s ")
				     ("count" . "%9s ")
				     ("authors" . "%-30s ")
				     ("subject" . "%s ")
				     ("tags" . "(%s)")))

The first few characters on each line of the search result are used to
show information about some significant tags associated with the
thread.


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

Thread: