New "notmuch address" command

Michal Sojka sojkam1 at fel.cvut.cz
Fri Dec 12 02:39:17 PST 2014


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 at doe.com"
> and CCed to "foo at bar.com", "notmuch address to:foo" emits
> "john at doe.com", not "foo at 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 at address to:"prefix*"

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

    notmuch address --output=sender to:my at 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 at 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


More information about the notmuch mailing list