]> git.notmuchmail.org Git - notmuch/commitdiff
emacs: Helper for reporting search parsing errors
authorAustin Clements <amdragon@MIT.EDU>
Mon, 9 Jul 2012 21:42:36 +0000 (17:42 -0400)
committerDavid Bremner <bremner@debian.org>
Thu, 12 Jul 2012 23:38:54 +0000 (17:38 -0600)
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

index 746d0cb9de7750bd654aeac4996598c6cc4140f0..f952fa8e97ea0950a740c6f383466e9a7c6c149d 100644 (file)
@@ -741,6 +741,11 @@ non-authors is found, assume that all of the authors match."
       (put-text-property beg (point) 'notmuch-search-authors authors)
       (put-text-property beg (point) 'notmuch-search-subject subject))))
 
       (put-text-property beg (point) 'notmuch-search-authors authors)
       (put-text-property beg (point) 'notmuch-search-subject subject))))
 
+(defun notmuch-search-show-error (string &rest objects)
+  (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))
 (defun notmuch-search-process-filter (proc string)
   "Process and filter the output of \"notmuch search\""
   (let ((buffer (process-buffer proc))
@@ -766,7 +771,8 @@ non-authors is found, assume that all of the authors match."
                           (tag-list (if tags (save-match-data (split-string tags)))))
                      (goto-char (point-max))
                      (if (/= (match-beginning 1) line)
                           (tag-list (if tags (save-match-data (split-string tags)))))
                      (goto-char (point-max))
                      (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))))
                      (when (string= thread-id notmuch-search-target-thread)
                        (set 'found-target (point))
                        (set 'notmuch-search-target-thread "found"))
                      (when (string= thread-id notmuch-search-target-thread)
                        (set 'found-target (point))
                        (set 'notmuch-search-target-thread "found"))