unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [RFC PATCH] cli/search: interpret no search terms as synonym for '*'
@ 2016-06-29 20:34 David Bremner
  2017-03-12 13:07 ` David Bremner
  0 siblings, 1 reply; 2+ messages in thread
From: David Bremner @ 2016-06-29 20:34 UTC (permalink / raw)
  To: notmuch

This is a bit less typing (and escaping), especially for the
--output=tags case.
---

I started merrily on other commands, but I'm not so sure. For example
"git annex metadata" has the feature of interpreting missing file name
as all files and I find it super irritating in general because I keep
adding tags to all files. Hence RFC.

 notmuch-search.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/notmuch-search.c b/notmuch-search.c
index 8c65d5a..a7e397c 100644
--- a/notmuch-search.c
+++ b/notmuch-search.c
@@ -625,7 +625,8 @@ do_search_tags (const search_context_t *ctx)
      * specified? */
 
     /* Special-case query of "*" for better performance. */
-    if (strcmp (notmuch_query_get_query_string (query), "*") == 0) {
+    if (strcmp (notmuch_query_get_query_string (query), "*") == 0 ||
+	strlen (notmuch_query_get_query_string (query)) == 0) {
 	tags = notmuch_database_get_all_tags (notmuch);
     } else {
 	notmuch_status_t status;
@@ -711,10 +712,6 @@ _notmuch_search_prepare (search_context_t *ctx, notmuch_config_t *config, int ar
 	fprintf (stderr, "Out of memory.\n");
 	return EXIT_FAILURE;
     }
-    if (*query_str == '\0') {
-	fprintf (stderr, "Error: notmuch search requires at least one search term.\n");
-	return EXIT_FAILURE;
-    }
 
     ctx->query = notmuch_query_create (ctx->notmuch, query_str);
     if (ctx->query == NULL) {
-- 
2.8.1

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

* Re: [RFC PATCH] cli/search: interpret no search terms as synonym for '*'
  2016-06-29 20:34 [RFC PATCH] cli/search: interpret no search terms as synonym for '*' David Bremner
@ 2017-03-12 13:07 ` David Bremner
  0 siblings, 0 replies; 2+ messages in thread
From: David Bremner @ 2017-03-12 13:07 UTC (permalink / raw)
  To: notmuch

David Bremner <david@tethera.net> writes:

> This is a bit less typing (and escaping), especially for the
> --output=tags case.
> ---
>
> I started merrily on other commands, but I'm not so sure. For example
> "git annex metadata" has the feature of interpreting missing file name
> as all files and I find it super irritating in general because I keep
> adding tags to all files. Hence RFC.

Since I didn't receive any feedback, I'm going to drop plans to add this
feature for now.

d

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

end of thread, other threads:[~2017-03-12 13:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-29 20:34 [RFC PATCH] cli/search: interpret no search terms as synonym for '*' David Bremner
2017-03-12 13:07 ` 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).