[PATCH v2 10/11] emacs: notmuch-search: add display thread sizes capability

Ioan-Adrian Ratiu adi at adirat.com
Thu May 18 15:27:07 PDT 2017

By default this is off because it's tiresome to look at all those
numbers in every search view. It's much more pleasant to have it
enabled by default in notmuch-show even if you apply searches and sort
results based on file size.

Signed-off-by: Ioan-Adrian Ratiu <adi at adirat.com>
 emacs/notmuch.el | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 5b9c1d07..dbcd67eb 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -73,7 +73,7 @@
     ("subject" . "%s ")
     ("tags" . "(%s)"))
   "Search result formatting. Supported fields are:
-	date, count, authors, subject, tags
+	date, count, total_filesize, authors, subject, tags
 For example:
 	(setq notmuch-search-result-format \(\(\"authors\" . \"%-40s\"\)
 					     \(\"subject\" . \"%s\"\)\)\)
@@ -262,6 +262,12 @@ there will be called at other points of notmuch execution."
  :group 'notmuch-show
  :group 'notmuch-faces)
+(defface notmuch-search-thread-total-filesize
+  '((t :inherit default))
+  "Face used in search mode for total thread filesizes."
+  :group 'notmuch-search
+  :group 'notmuch-faces)
 (defface notmuch-search-date
   '((t :inherit default))
   "Face used in search mode for dates."
@@ -801,6 +807,9 @@ non-authors is found, assume that all of the authors match."
 (defun notmuch-search-insert-field (field format-string result)
+   ((string-equal field "total-filesize")
+    (insert (propertize (format format-string (file-size-human-readable (plist-get result :total_filesize)))
+			'face 'notmuch-search-thread-total-filesize)))
    ((string-equal field "date")
     (insert (propertize (format format-string (plist-get result :date_relative))
 			'face 'notmuch-search-date)))

More information about the notmuch mailing list