Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 639416DE00C9 for ; Wed, 29 Jun 2016 13:34:38 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.005 X-Spam-Level: X-Spam-Status: No, score=-0.005 tagged_above=-999 required=5 tests=[AWL=-0.006, HEADER_FROM_DIFFERENT_DOMAINS=0.001] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dYtzWPiOuhjI for ; Wed, 29 Jun 2016 13:34:30 -0700 (PDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id 99F566DE00BF for ; Wed, 29 Jun 2016 13:34:30 -0700 (PDT) Received: from remotemail by fethera.tethera.net with local (Exim 4.84) (envelope-from ) id 1bIMBV-0007VG-Tx; Wed, 29 Jun 2016 16:34:09 -0400 Received: (nullmailer pid 2609 invoked by uid 1000); Wed, 29 Jun 2016 20:34:24 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [RFC PATCH] cli/search: interpret no search terms as synonym for '*' Date: Wed, 29 Jun 2016 22:34:06 +0200 Message-Id: <1467232446-2442-1-git-send-email-david@tethera.net> X-Mailer: git-send-email 2.8.1 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jun 2016 20:34:38 -0000 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