[PATCH v1] emacs: Report a lack of matches when calling `notmuch-show'.

Mark Walters markwalters1009 at gmail.com
Sun Feb 7 15:09:12 PST 2016


On Sat, 06 Feb 2016, David Edmondson <dme at dme.org> wrote:
> If the basic query passed to `notmuch-show' generates no results,
> throw an error and inform the user that no messages matched the query
> rather than displaying an empty buffer and showing an obscure error.

Hi

First this is a clear improvement on the current behaviour, an I am
happy with it as is.

However, I wonder if we actually want an error at all in this case,
rather than just a "message". I think some people run with
debug-on-error enabled and it might be annoying in that case (though
clearly less annoying than the current situation).

[If anyone cares the current error comes from the marking read code in
the post-command hook which assumes the buffer has a message]

Best wishes

Mark


> ---
>  emacs/notmuch-show.el | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 3345878..335992e 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -1248,7 +1248,13 @@ function is used."
>  	(when (and (eq (buffer-size) 0)
>  		   notmuch-show-query-context)
>  	  (notmuch-show-insert-forest
> -	   (notmuch-query-get-threads (append cli-args basic-args)))))
> +	   (notmuch-query-get-threads (append cli-args basic-args))))
> +
> +	;; If there are still no results, kill the buffer and throw an
> +	;; error.
> +	(when (eq (buffer-size) 0)
> +	  (kill-buffer (current-buffer))
> +	  (error "No messages matched the query.")))
>  
>        (jit-lock-register #'notmuch-show-buttonise-links)
>  
> -- 
> 2.1.4
>
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch


More information about the notmuch mailing list