This removes the last bit of direct output from the parsing function.
With the parser now responsible solely for parsing, we can swap it out
for another parser.
---
 emacs/notmuch.el |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 4a6490a..a073367 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -745,6 +745,13 @@ non-authors is found, assume that all of the authors 
match."
        (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")))
+
 (defun notmuch-search-process-filter (proc string)
   "Process and filter the output of \"notmuch search\""
   (let ((buffer (process-buffer proc)))
@@ -767,7 +774,8 @@ non-authors is found, assume that all of the authors match."
                           (tags (match-string 6 string))
                           (tag-list (if tags (save-match-data (split-string 
tags)))))
                      (if (/= (match-beginning 1) line)
-                         (insert (concat "Error: Unexpected output from 
notmuch search:\n" (substring string line (match-beginning 1)) "\n")))
+                         (notmuch-search-show-error
+                          (substring string line (match-beginning 1))))
                      (notmuch-search-show-result thread-id date count authors 
subject tag-list)
                      (set 'line (match-end 0)))
                  (set 'more nil)
-- 
1.7.10

Reply via email to