~rjarry/aerc-discuss

5 4

Can't access notmuch named queries

Details
Message ID
<D023JMQOWHQA.30AYJTOGE68J8@onemoresuza.com>
DKIM signature
pass
Download raw message
notmuch supports named queries by adding the following to its config
file:

```ini
[query]
<name>=<search-terms>
```

By using <name> either on the query-map file or with the `cf` command,
aerc displays no messages, albeit using <search-terms> directly yields
the expected messages.

By using the notmuch cli tool, both cases yields the expected messages,
that is, `notmuch search -- query:<name>` and `notmuch search --
<search-terms>`.

Is this to be expected?
Details
Message ID
<D0PDRDR1R6U8.276TP7HXNU5LD@tjex.net>
In-Reply-To
<D023JMQOWHQA.30AYJTOGE68J8@onemoresuza.com> (view parent)
DKIM signature
pass
Download raw message
> By using <name> either on the query-map file or with the `cf` command,
> aerc displays no messages, albeit using <search-terms> directly yields
> the expected messages.

A thought on the query not appearing via `:cf`. Perhaps this isn't supported
yet, as `:cf <tab>` returns no autocommplete suggestions for `:query ...`. I'm
expecting that if `:cf` supported queries, the `:query` option would show
regardless of whether there was a query mapping set or not.

> By using the notmuch cli tool, both cases yields the expected messages,
> that is, `notmuch search -- query:<name>` and `notmuch search --
> <search-terms>`.
>
> Is this to be expected?

I'm getting the exact same behaviour; saved query is working via CLI, but not
within aerc query mapping. That is: 

```ini
# notmuch.conf

[query]
mum=from:mums@email.com
```
```ini
# notmuch.qmap

mum = query:mum
```

```ini
# accounts.conf
[account]
#...
query-map = ~/.config/aerc/notmuch.qmap`
```
Details
Message ID
<D0QSHD554867.2CO4QEQJLC1AG@onemoresuza.com>
In-Reply-To
<D0PDRDR1R6U8.276TP7HXNU5LD@tjex.net> (view parent)
DKIM signature
pass
Download raw message
I really don't know what exactly aerc uses from notmuch's config: as
stated above, it ignores named queries, however, I'm able to use:

```ini
[index]
header.List=List-ID
```

to filter against mailing lists.

Does it use a Go library or is it something from scratch, like invoking
the notmuch binary directly?
Details
Message ID
<D0QSMKHIV4FB.2LJLNZ7RCVNNA@timculverhouse.com>
In-Reply-To
<D0QSHD554867.2CO4QEQJLC1AG@onemoresuza.com> (view parent)
DKIM signature
pass
Download raw message
On Mon Apr 22, 2024 at 8:24 AM AKDT, Coutinho de Souza wrote:
> I really don't know what exactly aerc uses from notmuch's config: as
> stated above, it ignores named queries, however, I'm able to use:
>
> ```ini
> [index]
> header.List=List-ID
> ```

It's important to remember that notmuch is two different things: it's a library
and it's a client of it's library. The same config file is used for both. Aerc
only interacts with the library.

The [index] key is used by the library for indexing. That's why configuration in
this key is affects aerc.

Named queries are used by the CLI. aerc currently does not pull any named query
information from the notmuch config, though we could. It just hasn't been
implemented. Aerc has essentially implemented it's own named queries via the
querymap file. This seems like a decent approach so that you could have
separately named queries for different notmuch clients (IE the CLI vs aerc).

> Does it use a Go library or is it something from scratch, like invoking
> the notmuch binary directly?

It uses CGO bindings we wrote from scratch.

-- 
Tim
Details
Message ID
<D0QT7G1EETZG.3A3Q6EY6W0J6L@onemoresuza.com>
In-Reply-To
<D0QSMKHIV4FB.2LJLNZ7RCVNNA@timculverhouse.com> (view parent)
DKIM signature
pass
Download raw message
Thanks for the explanation, Tim.

> The [index] key is used by the library for indexing. That's why configuration in
>this key is affects aerc.
> 
> Named queries are used by the CLI. 

I didn't know that some of notmuch's config file was only used by the
cli client.

> aerc currently does not pull any named query information from the
> notmuch config, though we could. It just hasn't been implemented. Aerc
> has essentially implemented it's own named queries via the querymap
> file. This seems like a decent approach so that you could have
> separately named queries for different notmuch clients (IE the CLI vs
> aerc).

Makes sense: one could see the querymap file for aerc as the named
queries in notmuch's config file for the cli.
Details
Message ID
<D0RRVA1U3Y8U.2TNK1FT5JXU99@ferdinandy.com>
In-Reply-To
<D0QT7G1EETZG.3A3Q6EY6W0J6L@onemoresuza.com> (view parent)
DKIM signature
missing
Download raw message
On Mon Apr 22, 2024 at 18:58, Coutinho de Souza <srht-n2c9ebas@onemoresuza.com> wrote:
> Thanks for the explanation, Tim.
>
> > The [index] key is used by the library for indexing. That's why configuration in
> >this key is affects aerc.
> > 
> > Named queries are used by the CLI. 
>
> I didn't know that some of notmuch's config file was only used by the
> cli client.
>
> > aerc currently does not pull any named query information from the
> > notmuch config, though we could. It just hasn't been implemented. Aerc
> > has essentially implemented it's own named queries via the querymap
> > file. This seems like a decent approach so that you could have
> > separately named queries for different notmuch clients (IE the CLI vs
> > aerc).
>
> Makes sense: one could see the querymap file for aerc as the named
> queries in notmuch's config file for the cli.

Just wanted to note, that notmuch supports several profiles, so we could go
down the route, where we read the default notmuch profile by default and allow
users to specify another profile specifically for aerc.


-- 
+36305425054
bence.ferdinandy.com
Reply to thread Export thread (mbox)