[PATCH] emacs: print messages when starting and ending notmuch queries

David Bremner david at tethera.net
Sat Mar 28 03:30:17 PDT 2015


For slow queries, it is possible for a second query to block while the
first is still running.  This has the unfortunate effect that it is
impossible for the user to know if the query returned no results, or
if it is still running.  This change tries to remedy this by printing
messages in the echo area when starting and finishing queries.
---

I'm curious what people think about this possible change. It does make
the whole UI a bit noisier for fast queries.  OTOH, it seems simpler than trying to mess with the results buffer or mode line.

 emacs/notmuch.el | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index ab00454..cb8ddef 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -616,6 +616,7 @@ of the result."
   (let ((buffer (process-buffer proc))
 	(status (process-status proc))
 	(exit-status (process-exit-status proc))
+	(query (process-get proc 'query))
 	(never-found-target-thread nil))
     (when (memq status '(exit signal))
       (catch 'return
@@ -629,6 +630,7 @@ of the result."
 		  (if (eq status 'signal)
 		      (insert "Incomplete search results (search process was killed).\n"))
 		  (when (eq status 'exit)
+		    (message "notmuch query %s complete" query)
 		    (insert "End of search results.\n")
 		    ;; For version mismatch, there's no point in
 		    ;; showing the search buffer
@@ -931,6 +933,7 @@ the configured default sort order."
 	  (error "notmuch search process already running for query `%s'" query)
 	)
       (erase-buffer)
+      (message "running notmuch query %s..." query)
       (goto-char (point-min))
       (save-excursion
 	(let ((proc (notmuch-start-notmuch
@@ -945,6 +948,7 @@ the configured default sort order."
 	      ;; should be called no matter how the process dies.
 	      (parse-buf (generate-new-buffer " *notmuch search parse*")))
 	  (process-put proc 'parse-buf parse-buf)
+	  (process-put proc 'query query)
 	  (set-process-filter proc 'notmuch-search-process-filter)
 	  (set-process-query-on-exit-flag proc nil))))
     (run-hooks 'notmuch-search-hook)))
-- 
2.1.4



More information about the notmuch mailing list