unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* New "notmuch address" command
@ 2014-12-12  9:16 Lele Gaifax
  2014-12-12 10:39 ` Michal Sojka
  0 siblings, 1 reply; 5+ messages in thread
From: Lele Gaifax @ 2014-12-12  9:16 UTC (permalink / raw)
  To: notmuch

Hi all again,

I'm happily using "notmuch-addrlookup"[1] as "notmuch-address-command", in
my Emacs configuration.

As explained in my other message, yesterday I spent some time tweaking
that configuration and tried to replace it with the new "notmuch
address" introduced in version 0.19.

An (almost) equivalent of "notmuch-addrlookup foo" could be "notmuch
address to:foo* OR from:foo*", but it has at least one indesiderable
difference: it seems considering the "CC" field, but always emits the
"TO" content (i.e., assuming I have a message I sent to "john@doe.com"
and CCed to "foo@bar.com", "notmuch address to:foo" emits
"john@doe.com", not "foo@bar.com") so the candidates it generates are
way too much.

I don't know it that's done on purpose (I clearly miss the use case if
so).

I wonder if it would be reasonable adding a "--complete" flag to the
"address" command that selects a more specific behaviour, so that
"notmuch address --complete foo":

a) automatically performs a partial match (i.e. it adds the '*' suffix
   on its own)

b) searches the given text only in the related headers (hiding the
   difference between "incoming" and "outgoing" messages, and not
   considering the body at all)

c) avoids the "bug"/"feature" explained above

What do you think?

Thank you,
ciao, lele.

[1] https://github.com/aperezdc/notmuch-addrlookup-c
-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele@metapensiero.it  |                 -- Fortunato Depero, 1929.

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

* Re: New "notmuch address" command
  2014-12-12  9:16 New "notmuch address" command Lele Gaifax
@ 2014-12-12 10:39 ` Michal Sojka
  2014-12-12 12:10   ` Lele Gaifax
  0 siblings, 1 reply; 5+ messages in thread
From: Michal Sojka @ 2014-12-12 10:39 UTC (permalink / raw)
  To: Lele Gaifax, notmuch

Hi Lele,

On Fri, Dec 12 2014, Lele Gaifax wrote:
> Hi all again,
>
> I'm happily using "notmuch-addrlookup"[1] as "notmuch-address-command", in
> my Emacs configuration.
>
> As explained in my other message, yesterday I spent some time tweaking
> that configuration and tried to replace it with the new "notmuch
> address" introduced in version 0.19.
>
> An (almost) equivalent of "notmuch-addrlookup foo" could be "notmuch
> address to:foo* OR from:foo*", but it has at least one indesiderable
> difference: it seems considering the "CC" field, but always emits the
> "TO" content (i.e., assuming I have a message I sent to "john@doe.com"
> and CCed to "foo@bar.com", "notmuch address to:foo" emits
> "john@doe.com", not "foo@bar.com") so the candidates it generates are
> way too much.
>
> I don't know it that's done on purpose (I clearly miss the use case if
> so).

Yes, this is expected behavior. Notmuch address is basically a wrapper
around search command. The command does not interpret the query at all,
because there might be no from:/to: term. The use case was to SIMPLIFY
address completers. 

> I wonder if it would be reasonable adding a "--complete" flag to the
> "address" command that selects a more specific behaviour, so that
> "notmuch address --complete foo":

This would definitely be useful.

> a) automatically performs a partial match (i.e. it adds the '*' suffix
>    on its own)

OK

> b) searches the given text only in the related headers (hiding the
>    difference between "incoming" and "outgoing" messages, 

This should be configurable, because --output=sender is much faster than
--output=recipients. I think that ideal address completion should offer
you the addresses you have already written to, i.e.

    notmuch address --output=recipient from:my@address to:"prefix*"

But this may be too slow on non-SSD disks. Some users may therefore prefer

    notmuch address --output=sender to:my@address from:"prefix*"

which would be faster, but also includes every spammer/robot/... who
sends anything to you.

> and not
>    considering the body at all)

What considers body now?

>
> c) avoids the "bug"/"feature" explained above

Yes, if you know the substring you are looking for, implementing a
filter would be trivial.

> What do you think?

Another question is that uses may want to select which my@address to
use. So maybe you can add --my-address option that allow specifying one
or more addresses. If this option would not be given, all configured
addresses in .notmuch-config would be used.

So I think that --complete should just construct the query containing
from:/to: terms and this should be concatenated with what user specified
as a query. For example:

  notmuch address --complete prefix tag:attachment

-Michal

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

* Re: New "notmuch address" command
  2014-12-12 10:39 ` Michal Sojka
