aboutsummaryrefslogtreecommitdiffhomepage
path: root/emacs
diff options
context:
space:
mode:
authorGravatar Austin Clements <amdragon@MIT.EDU>2013-05-31 20:40:07 -0400
committerGravatar David Bremner <bremner@debian.org>2013-06-01 09:00:40 -0300
commit89efd5717ab26cf626ceb67964b9b4af8820e52c (patch)
tree834b8be79250fe7001254014ebdf4eb82a7c0e63 /emacs
parentb89ffba3012603d3eb9b1e144bf0a81480588ea3 (diff)
emacs: Use streaming S-expr parser for search
In addition to being the Right Thing to do, this noticeably improves the time taken to display the first page of search results, since it's roughly an order of magnitude faster than the JSON parser. Interestingly, it does *not* significantly improve the time to completely fill a large search buffer because for large search buffers, the cost of creating author invisibility overlays and inserting text (which slows down with more overlays) dominates. However, the time required to display the first page of results is generally more important to the user experience.
Diffstat (limited to 'emacs')
-rw-r--r--emacs/notmuch.el13
1 files changed, 3 insertions, 10 deletions
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index b8d9c444..5a8c9570 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -58,6 +58,7 @@
(require 'notmuch-hello)
(require 'notmuch-maildir-fcc)
(require 'notmuch-message)
+(require 'notmuch-parser)
(defcustom notmuch-search-result-format
`(("date" . "%12s ")
@@ -809,13 +810,6 @@ 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 ((results-buf (process-buffer proc))
@@ -829,8 +823,7 @@ non-authors is found, assume that all of the authors match."
(save-excursion
(goto-char (point-max))
(insert string))
- (notmuch-json-parse-partial-list 'notmuch-search-show-result
- 'notmuch-search-show-error
+ (notmuch-sexp-parse-partial-list 'notmuch-search-show-result
results-buf)))))
(defun notmuch-search-tag-all (&optional tag-changes)
@@ -933,7 +926,7 @@ Other optional parameters are used as follows:
(save-excursion
(let ((proc (notmuch-start-notmuch
"notmuch-search" buffer #'notmuch-search-process-sentinel
- "search" "--format=json" "--format-version=1"
+ "search" "--format=sexp" "--format-version=1"
(if oldest-first
"--sort=oldest-first"
"--sort=newest-first")