hi everyone!
i really appreciate aerc and use it daily. however, i noticed one small
issue that i find somewhat annoying and wanted to know your thoughs on
before opening a ticket or some such.
when using the notmuch backend, flags such as the `SeenFlag` are mapped
to notmuch tags (in this case `unread`). however, the `RecentFlag` is
not mapped in `woker/notmuch/notmuch.go`. so aerc never considers any
messages in a notmuch setup as recent/new. this in turn means that the
`mail-received` hook is never triggered, as unread messages are always
considered old.
the proposal for RFC 3501 states for the recent flag:
> If it is not possible to determine whether or not this
> session is the first session to be notified about a message,
> then that message SHOULD be considered recent.
so i'd assume it should be fine to map a notmuch tag here, as we can't
know whether a mail is received by another session at that point anyway,
as far as i know.
i've added the following on top of the current master and it makes the
hook work again for me, with the below notmuch config:
```diff
diff --git a/worker/notmuch/notmuch.go b/worker/notmuch/notmuch.go
index 1d064fd2..014917d1 100644
--- a/worker/notmuch/notmuch.go+++ b/worker/notmuch/notmuch.go
@@ -10,6 +10,7 @@ var tagToFlag = map[string]models.Flags{
"replied": models.AnsweredFlag,
"draft": models.DraftFlag,
"flagged": models.FlaggedFlag,
+ "new": models.RecentFlag,}
var flagToTag = map[models.Flags]string{
@@ -17,6 +18,7 @@ var flagToTag = map[models.Flags]string{
models.AnsweredFlag: "replied",
models.DraftFlag: "draft",
models.FlaggedFlag: "flagged",
+ models.RecentFlag: "new",}
var flagToInvert = map[models.Flags]bool{
@@ -24,4 +26,5 @@ var flagToInvert = map[models.Flags]bool{
models.AnsweredFlag: false,
models.DraftFlag: false,
models.FlaggedFlag: false,
+ models.RecentFlag: false,}
```
notmuch config:
```
[new]
tags=unread;inbox;new;
```
`check-mail` script then untags read and old mail:
```
notmuch tag -new -- "(not tag:unread) or (not tag:7days..now)"
```
what i am not sure about is whether to map this to a specific tag,
whether that tag should be `new` or whether this should maybe be a
config option for the notmuch backend.
what do you think about adding something like this?
best,
stefan
Hi Stefan,
On Thu Feb 29, 2024 at 7:10 AM EST, Stefan Sterz wrote:
> notmuch tag -new -- "(not tag:unread) or (not tag:7days..now)"
Random question -- what does this "tag:7days..now" do?
> what i am not sure about is whether to map this to a specific tag,> whether that tag should be `new` or whether this should maybe be a> config option for the notmuch backend.>> what do you think about adding something like this?
I think it's reasonable to map the recent flag to something, and as
you've seen it's a simple change. I'd prefer user-configurable. It would
be nice to make the other ones configurable as well, although they at
least match what notmuch does with the maildir.synchronize_flags option.
Best,
Jason
On Fri Mar 1, 2024 at 1:35 AM CET, Jason Cox wrote:
> Hi Stefan,>> On Thu Feb 29, 2024 at 7:10 AM EST, Stefan Sterz wrote:> > notmuch tag -new -- "(not tag:unread) or (not tag:7days..now)">> Random question -- what does this "tag:7days..now" do?
oh whoops, that's a typo, should be `not date:7days..` or something like
that. so untag all messages that are older than 7 days.
> > what i am not sure about is whether to map this to a specific tag,> > whether that tag should be `new` or whether this should maybe be a> > config option for the notmuch backend.> >> > what do you think about adding something like this?>> I think it's reasonable to map the recent flag to something, and as> you've seen it's a simple change. I'd prefer user-configurable. It would> be nice to make the other ones configurable as well, although they at> least match what notmuch does with the maildir.synchronize_flags option.
alright, i am not super familiar with the codebase but i guess something
like this might make sense in the `accounts.conf` for notmuch accounts:
```
seen-tag = unread
answered-tag = replied
draft-tag = draft
flagged-tag = flagged
recent-tag =
```
maybe with the above values as default values, too? should i open a
ticket for this?
> Best,> Jason
On Fri Mar 1, 2024 at 3:22 PM CET, inwit wrote:
>>> On 01/03/2024, 13:30, Stefan Sterz wrote:> > ```> > seen-tag = unread> > answered-tag = replied> > draft-tag = draft> > flagged-tag = flagged> > recent-tag => > ```>> Should we add `passed-tag = forwarded`?
i guess we could, but im not sure what flag this should map onto in
aerc. the above would map all flags that `model/models.go` defines. i
guess it could be automatically set when forwarding mails, though?
my concern is mostly to get hooks, and, thus, notifications to work
again.
On Fri Mar 1, 2024 at 9:28 AM EST, Stefan Sterz wrote:
> On Fri Mar 1, 2024 at 3:22 PM CET, inwit wrote:> > On 01/03/2024, 13:30, Stefan Sterz wrote:> > > ```> > > seen-tag = unread> > > answered-tag = replied> > > draft-tag = draft> > > flagged-tag = flagged> > > recent-tag => > > ```> >> > Should we add `passed-tag = forwarded`?>> i guess we could, but im not sure what flag this should map onto in> aerc. the above would map all flags that `model/models.go` defines. i> guess it could be automatically set when forwarding mails, though?
Notmuch maps the passed flag to the tag 'passed' when
maildir.synchronize_flags is true, so I'd prefer that as a default. As
Stefan points out, we'd have to add support for flagging messages as
passed first, though.
We may also want to make the values in flagToInvert
(worker/notmuch/notmuch.go) configurable as well, or at least be
explicit in the docs that the seen-tag is treated differently. (When the
seen flag is added, we remove the unread tag; when the seen flag is
removed; we add the unread tag.)