From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Subject: [PATCH 2/6] doc/emacs: add docstring and example for n-search-result-format
Date: Sat, 16 Jul 2022 17:22:24 -0400 [thread overview]
Message-ID: <20220716212228.56432-3-david@tethera.net> (raw)
In-Reply-To: <20220716212228.56432-1-david@tethera.net>
When the ability to use functions was added, this example was confined
to a commit message, which is not user discoverable.
---
doc/notmuch-emacs.rst | 34 ++++++++++++++++++++++++++++++++--
1 file changed, 32 insertions(+), 2 deletions(-)
diff --git a/doc/notmuch-emacs.rst b/doc/notmuch-emacs.rst
index 189a51ad..49111d28 100644
--- a/doc/notmuch-emacs.rst
+++ b/doc/notmuch-emacs.rst
@@ -220,8 +220,38 @@ variables.
.. emacsvar:: notmuch-search-result-format
- Control how each thread of messages is presented in the
- ``notmuch-show-mode`` buffer
+ |docstring::notmuch-search-result-format|
+
+ 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 the following settings, the first
+ few characters on each line of the search result are used to show
+ information about some significant tags associated with the thread.
+
+ .. code:: lisp
+
+ (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)")))
.. emacsvar:: notmuch-search-oldest-first
--
2.35.1
next prev parent reply other threads:[~2022-07-16 21:23 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 ` David Bremner [this message]
2022-07-16 21:22 ` [PATCH 3/6] " David Bremner
2022-07-16 21:22 ` [PATCH 4/6] doc/emacs: add docstring and example for n-tree-result-format David Bremner
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-3-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).