emacs: Prefer '[No Subject]' to blank subjects.
[notmuch] / emacs / notmuch-lib.el
index c906ca76eda2f9e21e9b423e05debf6c53f7ba01..d315f7656e9bc4a004575faa14be386a858cdb83 100644 (file)
@@ -133,6 +133,15 @@ the user hasn't set this variable with the old or new value."
   (interactive)
   (kill-buffer (current-buffer)))
 
+(defun notmuch-prettify-subject (subject)
+  ;; This function is used by `notmuch-search-process-filter' which
+  ;; requires that we not disrupt its' matching state.
+  (save-match-data
+    (if (and subject
+            (string-match "^[ \t]*$" subject))
+       "[No Subject]"
+      subject)))
+
 ;;
 
 (defun notmuch-common-do-stash (text)