path: root/emacs/notmuch.el
diff options
Diffstat (limited to 'emacs/notmuch.el')
1 files changed, 19 insertions, 1 deletions
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 739cb93b..e73ec5f4 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -98,7 +98,21 @@ currently experimental). Note that a line break at the end of an
\"authors\" field will get elided if the authors list is long;
place it instead at the beginning of the following field. To
enter a line break when setting this variable with setq, use \\n.
-To enter a line break in customize, press \\[quoted-insert] C-j."
+To enter a line break in customize, press \\[quoted-insert] C-j.
+It is also possible to specify a formatting function instead of a
+format string, for instance
+ (\"subject\" . downcase)
+or a symbol instead of a field name, in which case the function
+denoted by the symbol is called with the properties of the search
+result. E.g., if we define the function
+ (defun downcase-subject (msg)
+ (downcase (plist-get msg :subject)))
+the spec `(downcase-subject)' will also print a downcased subject."
:type '(alist :key-type (string) :value-type (string))
:group 'notmuch-search)
@@ -831,6 +845,10 @@ non-authors is found, assume that all of the authors match."
(defun notmuch-search-insert-field (field format-string result)
+ ((symbolp field)
+ (apply field result format-string))
+ ((symbolp format-string)
+ (funcall format-string (notmuch-tree-format-field field "%s" result)))
((string-equal field "date")
(insert (propertize (format format-string (plist-get result :date_relative))
'face 'notmuch-search-date)))