@ 2014-12-12 12:10   ` Lele Gaifax
  2014-12-14 14:24     ` Michal Sojka
  0 siblings, 1 reply; 5+ messages in thread
From: Lele Gaifax @ 2014-12-12 12:10 UTC (permalink / raw)
  To: notmuch

Michal Sojka <sojkam1@fel.cvut.cz> writes:

>> An (almost) equivalent of "notmuch-addrlookup foo" could be "notmuch
>> address to:foo* OR from:foo*", but it has at least one indesiderable
>> difference: it seems considering the "CC" field, but always emits the
>> "TO" content (i.e., assuming I have a message I sent to "john@doe.com"
>> and CCed to "foo@bar.com", "notmuch address to:foo" emits
>> "john@doe.com", not "foo@bar.com") so the candidates it generates are
>> way too much.
>>
>> I don't know it that's done on purpose (I clearly miss the use case if
>> so).
>
> Yes, this is expected behavior. Notmuch address is basically a wrapper
> around search command. The command does not interpret the query at all,
> because there might be no from:/to: term. The use case was to SIMPLIFY
> address completers.

Ok, even if I still miss the point of searching for an address and
obtaining (only, see below) something (apparently) unrelated.

>> I wonder if it would be reasonable adding a "--complete" flag to the
>> "address" command that selects a more specific behaviour, so that
>> "notmuch address --complete foo":
> ...
>> b) searches the given text only in the related headers (hiding the
>>    difference between "incoming" and "outgoing" messages, 
>
> This should be configurable, because --output=sender is much faster than
> --output=recipients. I think that ideal address completion should offer
> you the addresses you have already written to, i.e.
>
>     notmuch address --output=recipient from:my@address to:"prefix*"
>
> But this may be too slow on non-SSD disks. Some users may therefore prefer
>
>     notmuch address --output=sender to:my@address from:"prefix*"
>
> which would be faster, but also includes every spammer/robot/... who
> sends anything to you.

Yes, seems reasonable!

>> and not
>>    considering the body at all)
>
> What considers body now?

Well, "notmuch address foo" currently does that, and that sounds useful,
to obtain a list of recipients who talked about "foo".

>> c) avoids the "bug"/"feature" explained above
>
> Yes, if you know the substring you are looking for, implementing a
> filter would be trivial.

It's not just a matter of filtering, but rather *which* address is
emitted: trying it out, in the case above the "foo@bar.com" is not even
mentioned in the output, because it appears only as a CCed recipient.

thank you,
ciao, lele.
-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele@metapensiero.it  |                 -- Fortunato Depero, 1929.

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

