~rjarry/aerc-discuss

12 5

virtual 'aggregate' account?

Details
Message ID
<CXZ5Y15UPYCF.2F20SW3JNZJGP@stud.uni-goettingen.de>
DKIM signature
missing
Download raw message
Hi.

So I am using aerc with five mail accounts, all maildirs synced with
mbsync. All maildirs have the same parent directory. This allowed me
to create another maildir account, targetting that parent directory,
which is configured to only show the inboxen of the other accounts.

This is already neat, hoever it has the problem that I can't respond
without explicitly changing to the right account, which is pretty
annoying. Also all the inboxen are still separate mail folders.

What I'd really like is to have some sort of virtual aggregate
account, which shows all unread mails from all accounts inboxen -
and only the unread ones - in a /single/ mail folder.  Basically a
convenient digest of all new unread mail.

This is probably possible with notmuch I guess, but the idea of
making my mail setup more complicated is not very appealing to me
right now.

So I wonder if this is a feature request likely to be accepted?

---
Friendly Greetings,
Leon Henrik Plickat
Details
Message ID
<CXZ6F55Y0GTH.3BBJYJJSYW2CI@poldrack.dev>
In-Reply-To
<CXZ5Y15UPYCF.2F20SW3JNZJGP@stud.uni-goettingen.de> (view parent)
DKIM signature
missing
Download raw message
On Wed Dec 27, 2023 at 2:50 PM CET, Leon Henrik Plickat wrote:
> So I wonder if this is a feature request likely to be accepted?

This has been a topic multiple times already and if memory serves well
got the nod-of-approval from Robin. Unfortunately it's not as easy as it
sounds at first. I'm not sure if someone is looking into it at the
moment and can give additional insight though.

-- 
Moritz Poldrack
https://moritz.sh

> Keep this and all chemicals out of the reach of children.
Details
Message ID
<CXZ6F51GEVAW.1B44HAP36ZGYE@ferdinandy.com>
In-Reply-To
<CXZ5Y15UPYCF.2F20SW3JNZJGP@stud.uni-goettingen.de> (view parent)
DKIM signature
missing
Download raw message
Hi Leon,

On Wed Dec 27, 2023 at 14:50, Leon Henrik Plickat <leonhenrik.plickat@stud.uni-goettingen.de> wrote:
> Hi.
>
> So I am using aerc with five mail accounts, all maildirs synced with
> mbsync. All maildirs have the same parent directory. This allowed me
> to create another maildir account, targetting that parent directory,
> which is configured to only show the inboxen of the other accounts.
>
> This is already neat, hoever it has the problem that I can't respond
> without explicitly changing to the right account, which is pretty
> annoying. Also all the inboxen are still separate mail folders.
>
> What I'd really like is to have some sort of virtual aggregate
> account, which shows all unread mails from all accounts inboxen -
> and only the unread ones - in a /single/ mail folder.  Basically a
> convenient digest of all new unread mail.
>
> This is probably possible with notmuch I guess, but the idea of
> making my mail setup more complicated is not very appealing to me
> right now.

Indeed you can use notmuch for something similar, which is more flexible than
your maildir setup (and imho, notmuch is extremely useful for searching)

https://bence.ferdinandy.com/2023/07/20/email-in-the-terminal-a-complete-guide-to-the-unix-way-of-email/#unifying-notmuch-account

Unfortunately, this also requires an extra account, so doesn't solve the issue
of replying with the appropriate account. I think this can be solved through
templating. :reply takes an account flag (-A) which switches to the appropriate
account before opening compose. You might be able to leverage To/Cc headers in
a template to return the appropriate account name. Maybe something more clever
could also work, there was also discussions of having a {{.FilePath}} variable,
that could be explicitly used to check which account it belongs to without
relying on header fields.

Best,
Bence


--
+36305425054
bence.ferdinandy.com
Details
Message ID
<CXZ6IX5YDG1C.10ZWQ0GWT7PZW@ferdinandy.com>
In-Reply-To
<CXZ6F51GEVAW.1B44HAP36ZGYE@ferdinandy.com> (view parent)
DKIM signature
missing
Download raw message
> https://bence.ferdinandy.com/2023/07/20/email-in-the-terminal-a-complete-guide-to-the-unix-way-of-email/#unifying-notmuch-account
>
> Unfortunately, this also requires an extra account, so doesn't solve the issue
> of replying with the appropriate account. I think this can be solved through
> templating. :reply takes an account flag (-A) which switches to the appropriate
> account before opening compose. You might be able to leverage To/Cc headers in
> a template to return the appropriate account name. Maybe something more clever
> could also work, there was also discussions of having a {{.FilePath}} variable,
> that could be explicitly used to check which account it belongs to without
> relying on header fields.

On second thought, probably currently, the most straightforward solution would
be to tag all messages with their account in notmuch, as that is readily
available as a template variable.
Details
Message ID
<CXZXLPM8ARSN.2CLVX4HDQAQ0L@stud.uni-goettingen.de>
In-Reply-To
<CXZ6F51GEVAW.1B44HAP36ZGYE@ferdinandy.com> (view parent)
DKIM signature
missing
Download raw message
On Wed Dec 27, 2023 at 3:13 PM CET, Bence Ferdinandy wrote:
> Hi Leon,

