unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* strange search behaviour in emacs
@ 2015-03-24  4:47 Sebastian Fischmeister
  2015-03-24 19:25 ` David Bremner
  0 siblings, 1 reply; 4+ messages in thread
From: Sebastian Fischmeister @ 2015-03-24  4:47 UTC (permalink / raw)
  To: notmuch

Hi,

I have some strange behaviour when performing searches on notmuch in
emacs. The following works just fine:

M-: (notmuch-search "from:foo") ;;not me
M-: (notmuch-search "bar")

The following *always* returns an empty list, even when I see an email
with "bar" right there in the list after the first search:

M-: (notmuch-search "from:sfischme") ;;me
M-: (notmuch-search "bar")

It appears to only occur when the "from:XY" search was for what I have
set in my notmuch config for the primary_email address.

I have no clue why this is happening. Any ideas? Especially, any ideas
how to fix it? I'm using notmuch 0.19 (package 0.19-2 on archlinux).

Thanks,
  Sebastian

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: strange search behaviour in emacs
  2015-03-24  4:47 strange search behaviour in emacs Sebastian Fischmeister
@ 2015-03-24 19:25 ` David Bremner
  2015-03-25  1:35   ` Sebastian Fischmeister
  0 siblings, 1 reply; 4+ messages in thread
From: David Bremner @ 2015-03-24 19:25 UTC (permalink / raw)
  To: sfischme, notmuch

Sebastian Fischmeister <sfischme@uwaterloo.ca> writes:

> The following *always* returns an empty list, even when I see an email
> with "bar" right there in the list after the first search:
>
> M-: (notmuch-search "from:sfischme") ;;me
> M-: (notmuch-search "bar")

I suspect this is related to asynch loading. The first query is still
filling into the buffer, and emacs doesn't starting filling the second
buffer until the first search finishes. In my experiments it
_eventually_ does the second query. It just takes a while. I agree it
would be nice if there was some UI hint before the first result arrives.

d

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: strange search behaviour in emacs
  2015-03-24 19:25 ` David Bremner
@ 2015-03-25  1:35   ` Sebastian Fischmeister
  2015-03-28 10:30     ` [PATCH] emacs: print messages when starting and ending notmuch queries David Bremner
  0 siblings, 1 reply; 4+ messages in thread
From: Sebastian Fischmeister @ 2015-03-25  1:35 UTC (permalink / raw)
  To: David Bremner, notmuch

> I suspect this is related to asynch loading. The first query is still
> filling into the buffer, and emacs doesn't starting filling the second
> buffer until the first search finishes. In my experiments it
> _eventually_ does the second query.

You are correct. I confirm that the second query eventually gets
executed. 

> It just takes a while. I agree it would be nice if there was some UI
> hint before the first result arrives.

Yes, a simple update in the statusbar for the mode name would be a
possible approach.

  Sebastian

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] emacs: print messages when starting and ending notmuch queries
  2015-03-25  1:35   ` Sebastian Fischmeister
@ 2015-03-28 10:30     ` David Bremner
  0 siblings, 0 replies; 4+ messages in thread
From: David Bremner @ 2015-03-28 10:30 UTC (permalink / raw)
  To: Sebastian Fischmeister, David Bremner, notmuch

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-03-28 10:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-24  4:47 strange search behaviour in emacs Sebastian Fischmeister
2015-03-24 19:25 ` David Bremner
2015-03-25  1:35   ` Sebastian Fischmeister
2015-03-28 10:30     ` [PATCH] emacs: print messages when starting and ending notmuch queries David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).