[PATCH v1] emacs: Report a lack of matches when calling `notmuch-show'.
David Edmondson
dme at dme.org
Sat Feb 6 10:21:32 PST 2016
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.
---
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
More information about the notmuch
mailing list