unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] Have notmuch count default to showing the total.
@ 2010-04-08 19:39 Mike Kelly
  2010-04-09 13:01 ` Sebastian Spaeth
  2010-04-10  0:48 ` Carl Worth
  0 siblings, 2 replies; 9+ messages in thread
From: Mike Kelly @ 2010-04-08 19:39 UTC (permalink / raw)
  To: notmuch

If no parameters are given to notmuch-count, or just '' or '*' are
given, return the total number of messages in the database.

update notmuch count help
---
 notmuch-count.c |    5 ++---
 notmuch.c       |    4 ++++
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/notmuch-count.c b/notmuch-count.c
index 77aa433..97242ab 100644
--- a/notmuch-count.c
+++ b/notmuch-count.c
@@ -90,9 +90,8 @@ notmuch_count_command (void *ctx, int argc, char *argv[])
 	fprintf (stderr, "Out of memory.\n");
 	return 1;
     }
-    if (*query_str == '\0') {
-	fprintf (stderr, "Error: notmuch count requires at least one count term.\n");
-	return 1;
+    if (*query_str == '\0' || (*query_str == '*' && *(query_str+1) == '\0')) {
+	query_str = talloc_strdup (ctx, "");
     }
 
     query = notmuch_query_create (notmuch, query_str);
diff --git a/notmuch.c b/notmuch.c
index f5669fc..8650951 100644
--- a/notmuch.c
+++ b/notmuch.c
@@ -220,6 +220,10 @@ command_t commands[] = {
       "\tof messages matching both a specific tag and either inbox\n"
       "\tor unread\n"
       "\n"
+      "\tIf no parameters are given, or the special search terms '' or\n"
+      "\t'*' are given, it will display the total number of messages in\n"
+      "\tthe database.\n"
+      "\n"
       "\tSee \"notmuch help search-terms\" for details of the search\n"
       "\t\tterms syntax." },
     { "reply", notmuch_reply_command,
-- 
1.7.0.4

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

* Re: [PATCH] Have notmuch count default to showing the total.
  2010-04-08 19:39 [PATCH] Have notmuch count default to showing the total Mike Kelly
@ 2010-04-09 13:01 ` Sebastian Spaeth
  2010-04-09 17:19   ` Dirk Hohndel
  2010-04-09 19:28   ` Anthony Towns
  2010-04-10  0:48 ` Carl Worth
  1 sibling, 2 replies; 9+ messages in thread
From: Sebastian Spaeth @ 2010-04-09 13:01 UTC (permalink / raw)
  To: Mike Kelly, notmuch

On 2010-04-08, Mike Kelly wrote:
> If no parameters are given to notmuch-count, or just '' or '*' are
> given, return the total number of messages in the database.

I know that cworth was concerned about this syntax on IRC as that would
mean that "notmuch show" would have to spew out all your emails in order
to remain consistent with the search term (he rather wanted to output a
help text if no search term was given).

But let me express support (It's notmuch worth, I know (haha)) for this
patch. I think it makes lots of sense:

1) I often want to know how many mails are in my db. "notmuch count" or
"notmuch count *" is the intuitive syntax I would use for that. Right
now there is no way as far as I can see.

2) Search terms filter out things. The empty search term stands
therefore for all my mails. It is consistent to have the search term ''
represent all my mail.

3) I don't expect a help text for "notmuch count" just as I don't expect
a help text for "notmuch log", we are very explicit about "notmuch help"
and "notmuch help count" in many parts of our documentation.

I'm using this and find it very handy.

Sebastian

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

* Re: [PATCH] Have notmuch count default to showing the total.
  2010-04-09 13:01 ` Sebastian Spaeth
@ 2010-04-09 17:19   ` Dirk Hohndel
  2010-04-09 23:33     ` Carl Worth
  2010-04-09 19:28   ` Anthony Towns
  1 sibling, 1 reply; 9+ messages in thread
From: Dirk Hohndel @ 2010-04-09 17:19 UTC (permalink / raw)
  To: Sebastian Spaeth, Mike Kelly, notmuch

