Re: [PATCH 0/4] Allow specifying alternate names for addresses in other_email
[notmuch-archives.git] / 4b / 39c717d2695f210ae3d993fd2f6a89b048de44
1 Return-Path: <sojkam1@fel.cvut.cz>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id BF261431FD9\r
6         for <notmuch@notmuchmail.org>; Mon,  3 Nov 2014 13:39:44 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -2.3\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id r7E847DyzHOT for <notmuch@notmuchmail.org>;\r
16         Mon,  3 Nov 2014 13:39:36 -0800 (PST)\r
17 Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36])\r
18         by olra.theworths.org (Postfix) with ESMTP id 681AF431FAE\r
19         for <notmuch@notmuchmail.org>; Mon,  3 Nov 2014 13:39:36 -0800 (PST)\r
20 Received: from localhost (unknown [192.168.200.7])\r
21         by max.feld.cvut.cz (Postfix) with ESMTP id E5D995CCFDD;\r
22         Mon,  3 Nov 2014 22:39:33 +0100 (CET)\r
23 X-Virus-Scanned: IMAP STYX AMAVIS\r
24 Received: from max.feld.cvut.cz ([192.168.200.1])\r
25         by localhost (styx.feld.cvut.cz [192.168.200.7]) (amavisd-new,\r
26         port 10044)\r
27         with ESMTP id UWUrhsGvS0uK; Mon,  3 Nov 2014 22:39:32 +0100 (CET)\r
28 Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34])\r
29         by max.feld.cvut.cz (Postfix) with ESMTP id F34BB5CCFE2;\r
30         Mon,  3 Nov 2014 22:39:31 +0100 (CET)\r
31 Received: from wsh by steelpick.2x.cz with local (Exim 4.84)\r
32         (envelope-from <sojkam1@fel.cvut.cz>)\r
33         id 1XlPLS-0006jb-28; Mon, 03 Nov 2014 22:39:26 +0100\r
34 From: Michal Sojka <sojkam1@fel.cvut.cz>\r
35 To: Tomi Ollila <tomi.ollila@iki.fi>,\r
36  Mark Walters <markwalters1009@gmail.com>,      notmuch@notmuchmail.org\r
37 Subject: Re: [PATCH v6 6/7] cli: search: Add --output=count\r
38 In-Reply-To: <m2d2947h5b.fsf@guru.guru-group.fi>\r
39 References: <1414792441-29555-1-git-send-email-sojkam1@fel.cvut.cz>\r
40         <1414792441-29555-7-git-send-email-sojkam1@fel.cvut.cz>\r
41         <87r3xnu3dn.fsf@qmul.ac.uk> <87bnoqbexm.fsf@steelpick.2x.cz>\r
42         <87d2963q87.fsf@qmul.ac.uk>\r
43         <b1fb8387-6ae4-4f9c-aee6-f4758f010751@email.android.com>\r
44         <m2d2947h5b.fsf@guru.guru-group.fi>\r
45 User-Agent: Notmuch/0.18.2+157~ga00d359 (http://notmuchmail.org) Emacs/24.3.1\r
46         (x86_64-pc-linux-gnu)\r
47 Date: Mon, 03 Nov 2014 22:39:26 +0100\r
48 Message-ID: <87r3xk9d69.fsf@steelpick.2x.cz>\r
49 MIME-Version: 1.0\r
50 Content-Type: text/plain\r
51 X-BeenThere: notmuch@notmuchmail.org\r
52 X-Mailman-Version: 2.1.13\r
53 Precedence: list\r
54 List-Id: "Use and development of the notmuch mail system."\r
55         <notmuch.notmuchmail.org>\r
56 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
57         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
58 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
59 List-Post: <mailto:notmuch@notmuchmail.org>\r
60 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
61 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
62         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
63 X-List-Received-Date: Mon, 03 Nov 2014 21:39:44 -0000\r
64 \r
65 Hi Tomi,\r
66 \r
67 On Mon, Nov 03 2014, Tomi Ollila wrote:\r
68 > On Sun, Nov 02 2014, Michal Sojka <sojkam1@fel.cvut.cz> wrote:\r
69 >\r
70 >> On 2. listopadu 2014 10:29:28 CET, Mark Walters <markwalters1009@gmail.com> wrote:\r
71 >>>\r
72 >>>Hi\r
73 >>>\r
74 >>>On Sun, 02 Nov 2014, Michal Sojka <sojkam1@fel.cvut.cz> wrote:\r
75 >>>> On Sat, Nov 01 2014, Mark Walters wrote:\r
76 >>>>> On Fri, 31 Oct 2014, Michal Sojka <sojkam1@fel.cvut.cz> wrote:\r
77 >>>>>> This output can be used with --output=recipients or --output=sender\r
78 >>>>>> and in addition to the addresses, it prints how many times was each\r
79 >>>>>> address encountered during search.\r
80 >>>>>\r
81 >>>>> Hi\r
82 >>>>>\r
83 >>>>> I have a couple comments on this patch.\r
84 >>>>>\r
85 >>>>>> ---\r
86 >>>>>>  completion/notmuch-completion.bash |  2 +-\r
87 >>>>>>  completion/notmuch-completion.zsh  |  2 +-\r
88 >>>>>>  doc/man1/notmuch-search.rst        |  9 +++++--\r
89 >>>>>>  notmuch-search.c                   | 51\r
90 >>>++++++++++++++++++++++++++++++++------\r
91 >>>>>>  4 files changed, 52 insertions(+), 12 deletions(-)\r
92 >>>>>>\r
93 >>>>>> diff --git a/completion/notmuch-completion.bash\r
94 >>>b/completion/notmuch-completion.bash\r
95 >>>>>> index cfbd389..39cd829 100644\r
96 >>>>>> --- a/completion/notmuch-completion.bash\r
97 >>>>>> +++ b/completion/notmuch-completion.bash\r
98 >>>>>> @@ -294,7 +294,7 @@ _notmuch_search()\r
99 >>>>>>              return\r
100 >>>>>>              ;;\r
101 >>>>>>          --output)\r
102 >>>>>> -            COMPREPLY=( $( compgen -W "summary threads messages files\r
103 >>>tags sender recipients" -- "${cur}" ) )\r
104 >>>>>> +            COMPREPLY=( $( compgen -W "summary threads messages files\r
105 >>>tags sender recipients count" -- "${cur}" ) )\r
106 >>>>>>              return\r
107 >>>>>>              ;;\r
108 >>>>>>          --sort)\r
109 >>>>>> diff --git a/completion/notmuch-completion.zsh\r
110 >>>b/completion/notmuch-completion.zsh\r
111 >>>>>> index 3e52a00..d7e5a5e 100644\r
112 >>>>>> --- a/completion/notmuch-completion.zsh\r
113 >>>>>> +++ b/completion/notmuch-completion.zsh\r
114 >>>>>> @@ -53,7 +53,7 @@ _notmuch_search()\r
115 >>>>>>      '--max-threads=[display only the first x threads from the\r
116 >>>search results]:number of threads to show: ' \\r
117 >>>>>>      '--first=[omit the first x threads from the search\r
118 >>>results]:number of threads to omit: ' \\r
119 >>>>>>      '--sort=[sort results]:sorting:((newest-first\:"reverse\r
120 >>>chronological order" oldest-first\:"chronological order"))' \\r
121 >>>>>> -    '--output=[select what to output]:output:((summary threads\r
122 >>>messages files tags sender recipients))'\r
123 >>>>>> +    '--output=[select what to output]:output:((summary threads\r
124 >>>messages files tags sender recipients count))'\r
125 >>>>>>  }\r
126 >>>>>>  \r
127 >>>>>>  _notmuch()\r
128 >>>>>> diff --git a/doc/man1/notmuch-search.rst\r
129 >>>b/doc/man1/notmuch-search.rst\r
130 >>>>>> index 42f17e4..ec89200 100644\r
131 >>>>>> --- a/doc/man1/notmuch-search.rst\r
132 >>>>>> +++ b/doc/man1/notmuch-search.rst\r
133 >>>>>> @@ -96,9 +96,14 @@ Supported options for **search** include\r
134 >>>>>>              Like **sender** but for addresses from *To*, *Cc* and\r
135 >>>>>>              *Bcc* headers.\r
136 >>>>>>  \r
137 >>>>>> +        **count**\r
138 >>>>>> +            Can be used in combination with **sender** or\r
139 >>>>>> +            **recipients** to print the count of how many times was\r
140 >>>>>> +            the address encountered during search.\r
141 >>>>>> +\r
142 >>>>>>          This option can be given multiple times to combine different\r
143 >>>>>> -        outputs. Currently, this is only supported for **sender** and\r
144 >>>>>> -        **recipients** outputs.\r
145 >>>>>> +        outputs. Currently, this is only supported for **sender**,\r
146 >>>>>> +        **recipients** and **count** outputs.\r
147 >>>>>\r
148 >>>>> It might be worth saying that the results will be slower if count is\r
149 >>>>> specified.\r
150 >>>>\r
151 >>>> I wrote something like this in\r
152 >>>> id:1414889400-30977-10-git-send-email-sojkam1@fel.cvut.cz.\r
153 >>>>\r
154 >>>>>\r
155 >>>>>>      ``--sort=``\ (**newest-first**\ \|\ **oldest-first**)\r
156 >>>>>\r
157 >>>>> I think sort works as expected if count is not specified, but does\r
158 >>>not\r
159 >>>>> with count. \r
160 >>>>\r
161 >>>> Agreed.\r
162 >>>>\r
163 >>>>> Maybe count can be done by doing two passes? \r
164 >>>>\r
165 >>>> What do you mean by pass?\r
166 >>>\r
167 >>>I mean iterating through the messages twice: so the first time would\r
168 >>>fill in the count in the hash map, and the second iteration would print\r
169 >>>the addresses.\r
170 >>\r
171 >> That's what the patch does. Only the second time it iterates the hash.\r
172 >\r
173 > Sorry \r
174 >\r
175 > And we loose the order ? (or not ?) do we have "orderedhash" there...\r
176 > I'd like to save the order\r
177 \r
178 What would be the use case?\r
179 \r
180 If you really want to preserve the order, we could save a sequence\r
181 number in mailbox_t and sort the hash table entries before printing. But\r
182 this could be implemented later and enabled by a special command line\r
183 option. notmuch search --output=tags does not preserve order either.\r
184 \r
185 > (but that is not so important) -- but more importantly, are tests\r
186 > robusts --- ah there is sort -n in the test...\r
187 \r
188 Yes.\r
189 \r
190 -Michal\r