From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Subject: [PATCH 4/6] doc/emacs: add docstring and example for n-tree-result-format
Date: Sat, 16 Jul 2022 17:22:26 -0400 [thread overview]
Message-ID: <20220716212228.56432-5-david@tethera.net> (raw)
In-Reply-To: <20220716212228.56432-1-david@tethera.net>
This example is based on one originally by Jon Hurst.
---
doc/notmuch-emacs.rst | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/doc/notmuch-emacs.rst b/doc/notmuch-emacs.rst
index 49111d28..44dca384 100644
--- a/doc/notmuch-emacs.rst
+++ b/doc/notmuch-emacs.rst
@@ -253,6 +253,8 @@ variables.
("subject" . "%s ")
("tags" . "(%s)")))
+ See also :emacsvar:`notmuch-tree-result-format`.
+
.. emacsvar:: notmuch-search-oldest-first
Display the oldest threads at the top of the buffer
@@ -475,6 +477,39 @@ tags.
As is the case with :ref:`notmuch-search`, the presentation of results
can be controlled by the variable ``notmuch-search-oldest-first``.
+.. emacsvar:: notmuch-tree-result-format
+
+ |docstring::notmuch-tree-result-format|
+
+ The following example shows how to optionally display recipients instead
+ of authors for sent mail (assuming the user is named Mustermann).
+
+ .. code:: lisp
+
+ (defun -notmuch-authors-or-to (format-string result)
+ (let* ((headers (plist-get result :headers))
+ (to (plist-get headers :To))
+ (author (plist-get headers :From))
+ (face (if (plist-get result :match)
+ 'notmuch-tree-match-author-face
+ 'notmuch-tree-no-match-author-face)))
+ (propertize
+ (format format-string
+ (if (string-match "Mustermann" author)
+ (concat "To:" (notmuch-tree-clean-address to))
+ author))
+ 'face face)))
+
+ (setq notmuch-tree-result-format
+ '(("date" . "%12s ")
+ (-notmuch-authors-or-to . "%-20.20s")
+ ((("tree" . "%s")
+ ("subject" . "%s"))
+ . " %-54s ")
+ ("tags" . "(%s)")))
+
+ See also :emacsvar:`notmuch-search-result-format`.
+
.. _notmuch-unthreaded:
notmuch-unthreaded
--
2.35.1
next prev parent reply other threads:[~2022-07-16 21:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-16 21:22 update documentation for notmuch-*-result-format David Bremner
2022-07-16 21:22 ` [PATCH 1/6] emacs: update defcustom for notmuch-search-result-format David Bremner
2022-07-16 21:22 ` [PATCH 2/6] doc/emacs: add docstring and example for n-search-result-format David Bremner
2022-07-16 21:22 ` [PATCH 3/6] emacs: update defcustom for notmuch-search-result-format David Bremner
2022-07-16 21:22 ` David Bremner [this message]
2022-07-16 21:22 ` [PATCH 5/6] emacs: update defcustom for notmuch-unthreaded-result-format David Bremner
2022-07-16 21:22 ` [PATCH 6/6] doc/emacs: add docstring " David Bremner
2022-07-30 12:15 ` David Bremner
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=20220716212228.56432-5-david@tethera.net \
--to=david@tethera.net \
--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).