* [PATCH v1] (notmuch-show "id:doesnotexist") should not throw an error. @ 2016-02-06 18:21 David Edmondson 2016-02-06 18:21 ` [PATCH v1] emacs: Report a lack of matches when calling `notmuch-show' David Edmondson 2016-02-06 21:56 ` [PATCH v1] (notmuch-show "id:doesnotexist") should not throw an error Tomi Ollila 0 siblings, 2 replies; 6+ messages in thread From: David Edmondson @ 2016-02-06 18:21 UTC (permalink / raw) To: notmuch (notmuch-show "id:doesnotexist") should not throw an error. This is a followup to id:"874nw0ltwz.fsf@praet.org" and id:"cuntx91fwaa.fsf@hotblack-desiato.hh.sledj.net". The originally proposed change (to have id: links call `notmuch-show' rather than `notmuch-search') was already made, but the difficulties with links that generated no results was not addressed. This patch aims to do that. David Edmondson (1): emacs: Report a lack of matches when calling `notmuch-show'. emacs/notmuch-show.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) -- 2.1.4 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v1] emacs: Report a lack of matches when calling `notmuch-show'. 2016-02-06 18:21 [PATCH v1] (notmuch-show "id:doesnotexist") should not throw an error David Edmondson @ 2016-02-06 18:21 ` David Edmondson 2016-02-07 23:09 ` Mark Walters 2016-02-06 21:56 ` [PATCH v1] (notmuch-show "id:doesnotexist") should not throw an error Tomi Ollila 1 sibling, 1 reply; 6+ messages in thread From: David Edmondson @ 2016-02-06 18:21 UTC (permalink / raw) To: notmuch 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 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v1] emacs: Report a lack of matches when calling `notmuch-show'. 2016-02-06 18:21 ` [PATCH v1] emacs: Report a lack of matches when calling `notmuch-show' David Edmondson @ 2016-02-07 23:09 ` Mark Walters 2016-02-08 6:44 ` Tomi Ollila 2016-02-08 11:28 ` David Edmondson 0 siblings, 2 replies; 6+ messages in thread From: Mark Walters @ 2016-02-07 23:09 UTC (permalink / raw) To: David Edmondson, notmuch On Sat, 06 Feb 2016, David Edmondson <dme@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@notmuchmail.org > https://notmuchmail.org/mailman/listinfo/notmuch ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1] emacs: Report a lack of matches when calling `notmuch-show'. 2016-02-07 23:09 ` Mark Walters @ 2016-02-08 6:44 ` Tomi Ollila 2016-02-08 11:28 ` David Edmondson 1 sibling, 0 replies; 6+ messages in thread From: Tomi Ollila @ 2016-02-08 6:44 UTC (permalink / raw) To: Mark Walters, David Edmondson, notmuch On Mon, Feb 08 2016, Mark Walters <markwalters1009@gmail.com> wrote: > On Sat, 06 Feb 2016, David Edmondson <dme@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). Actually I got the same when testing (notmuch-show "id:nonexistent") M-x eval-print-last-sexp instead of M-x eval-last-sexp (C-j in lisp-interaction buffer, instead of c-x c-e) ... I agree that if we handle the situation, perhaps throwing an error is not the best way... > [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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1] emacs: Report a lack of matches when calling `notmuch-show'. 2016-02-07 23:09 ` Mark Walters 2016-02-08 6:44 ` Tomi Ollila @ 2016-02-08 11:28 ` David Edmondson 1 sibling, 0 replies; 6+ messages in thread From: David Edmondson @ 2016-02-08 11:28 UTC (permalink / raw) To: Mark Walters, notmuch On Sun, Feb 07 2016, Mark Walters wrote: > 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). How about (ding) (message "...") ? ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1] (notmuch-show "id:doesnotexist") should not throw an error. 2016-02-06 18:21 [PATCH v1] (notmuch-show "id:doesnotexist") should not throw an error David Edmondson 2016-02-06 18:21 ` [PATCH v1] emacs: Report a lack of matches when calling `notmuch-show' David Edmondson @ 2016-02-06 21:56 ` Tomi Ollila 1 sibling, 0 replies; 6+ messages in thread From: Tomi Ollila @ 2016-02-06 21:56 UTC (permalink / raw) To: David Edmondson, notmuch On Sat, Feb 06 2016, David Edmondson <dme@dme.org> wrote: > (notmuch-show "id:doesnotexist") should not throw an error. Great! this works ^^^^^^^^^^^^^ Tomi > > This is a followup to id:"874nw0ltwz.fsf@praet.org" and > id:"cuntx91fwaa.fsf@hotblack-desiato.hh.sledj.net". > > The originally proposed change (to have id: links call `notmuch-show' > rather than `notmuch-search') was already made, but the difficulties > with links that generated no results was not addressed. This patch > aims to do that. > > > David Edmondson (1): > emacs: Report a lack of matches when calling `notmuch-show'. > > emacs/notmuch-show.el | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > -- > 2.1.4 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > https://notmuchmail.org/mailman/listinfo/notmuch ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-02-08 11:28 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-02-06 18:21 [PATCH v1] (notmuch-show "id:doesnotexist") should not throw an error David Edmondson 2016-02-06 18:21 ` [PATCH v1] emacs: Report a lack of matches when calling `notmuch-show' David Edmondson 2016-02-07 23:09 ` Mark Walters 2016-02-08 6:44 ` Tomi Ollila 2016-02-08 11:28 ` David Edmondson 2016-02-06 21:56 ` [PATCH v1] (notmuch-show "id:doesnotexist") should not throw an error Tomi Ollila
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).