On Fri, 09 Apr 2010 15:01:35 +0200, "Sebastian Spaeth" <Sebastian@SSpaeth.de> wrote:
> On 2010-04-08, Mike Kelly wrote:
> > If no parameters are given to notmuch-count, or just '' or '*' are
> > given, return the total number of messages in the database.
> 
> I know that cworth was concerned about this syntax on IRC as that would
> mean that "notmuch show" would have to spew out all your emails in order
> to remain consistent with the search term (he rather wanted to output a
> help text if no search term was given).
> 
> But let me express support (It's notmuch worth, I know (haha)) for this
> patch. I think it makes lots of sense:
>
> 1) I often want to know how many mails are in my db. "notmuch count" or
> "notmuch count *" is the intuitive syntax I would use for that. Right
> now there is no way as far as I can see.

I use "notmuch count To" - not very intuitive, though.
 
> 2) Search terms filter out things. The empty search term stands
> therefore for all my mails. It is consistent to have the search term ''
> represent all my mail.

Actually, I'd like to disagree. A search argument of '' should get you a
help text. A search argument of '*' should give you all email.
 
> 3) I don't expect a help text for "notmuch count" just as I don't expect
> a help text for "notmuch log", we are very explicit about "notmuch help"
> and "notmuch help count" in many parts of our documentation.

My main concern here is that once you have a gazzillion emails, typing
notmuch search with no argument over a slow link (or using it from
within a gui by mistake) could really cause a lot of unnecessary compute
/ data transfer. So I'd rather have a special character be the one that
triggers that behavior.

/D

-- 
Dirk Hohndel
Intel Open Source Technology Center

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

* Re: [PATCH] Have notmuch count default to showing the total.
  2010-04-09 13:01 ` Sebastian Spaeth
  2010-04-09 17:19   ` Dirk Hohndel
@ 2010-04-09 19:28   ` Anthony Towns
  2010-04-09 19:39     ` Mark Anderson
                       ` (2 more replies)
  1 sibling, 3 replies; 9+ messages in thread
From: Anthony Towns @ 2010-04-09 19:28 UTC (permalink / raw)
  To: notmuch

On Fri, Apr 9, 2010 at 23:01, Sebastian Spaeth <Sebastian@sspaeth.de> wrote:
> On 2010-04-08, Mike Kelly wrote:
>> If no parameters are given to notmuch-count, or just '' or '*' are
>> given, return the total number of messages in the database.
> I know that cworth was concerned about this syntax on IRC as that would
> mean that "notmuch show" would have to spew out all your emails in order
> to remain consistent with the search term (he rather wanted to output a
> help text if no search term was given).

What's wrong with having them inconsistent in this one respect? [0]

$ notmuch count
96632
$ notmuch search
Error: notmuch search requires at least one search term.

...seems pretty logical behaviour to me?

Cheers,
aj

[0] Not much, afaics! [1]
[1] Man, what are the chances that will ever get old? [0]

-- 
Anthony Towns <aj@erisian.com.au>

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

* Re: [PATCH] Have notmuch count default to showing the total.
  2010-04-09 19:28   ` Anthony Towns
@ 2010-04-09 19:39     ` Mark Anderson
  2010-04-09 20:07     ` Jameson Rollins
  2010-04-09 20:19     ` Mike Kelly
  2 siblings, 0 replies; 9+ messages in thread
From: Mark Anderson @ 2010-04-09 19:39 UTC (permalink / raw)
  To: Anthony Towns, notmuch@notmuchmail.org

On Fri, 9 Apr 2010 14:28:32 -0500, Anthony Towns <aj@erisian.com.au> wrote:
> [0] Not much, afaics! [1]
> [1] Man, what are the chances that will ever get old? [0]

Thanks AJ, I like it!

-Mark

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

* Re: [PATCH] Have notmuch count default to showing the total.
  2010-04-09 19:28   ` Anthony Towns
  2010-04-09 19:39     ` Mark Anderson
@ 2010-04-09 20:07     ` Jameson Rollins
  2010-04-09 20:19     ` Mike Kelly
  2 siblings, 0 replies; 9+ messages in thread
From: Jameson Rollins @ 2010-04-09 20:07 UTC (permalink / raw)
  To: Anthony Towns, notmuch

[-- Attachment #1: Type: text/plain, Size: 447 bytes --]

On Sat, 10 Apr 2010 05:28:32 +1000, Anthony Towns <aj@erisian.com.au> wrote:
> What's wrong with having them inconsistent in this one respect? [0]
> 
> $ notmuch count
> 96632
> $ notmuch search
> Error: notmuch search requires at least one search term.

This seems very logical and intuitive behavior in my opinion.  I would
*not* expect them to show help messages in these cases.  "notmuch help
foo" is much more intuitive.

jamie.

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

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

* Re: [PATCH] Have notmuch count default to showing the total.
  2010-04-09 19:28   ` Anthony Towns
  2010-04-09 19:39     ` Mark Anderson
  2010-04-09 20:07     ` Jameson Rollins