Hi!

> Indeed you can use notmuch for something similar, which is more
> flexible than your maildir setup (and imho, notmuch is extremely
> useful for searching)

Unfortunately, notmuch has a few drawbacks. First, it's yet another
tool I'd have to understand, configure and keep up with. I like to
keep the amount of moving parts low. Second, I am using multiple
different devices to access mail. Not all of them are Linux desktops,
some sync local maildirs, some just access the IMAP server and on
some I only access a subset of the accounts. I am not sure how well
notmuch can cope with that, but given that I don't really need the
advanced tagging and searching features, I am just using normal
mail folders which is working perfectly fine for me and syncs with
no issues between devices.

Although it just occured to me I might be able to hack mbsync into
collecting unread mail from the inboxen to a separate maildir.


-- 
Friendly greetings,
Leon Henrik Plickat
Details
Message ID
<CY08SDHJDC8D.1DIN8OVNIL2B3@ferdinandy.com>
In-Reply-To
<CXZXLPM8ARSN.2CLVX4HDQAQ0L@stud.uni-goettingen.de> (view parent)
DKIM signature
missing
Download raw message
On Thu Dec 28, 2023 at 12:31, Leon Henrik Plickat <leonhenrik.plickat@stud.uni-goettingen.de> wrote:
> On Wed Dec 27, 2023 at 3:13 PM CET, Bence Ferdinandy wrote:
> > Hi Leon,
>
> Hi!
>
> > Indeed you can use notmuch for something similar, which is more
> > flexible than your maildir setup (and imho, notmuch is extremely
> > useful for searching)
>
> Unfortunately, notmuch has a few drawbacks. First, it's yet another
> tool I'd have to understand, configure and keep up with. I like to
> keep the amount of moving parts low. Second, I am using multiple
> different devices to access mail. Not all of them are Linux desktops,
> some sync local maildirs, some just access the IMAP server and on
> some I only access a subset of the accounts. I am not sure how well
> notmuch can cope with that, but given that I don't really need the
> advanced tagging and searching features, I am just using normal
> mail folders which is working perfectly fine for me and syncs with
> no issues between devices.
>

Notmuch works on top of maildir, and if you don't use it's tagging features for
anything it basically gives you a search engine and a convenient overview of
all your (maildir) accounts. But yeah, it is an extra thing you need to
configure at least once.

In other news, I just sent a patch so you can access the full path of
a message. For me, this solves the issue of replying with the appropriate
account always. My mail is under /home/username/.mail/[account], so the
following command:

:reply -A {{index (.Filename | split ("/")) 4}}

always switches to the appropriate account on reply.

Best,
Bence



--
+36305425054
bence.ferdinandy.com
Ryan Gibb <ryan@freumh.org>
Details
Message ID
<CYHTIGA1UJ4T.1E3A8DMQIWOS6@freumh.org>
In-Reply-To
<CXZ6F51GEVAW.1B44HAP36ZGYE@ferdinandy.com> (view parent)
DKIM signature
fail
Download raw message
DKIM signature: fail
> :reply -A {{index (.Filename | split ("/")) 4}}

This works when replying, but in `aerc.conf` when I set
	column-to = {{index (.Filename | split ("/")) 4}}

I get an error when launching
	error: failed to load config: [ui:account=all].index-columns: template: column-to:1:2: executing "column-to" at <index (.Filename | split ("/")) 4>: error calling index: index out of range: 4

And trying just the filename displays the fullpath successfully
	column-to = {{.Filename}}

I'm on
	https://git.sr.ht/~rjarry/aerc/commit/430dd0022c92ee6cfca47b090aa7c558f7f54cb9

For the Filename/Filenames template from
	https://git.sr.ht/~rjarry/aerc/commit/930e50328c3a57faeec7fd23881e044257eda157

Could this be a bug?

Cheers,
-- Ryan
Details
Message ID
<8061c374-e2f5-49c0-9956-ffe1b6f77dc6@ferdinandy.com>
In-Reply-To
<CYHTIGA1UJ4T.1E3A8DMQIWOS6@freumh.org> (view parent)
DKIM signature
missing
Download raw message
2024. jan. 18. 13:07:25 Ryan Gibb <ryan@freumh.org>:

>> :reply -A {{index (.Filename | split ("/")) 4}}
>
> This works when replying, but in `aerc.conf` when I set
>     column-to = {{index (.Filename | split ("/")) 4}}
>
> I get an error when launching
>     error: failed to load config: [ui:account=all].index-columns: 
> template: column-to:1:2: executing "column-to" at <index (.Filename | 
> split ("/")) 4>: error calling index: index out of range: 4

Well, my initial guess would be that in fact there isn't an index 4? Can 
you check what happens if you ask for index 0, or just the split without 
indexing?

Best,
Bence
Details
Message ID
<CYI4CTZWSLC4.1K22BXMU7ZUY@cl.cam.ac.uk>
In-Reply-To
<CXZ6F51GEVAW.1B44HAP36ZGYE@ferdinandy.com> (view parent)
DKIM signature
pass
Download raw message
> Well, my initial guess would be that in fact there isn't an index 4?

That, to the best of my knowledge, is not the case (see below) unless
there was some message with no `.Filename` being returned somewhere?

> Can you check what happens if you ask for index 0

Yes, index 0 shows nothing in the column.

>or just the split without indexing?

This shoes something like:
	[ home ryan mail ryan@freumh.org Inbox new <id>]
Details
Message ID
<2300da69-f360-4a48-85f7-53d7dc28006f@ferdinandy.com>
In-Reply-To
<CYI4CTZWSLC4.1K22BXMU7ZUY@cl.cam.ac.uk> (view parent)
DKIM signature
missing
Download raw message
2024. jan. 18. 21:37:17 Ryan Gibb <ryan.gibb@cl.cam.ac.uk>:

>
>> Well, my initial guess would be that in fact there isn't an index 4?
>
> That, to the best of my knowledge, is not the case (see below) unless
> there was some message with no `.Filename` being returned somewhere?

I think it must be something like that. Maybe you could also try if index 
1 already has the same effect. But it seems to me that splitting and 
indexing work as intended, so it must be the input.


>
>> or just the split without indexing?
>
> This shoes something like:
>     [ home ryan mail ryan@freumh.org Inbox new <id>]

And when looking at it like this, do all messages look like this or can 
you see empty ones?

It could also be a race condition I guess, {{.Filename}} default value is 
an empty string. If it is indeed a racecondition, you could first check 
if Filename is empty and only split index 4 when it is not.
Details
Message ID
<CYI4U0ZV0FCL.3F3FIDYT4U8PO@cl.cam.ac.uk>
In-Reply-To
<2300da69-f360-4a48-85f7-53d7dc28006f@ferdinandy.com> (view parent)
DKIM signature
pass
Download raw message
On Thu Jan 18, 2024 at 8:48 PM GMT, Bence Ferdinandy wrote:
> 2024. jan. 18. 21:37:17 Ryan Gibb <ryan.gibb@cl.cam.ac.uk>:
> >> Well, my initial guess would be that in fact there isn't an index 4?
> >
> > That, to the best of my knowledge, is not the case (see below) unless
> > there was some message with no `.Filename` being returned somewhere?
>
> I think it must be something like that. Maybe you could also try if index 
> 1 already has the same effect. But it seems to me that splitting and 
> indexing work as intended, so it must be the input.

1 also has the same effect. And that makes sense.

> >> or just the split without indexing?
> >
> > This shoes something like:
> >     [ home ryan mail ryan@freumh.org Inbox new <id>]
>
> And when looking at it like this, do all messages look like this or can 
> you see empty ones?

They all look like this strangely!

There's no length function that could be used to process this
conditionally is there?

> It could also be a race condition I guess, {{.Filename}} default value is 
> an empty string. If it is indeed a racecondition, you could first check 
> if Filename is empty and only split index 4 when it is not.

Let me try this!
Details
Message ID
<CYI52LVEZJ5J.2294KP3WUZZD6@cl.cam.ac.uk>
In-Reply-To
<CYI4U0ZV0FCL.3F3FIDYT4U8PO@cl.cam.ac.uk> (view parent)
DKIM signature
pass
Download raw message
> > It could also be a race condition I guess, {{.Filename}} default value is 
> > an empty string. If it is indeed a racecondition, you could first check 
> > if Filename is empty and only split index 4 when it is not.
>
> Let me try this!

Ah, this worked!!
	column-to = {{if eq .Filename ""}}{{"na"}}{{else}}{{index (.Filename | split ("/")) 4}}{{end}}

I'm still not entirely sure what was going on here, but thanks for the
help :-)

Cheers,
-- Ryan
Details
Message ID
<0d786a43-8ea2-493f-881b-91d113673ed5@ferdinandy.com>
In-Reply-To
<CYI52LVEZJ5J.2294KP3WUZZD6@cl.cam.ac.uk> (view parent)
DKIM signature
missing
Download raw message
Cool!

2024. jan. 18. 22:10:40 Ryan Gibb <ryan.gibb@cl.cam.ac.uk>:

>>> It could also be a race condition I guess, {{.Filename}} default 
>>> value is
>>> an empty string. If it is indeed a racecondition, you could first 
>>> check
>>> if Filename is empty and only split index 4 when it is not.
>>
>> Let me try this!
>
> Ah, this worked!!
>     column-to = {{if eq .Filename ""}}{{"na"}}{{else}}{{index 
> (.Filename | split ("/")) 4}}{{end}}
>
> I'm still not entirely sure what was going on here, but thanks for the
> help :-)
>
> Cheers,
> -- Ryan
Reply to thread Export thread (mbox)