From: Tomi Ollila Date: Mon, 3 Nov 2014 09:44:16 +0000 (+0200) Subject: Re: [PATCH v6 6/7] cli: search: Add --output=count X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1c4960d7c2618c707cb8d152afe43b6afa266467;p=notmuch-archives.git Re: [PATCH v6 6/7] cli: search: Add --output=count --- diff --git a/32/d570e7f7dd54f918aebf400a61e6ae3b24fbd1 b/32/d570e7f7dd54f918aebf400a61e6ae3b24fbd1 new file mode 100644 index 000000000..7cf54d0f5 --- /dev/null +++ b/32/d570e7f7dd54f918aebf400a61e6ae3b24fbd1 @@ -0,0 +1,182 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 165AB429E26 + for ; Mon, 3 Nov 2014 01:44:54 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id 8qVqfRLDh-dj for ; + Mon, 3 Nov 2014 01:44:46 -0800 (PST) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id CBB50431FAE + for ; Mon, 3 Nov 2014 01:44:45 -0800 (PST) +Received: from guru.guru-group.fi (localhost [IPv6:::1]) + by guru.guru-group.fi (Postfix) with ESMTP id A0250100033; + Mon, 3 Nov 2014 11:44:17 +0200 (EET) +From: Tomi Ollila +To: Michal Sojka , + Mark Walters , notmuch@notmuchmail.org +Subject: Re: [PATCH v6 6/7] cli: search: Add --output=count +In-Reply-To: +References: <1414792441-29555-1-git-send-email-sojkam1@fel.cvut.cz> + <1414792441-29555-7-git-send-email-sojkam1@fel.cvut.cz> + <87r3xnu3dn.fsf@qmul.ac.uk> <87bnoqbexm.fsf@steelpick.2x.cz> + <87d2963q87.fsf@qmul.ac.uk> + +User-Agent: Notmuch/0.18.2+169~g5bcdd1c (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-unknown-linux-gnu) +X-Face: HhBM'cA~ +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: quoted-printable +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +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: Mon, 03 Nov 2014 09:44:54 -0000 + +On Sun, Nov 02 2014, Michal Sojka wrote: + +> On 2. listopadu 2014 10:29:28 CET, Mark Walters wrote: +>> +>>Hi +>> +>>On Sun, 02 Nov 2014, Michal Sojka wrote: +>>> On Sat, Nov 01 2014, Mark Walters wrote: +>>>> On Fri, 31 Oct 2014, Michal Sojka wrote: +>>>>> This output can be used with --output=3Drecipients or --output=3Dsend= +er +>>>>> and in addition to the addresses, it prints how many times was each +>>>>> address encountered during search. +>>>> +>>>> Hi +>>>> +>>>> I have a couple comments on this patch. +>>>> +>>>>> --- +>>>>> completion/notmuch-completion.bash | 2 +- +>>>>> completion/notmuch-completion.zsh | 2 +- +>>>>> doc/man1/notmuch-search.rst | 9 +++++-- +>>>>> notmuch-search.c | 51 +>>++++++++++++++++++++++++++++++++------ +>>>>> 4 files changed, 52 insertions(+), 12 deletions(-) +>>>>> +>>>>> diff --git a/completion/notmuch-completion.bash +>>b/completion/notmuch-completion.bash +>>>>> index cfbd389..39cd829 100644 +>>>>> --- a/completion/notmuch-completion.bash +>>>>> +++ b/completion/notmuch-completion.bash +>>>>> @@ -294,7 +294,7 @@ _notmuch_search() +>>>>> return +>>>>> ;; +>>>>> --output) +>>>>> - COMPREPLY=3D( $( compgen -W "summary threads messages files +>>tags sender recipients" -- "${cur}" ) ) +>>>>> + COMPREPLY=3D( $( compgen -W "summary threads messages files +>>tags sender recipients count" -- "${cur}" ) ) +>>>>> return +>>>>> ;; +>>>>> --sort) +>>>>> diff --git a/completion/notmuch-completion.zsh +>>b/completion/notmuch-completion.zsh +>>>>> index 3e52a00..d7e5a5e 100644 +>>>>> --- a/completion/notmuch-completion.zsh +>>>>> +++ b/completion/notmuch-completion.zsh +>>>>> @@ -53,7 +53,7 @@ _notmuch_search() +>>>>> '--max-threads=3D[display only the first x threads from the +>>search results]:number of threads to show: ' \ +>>>>> '--first=3D[omit the first x threads from the search +>>results]:number of threads to omit: ' \ +>>>>> '--sort=3D[sort results]:sorting:((newest-first\:"reverse +>>chronological order" oldest-first\:"chronological order"))' \ +>>>>> - '--output=3D[select what to output]:output:((summary threads +>>messages files tags sender recipients))' +>>>>> + '--output=3D[select what to output]:output:((summary threads +>>messages files tags sender recipients count))' +>>>>> } +>>>>>=20=20 +>>>>> _notmuch() +>>>>> diff --git a/doc/man1/notmuch-search.rst +>>b/doc/man1/notmuch-search.rst +>>>>> index 42f17e4..ec89200 100644 +>>>>> --- a/doc/man1/notmuch-search.rst +>>>>> +++ b/doc/man1/notmuch-search.rst +>>>>> @@ -96,9 +96,14 @@ Supported options for **search** include +>>>>> Like **sender** but for addresses from *To*, *Cc* and +>>>>> *Bcc* headers. +>>>>>=20=20 +>>>>> + **count** +>>>>> + Can be used in combination with **sender** or +>>>>> + **recipients** to print the count of how many times was +>>>>> + the address encountered during search. +>>>>> + +>>>>> This option can be given multiple times to combine different +>>>>> - outputs. Currently, this is only supported for **sender** and +>>>>> - **recipients** outputs. +>>>>> + outputs. Currently, this is only supported for **sender**, +>>>>> + **recipients** and **count** outputs. +>>>> +>>>> It might be worth saying that the results will be slower if count is +>>>> specified. +>>> +>>> I wrote something like this in +>>> id:1414889400-30977-10-git-send-email-sojkam1@fel.cvut.cz. +>>> +>>>> +>>>>> ``--sort=3D``\ (**newest-first**\ \|\ **oldest-first**) +>>>> +>>>> I think sort works as expected if count is not specified, but does +>>not +>>>> with count.=20 +>>> +>>> Agreed. +>>> +>>>> Maybe count can be done by doing two passes?=20 +>>> +>>> What do you mean by pass? +>> +>>I mean iterating through the messages twice: so the first time would +>>fill in the count in the hash map, and the second iteration would print +>>the addresses. +> +> That's what the patch does. Only the second time it iterates the hash. + +Sorry=20 + +And we loose the order ? (or not ?) do we have "orderedhash" there... +I'd like to save the order (but that is not so important) -- but +more importantly, are tests robusts --- ah there is sort -n in the test... + +> +> Michal + +Tomi + +> +> --=20 +> Odesl=C3=A1no z m=C3=A9ho telefonu pomoc=C3=AD Kaiten Mail. Omluvte pros= +=C3=ADm mou stru=C4=8Dnost. +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch