Re: contact instead of (to or from)

Subject: Re: contact instead of (to or from)

Date: Fri, 10 Jun 2022 09:47:46 +0200

To: 杨令

Cc: erik colson, notmuch@notmuchmail.org

From: Michael J Gruber


[rearranged for bottom post style]
Am Fr., 10. Juni 2022 um 05:51 Uhr schrieb 杨令 <yangling1984@gmail.com>:
> On Fri 2022-06-10 00:35:12, erik colson wrote:
> > Date: Fri, 10 Jun 2022 00:35:12 +0200
> > From: erik colson <eco@ecocode.net>
> > To: notmuch@notmuchmail.org
> > Subject: contact instead of (to or from)
> >
> > Hi,
> >>
> > Coming from mu4e I loved the query "contact" which includes "to" or
> > "from" the contact in the results.
> > Is there something equivalent in notmuch?
> ⮩ Hi, Erik, I don't think notmuch has a built-in `contact` query, but I
> think it's easy to build a saved search.
>
>   (add-to-list 'notmuch-saved-searches '(:name "query" :query "to:... or from:..." :key "r"))
>
> `:key` part is optional.
>
> --
> L.Yang

If you have notmuch with sexp queries there is a pure notmuch solution:

notmuch config set squery.Contact '(macro (x) (or (from ,x) (to ,x)))'

Use it with either of the following forms:

notmuch count --query=sexp -- '(Contact erik)'
notmuch count sexp:'"(Contact erik)"'

Fun fact: I learned this by mistaking your emacs lisp for sexp first
and vaguely remembering the existence of sexp macros, then rtfming ...

Michael
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: