afewmail / afew

an initial tagging script for notmuch mail
ISC License
325 stars 98 forks source link

ListMailsFilter uses only the list-label #342

Open steelman opened 10 months ago

steelman commented 10 months ago

According to RFC2919 the part (up to the first .) that is used by the filter to create a tag is named list-label. Is there any technical reason (e.g. notmuch limitation) for not using the full list-id i.e. the text between < and >?

I am asking because I just turned it on and found out that I've got message form several lists named dev tagged together as lists/dev, which doesn't make sense.

GuillaumeSeren commented 10 months ago

Hey @steelman , that is a good question, before checking I'd said that it was intentional by design.

If you look at the code here

class ListMailsFilter(HeaderMatchingFilter):
    message = 'Tagging mailing list posts'
    query = 'NOT tag:lists'
    pattern = r"<(?P<list_id>[a-z0-9!#$%&'*+/=?^_`{|}~-]+)\."
    header = 'List-Id'
    tags = ['+lists', '+lists/{list_id}']

You can see it adds 2 tags (lists, lists/mylist).

I am asking because I just turned it on and found out that I've got message form several lists named dev tagged together as lists/dev, which doesn't make sense.

I have some like that too, in those case if I want to tag them out nicely, I'll use the filter module like so (documentation: configuration and filters) (I think the filter documentation need a good upgrade)

[Filter.37]
message = MyList/dev
query = from:'my-list-dev@list.mylist.net>'
tags = +myilst;+important