Skip to content

FolderNameFilter: allow multiple tags per folder #343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mjg
Copy link
Contributor

@mjg mjg commented Feb 28, 2024

So far, the last entry wins when a folder is specified multiple times as a folder transform. The reason is that the folder name is a key in a dict whose values are tags. On the other hand, if a message has copies in several folders then all these rules apply.

Change (fix?) afew's FolderNameFilter so that multiple transforms for the same folder lead to multiple tags being added. Technically, this is done by using sets as values in the transform dict.

In the future, we might think about implementing notmuch-tag style notation (with the obvious quoting issues).

@mjg
Copy link
Contributor Author

mjg commented Feb 28, 2024

FTR: CI runs stone age notmuch (0.29) against py 3.12 which is doomed to fail. The fix for ConfigParser in py 3.12 is in the latest notmuch 0.38 only.

@mjg mjg force-pushed the multiple-folder-name-transforms branch from 8edec78 to f67f100 Compare July 17, 2024 12:19
@GuillaumeSeren
Copy link
Collaborator

Hey @mjg
Thank you for this patch.

I feel this use case is a bit unclear to me, can you detail a bit how this could append ?

@mjg
Copy link
Contributor Author

mjg commented Mar 23, 2025

Hey @mjg Thank you for this patch.

I feel this use case is a bit unclear to me, can you detail a bit how this could append ?

Sure, I didn't meet my own standard on commit messages, sorry :-)

Here's the why: Say, I have accounts Work and Pleasure whose mail ends up in subdirs of directories Work and Pleasure (not that some work couldn't be pleasure, but ...). I want to tag mail by account (for easy display), but also tag sent mail as sent even with clients which just put sent mail in the Sent folder. Thus, my afew config is:

[FolderNameFilter]
folder_explicit_list = Work/Sent Pleasure/Sent
folder_transforms = Work/Sent:Work Work/Sent:sent Pleasure/Sent:Pleasure Pleasure/Sent:sent

and of course more for other folders.
If we had notmuch style config, I would say Work/Sent:"+Work +sent" Pleasure/Sent:"+Pleasure +sent", but we don't, that's why two rules are needed.

I know the account tag search is equivalent to a path search, but the tag is nice with clients which display it; besides, I can remove/replace the tag and have the MailMover move mail between accounts.

So far, the last entry wins when a folder is specified multiple times as
a folder transform. The reason is that the folder name is a key in a
dict whose values are tags. On the other hand, if a message has copies
in several folders then all these rules apply.

Change (fix?) afew's FolderNameFilter so that multiple transforms for
the same folder lead to multiple tags being added. Technically, this is
done by using sets as values in the transform dict.

In the future, we might think about implementing notmuch-tag style
notation (with the obvious quoting issues).
@mjg mjg force-pushed the multiple-folder-name-transforms branch from f67f100 to b9f69f7 Compare April 7, 2025 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants