"[No Subject]"
subject)))
+(defun notmuch-sanitize (str)
+ "Sanitize control character in STR.
+
+This includes newlines, tabs, and other funny characters."
+ (replace-regexp-in-string "[[:cntrl:]\x7f\u2028\u2029]+" " " str))
+
(defun notmuch-escape-boolean-term (term)
"Escape a boolean term for use in a query.
message at DEPTH in the current thread."
(let ((start (point)))
(insert (notmuch-show-spaces-n (* notmuch-show-indent-messages-width depth))
- (notmuch-show-clean-address (plist-get headers :From))
+ (notmuch-sanitize
+ (notmuch-show-clean-address (plist-get headers :From)))
" ("
date
") ("
(defun notmuch-show-insert-header (header header-value)
"Insert a single header."
- (insert header ": " header-value "\n"))
+ (insert header ": " (notmuch-sanitize header-value) "\n"))
(defun notmuch-show-insert-headers (headers)
"Insert the headers of the current message."
(jit-lock-register #'notmuch-show-buttonise-links)
;; Set the header line to the subject of the first message.
- (setq header-line-format (notmuch-show-strip-re (notmuch-show-get-subject)))
+ (setq header-line-format (notmuch-sanitize (notmuch-show-strip-re (notmuch-show-get-subject))))
(run-hooks 'notmuch-show-hook))))
(plist-get result :total)))
'face 'notmuch-search-count)))
((string-equal field "subject")
- (insert (propertize (format format-string (plist-get result :subject))
+ (insert (propertize (format format-string
+ (notmuch-sanitize (plist-get result :subject)))
'face 'notmuch-search-subject)))
((string-equal field "authors")
- (notmuch-search-insert-authors format-string (plist-get result :authors)))
+ (notmuch-search-insert-authors
+ format-string (notmuch-sanitize (plist-get result :authors))))
((string-equal field "tags")
(let ((tags (plist-get result :tags)))