* Re: New "notmuch address" command
  2014-12-12 12:10   ` Lele Gaifax
@ 2014-12-14 14:24     ` Michal Sojka
  2014-12-14 18:56       ` Lele Gaifax
  0 siblings, 1 reply; 5+ messages in thread
From: Michal Sojka @ 2014-12-14 14:24 UTC (permalink / raw)
  To: Lele Gaifax, notmuch

On Pá, pro 12 2014, Lele Gaifax wrote:
> Michal Sojka <sojkam1@fel.cvut.cz> writes:
>
>>> An (almost) equivalent of "notmuch-addrlookup foo" could be "notmuch
>>> address to:foo* OR from:foo*", but it has at least one indesiderable
>>> difference: it seems considering the "CC" field, but always emits the
>>> "TO" content (i.e., assuming I have a message I sent to "john@doe.com"
>>> and CCed to "foo@bar.com", "notmuch address to:foo" emits
>>> "john@doe.com", not "foo@bar.com") so the candidates it generates are
>>> way too much.
>>>
>>> I don't know it that's done on purpose (I clearly miss the use case if
>>> so).
>>
>> Yes, this is expected behavior. Notmuch address is basically a wrapper
>> around search command. The command does not interpret the query at all,
>> because there might be no from:/to: term. The use case was to SIMPLIFY
>> address completers.
>
> Ok, even if I still miss the point of searching for an address and
> obtaining (only, see below) something (apparently) unrelated.
>
>>> I wonder if it would be reasonable adding a "--complete" flag to the
>>> "address" command that selects a more specific behaviour, so that
>>> "notmuch address --complete foo":
>> ...
>>> b) searches the given text only in the related headers (hiding the
>>>    difference between "incoming" and "outgoing" messages, 
>>
>> This should be configurable, because --output=sender is much faster than
>> --output=recipients. I think that ideal address completion should offer
>> you the addresses you have already written to, i.e.
>>
>>     notmuch address --output=recipient from:my@address to:"prefix*"
>>
>> But this may be too slow on non-SSD disks. Some users may therefore prefer
>>
>>     notmuch address --output=sender to:my@address from:"prefix*"
>>
>> which would be faster, but also includes every spammer/robot/... who
>> sends anything to you.
>
> Yes, seems reasonable!
>
>>> and not
>>>    considering the body at all)
>>
>> What considers body now?
>
> Well, "notmuch address foo" currently does that, and that sounds useful,
> to obtain a list of recipients who talked about "foo".
>
>>> c) avoids the "bug"/"feature" explained above
>>
>> Yes, if you know the substring you are looking for, implementing a
>> filter would be trivial.
>
> It's not just a matter of filtering, but rather *which* address is
> emitted: trying it out, in the case above the "foo@bar.com" is not even
> mentioned in the output, because it appears only as a CCed recipient.

Are you saying that Cc address is not printed or that you want it not to
be printed? If the former than it is a bug. The following test passes
for me, i.e. foo@bar.com is printed.

diff --git a/test/T095-address.sh b/test/T095-address.sh
index ed0cac7..17a7b08 100755
--- a/test/T095-address.sh
+++ b/test/T095-address.sh
@@ -145,4 +145,13 @@ cat <<EOF >EXPECTED
 EOF
 test_expect_equal_file OUTPUT EXPECTED
 
+test_begin_subtest "Cc address is printed while searching for To address"
+add_message [to]=john@doe.com [cc]=foo@bar.com
+notmuch address --output=recipients to:john@doe.com > OUTPUT
+cat <<EOF >EXPECTED
+john@doe.com
+foo@bar.com
+EOF
+test_expect_equal_file OUTPUT EXPECTED
+
 test_done

Cheers,
-Michal

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

* Re: New "notmuch address" command
  2014-12-14 14:24     ` Michal Sojka
@ 2014-12-14 18:56       ` Lele Gaifax
  0 siblings, 0 replies; 5+ messages in thread
From: Lele Gaifax @ 2014-12-14 18:56 UTC (permalink / raw)
  To: notmuch

Michal Sojka <sojkam1@fel.cvut.cz> writes:

> On Pá, pro 12 2014, Lele Gaifax wrote:
>> It's not just a matter of filtering, but rather *which* address is
>> emitted: trying it out, in the case above the "foo@bar.com" is not even
>> mentioned in the output, because it appears only as a CCed recipient.
>
> Are you saying that Cc address is not printed or that you want it not to
> be printed? If the former than it is a bug. The following test passes
> for me, i.e. foo@bar.com is printed.

Ouch, you are right, I stand corrected: I completely missed the
--output=recipients option, and I see that by default it prints only the
sender.

Sorry for the noise,
thank you and bye, lele.
-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele@metapensiero.it  |                 -- Fortunato Depero, 1929.

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

end of thread, other threads:[~2014-12-14 18:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-12  9:16 New "notmuch address" command Lele Gaifax
2014-12-12 10:39 ` Michal Sojka
2014-12-12 12:10   ` Lele Gaifax
2014-12-14 14:24     ` Michal Sojka
2014-12-14 18:56       ` Lele Gaifax

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