emacs: update defcustom for notmuch-search-result-format.

It seems redundant to have the previous example, since the default
value is always show by describe variable.

Enforce more restrictions on the keys in the alist, since arbitrary
strings don't work as field names.

Document that functions can be used in lieu of field names.
This commit is contained in:
David Bremner 2022-07-16 17:22:25 -04:00
parent 2b10a56c78
commit 25ebb9e7d3

View file

@ -97,6 +97,15 @@ different kind of arrow point."
:type '(alist :key-type symbol :value-type string)
:group 'notmuch-tree)
(defconst notmuch-tree--field-names
'(choice :tag "Field"
(const :tag "Date" "date")
(const :tag "Authors" "authors")
(const :tag "Subject" "subject")
(const :tag "Tree" "tree")
(const :tag "Tags" "tags")
(function)))
(defcustom notmuch-tree-result-format
`(("date" . "%12s ")
("authors" . "%-20s")
@ -106,7 +115,11 @@ different kind of arrow point."
("tags" . "(%s)"))
"Result formatting for tree view.
Supported fields are: date, authors, subject, tree, tags.
List of pairs of (field . format-string). Supported field
strings are: \"date\", \"authors\", \"subject\", \"tree\",
\"tags\". It is also supported to pass a function in place of a
field-name. In this case the function is passed the thread
object (plist) and format string.
Tree means the thread tree box graphics. The field may
also be a list in which case the formatting rules are
@ -114,14 +127,12 @@ applied recursively and then the output of all the fields
in the list is inserted according to format-string.
Note that the author string should not contain whitespace
\(put it in the neighbouring fields instead). For example:
(setq notmuch-tree-result-format
'((\"authors\" . \"%-40s\")
(\"subject\" . \"%s\")))"
:type '(alist :key-type (choice string
(alist :key-type string
:value-type string))
:value-type string)
\(put it in the neighbouring fields instead)."
:type `(alist :key-type (choice ,notmuch-tree--field-names
(alist :key-type ,notmuch-tree--field-names
:value-type (string :tag "Format")))
:value-type (string :tag "Format"))
:group 'notmuch-tree)
(defcustom notmuch-unthreaded-result-format