@ 2010-04-09 20:19     ` Mike Kelly
  2 siblings, 0 replies; 9+ messages in thread
From: Mike Kelly @ 2010-04-09 20:19 UTC (permalink / raw)
  To: notmuch

On Sat, Apr 10, 2010 at 05:28:32AM +1000, Anthony Towns wrote:
> What's wrong with having them inconsistent in this one respect?
> 
> $ notmuch count
> 96632
> $ notmuch search
> Error: notmuch search requires at least one search term.
> 
> ...seems pretty logical behaviour to me?

My thoughts exactly :)

-- 
Mike Kelly

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

* Re: [PATCH] Have notmuch count default to showing the total.
  2010-04-09 17:19   ` Dirk Hohndel
@ 2010-04-09 23:33     ` Carl Worth
  0 siblings, 0 replies; 9+ messages in thread
From: Carl Worth @ 2010-04-09 23:33 UTC (permalink / raw)
  To: Dirk Hohndel, Sebastian Spaeth, Mike Kelly, notmuch

[-- Attachment #1: Type: text/plain, Size: 655 bytes --]

On Fri, 09 Apr 2010 10:19:47 -0700, Dirk Hohndel <hohndel@infradead.org> wrote:
> On Fri, 09 Apr 2010 15:01:35 +0200, "Sebastian Spaeth" <Sebastian@SSpaeth.de> wrote:

> > 1) I often want to know how many mails are in my db. "notmuch count" or
> > "notmuch count *" is the intuitive syntax I would use for that. Right
> > now there is no way as far as I can see.
> 
> I use "notmuch count To" - not very intuitive, though.

Unfortunately, this doesn't give the desired result.

Think Shakespearean and you can get an accurate count though:

      notmuch count to be or not to be

-Carl

OK, we need a simpler search syntax than that...

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [PATCH] Have notmuch count default to showing the total.
  2010-04-08 19:39 [PATCH] Have notmuch count default to showing the total Mike Kelly
  2010-04-09 13:01 ` Sebastian Spaeth
@ 2010-04-10  0:48 ` Carl Worth
  1 sibling, 0 replies; 9+ messages in thread
From: Carl Worth @ 2010-04-10  0:48 UTC (permalink / raw)
  To: Mike Kelly, notmuch

[-- Attachment #1: Type: text/plain, Size: 507 bytes --]

On Thu,  8 Apr 2010 15:39:38 -0400, Mike Kelly <pioto@pioto.org> wrote:
> If no parameters are given to notmuch-count, or just '' or '*' are
> given, return the total number of messages in the database.

How much syntax should count require to print all messages? [*]

I've pushed this out now, along with some followups to provide support
for all commands to accept "*" as a special case that matches all
messages.

Thanks,

-Carl

[*] id:h2x87b3a4191004091228nae33f127le9754973709de659@mail.gmail.com [0]

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

end of thread, other threads:[~2010-04-10  0:48 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-08 19:39 [PATCH] Have notmuch count default to showing the total Mike Kelly
2010-04-09 13:01 ` Sebastian Spaeth
2010-04-09 17:19   ` Dirk Hohndel
2010-04-09 23:33     ` Carl Worth
2010-04-09 19:28   ` Anthony Towns
2010-04-09 19:39     ` Mark Anderson
2010-04-09 20:07     ` Jameson Rollins
2010-04-09 20:19     ` Mike Kelly
2010-04-10  0:48 ` Carl Worth

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).