Skip to content
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

--enable-filters not behaving as expected #306

Open
xaltsc opened this issue Mar 14, 2021 · 4 comments
Open

--enable-filters not behaving as expected #306

xaltsc opened this issue Mar 14, 2021 · 4 comments

Comments

@xaltsc
Copy link

xaltsc commented Mar 14, 2021

Hey,

Perhaps I misunderstood the documentation, but I've got this piece in my config, which should be minimal enough, and with the aim of using it not on new messages, but only on old messages.

[AllFilter(Filter)]
  tags_blacklist = new
  message = Running on all messages (allegedly)

[AllFilter.0]
  query = tag:archive or tag:killed or tag:sent
  tags = -inbox;-unread
  message = De-inboxing and reading archived, killed and sent messages

However, when running afew -d --tag --all -vv -e 'AllFilter' -R 100000000000000 -T 1000000000000000000000000, the output I get is this below, meaning that AllFilter.0 has not been taken into account.

INFO:afew.Settings.AllFilter:Running on all messages (allegedly)
DEBUG:root:Executing query ''

Note, however, that AllFilter.0 is run when dropping the -e option.

@xaltsc
Copy link
Author

xaltsc commented Mar 14, 2021

Defining the class in a Python file like below doesn't work either.

@register_filter
class AllFilter(Filter):
    message = 'Running on all messages (allegedly)'
    tags_blacklist = "new"

@GuillaumeSeren
Copy link
Collaborator

GuillaumeSeren commented Mar 14, 2021

Hey @xaltsc ,
welcome to the project.

the aim of using it not on new messages, but only on old messages

This can be done, by using a notmuch query (https://www.mankier.com/7/notmuch-search-terms#Date_and_Time_Search),
like:

# Select only the last year mails
$ afew --tag date:2Y..1Y

Defining the class in a Python file like below doesn't work either.

I suppose that's because it should be defined in the config file.

Please copy you config, that we can check it, try to call you filter without -R or -T but only notmuch query,
also please copy a verbose output (relevant part) of the afew call.

@mjg
Copy link
Contributor

mjg commented Feb 23, 2023

Old bug, but probably same root cause as I just encountered: selecting filters with -e does not seem to take the options from config into account. This is unfortunate if you want to run a newly configured filter on old e-mails.

@mjg
Copy link
Contributor

mjg commented Feb 23, 2023

And sure enough this is ussue #40 which I even commented on back then ... Oh well. I guess I don't need -e often, but when I do, I fall into the config trap.

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

No branches or pull requests

3 participants