mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-21 18:38:08 +01:00
doc/emacs: add docstring and example for n-search-result-format
When the ability to use functions was added, this example was confined to a commit message, which is not user discoverable.
This commit is contained in:
parent
4237409faf
commit
2b10a56c78
1 changed files with 32 additions and 2 deletions
|
@ -220,8 +220,38 @@ variables.
|
||||||
|
|
||||||
.. emacsvar:: notmuch-search-result-format
|
.. emacsvar:: notmuch-search-result-format
|
||||||
|
|
||||||
Control how each thread of messages is presented in the
|
|docstring::notmuch-search-result-format|
|
||||||
``notmuch-show-mode`` buffer
|
|
||||||
|
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
|
.. emacsvar:: notmuch-search-oldest-first
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue