unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
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 07:14:41 -0400	[thread overview]
Message-ID: <87ilnx5mxq.fsf@tethera.net> (raw)
In-Reply-To: <87a699e6wn.fsf@hursts.org.uk>

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.


  reply	other threads:[~2022-07-16 11:14 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 [this message]
2022-07-16 13:23   ` Jon Hurst
2022-07-16 21:30     ` David Bremner
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=87ilnx5mxq.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).