- (insert (concat "(" (propertize tags 'font-lock-face 'notmuch-tag-face) ")")))))
-
-(defun notmuch-search-show-result (date count authors subject tags)
- (dolist (spec notmuch-search-result-format)
- (notmuch-search-insert-field (car spec) (cdr spec)
- date count authors subject tags))
- (insert "\n"))
+ (insert (concat "(" (propertize
+ (mapconcat 'identity (plist-get result :tags) " ")
+ 'font-lock-face 'notmuch-tag-face) ")")))))
+
+(defun notmuch-search-show-result (result)
+ ;; Ignore excluded matches
+ (unless (= (plist-get result :matched) 0)
+ (let ((beg (point-max)))
+ (save-excursion
+ (goto-char beg)
+ (dolist (spec notmuch-search-result-format)
+ (notmuch-search-insert-field (car spec) (cdr spec) result))
+ (insert "\n")
+ (notmuch-search-color-line beg (point) (plist-get result :tags))
+ (put-text-property beg (point) 'notmuch-search-thread-id
+ (concat "thread:" (plist-get result :thread)))
+ (put-text-property beg (point) 'notmuch-search-authors
+ (plist-get result :authors))
+ (put-text-property beg (point) 'notmuch-search-subject
+ (plist-get result :subject)))
+ (when (string= (plist-get result :thread) notmuch-search-target-thread)
+ (setq notmuch-search-target-thread "found")
+ (goto-char beg)))))
+
+(defun notmuch-search-show-error (string &rest objects)
+ (save-excursion
+ (goto-char (point-max))
+ (insert "Error: Unexpected output from notmuch search:\n")
+ (insert (apply #'format string objects))
+ (insert "\n")))