At 15:58 -0600 03 Jan 2011, David Champion <[email protected]> wrote:
Wow, I hadn't realized this had been posted that long ago.
This lets you define regular expressions-replacement pairs for subject display. When a Subject: matches the regular expression, the replacement value will be displayed instead in the message index. Backreferences are supported. This is especially nice for simplifying subjects that are overly wordy, such as mailing list posts (with [Listname] tags, etc), mail from ticketing systems or bug trackers, etc. It lets you reduce clutter in your mutt display without altering the messages themselves.
I've recently been considering moving my mail to a different provider, and so have been thinking about simplifying mail delivery. Right now the main complexity that I have for that is in removing list tags from subjects, so this capability would be a big help.
One issue that I see with how it's implemented is that there isn't a way to remove all replacement patterns of a given type. I want that so that I can have a folder hook that clears the list of subject replacements and then puts in just the ones for the new folder.
The attached patch adds support for using '*' as the pattern to remove to specify that all replacement pairs are to be cleared out. This matches what is already supported for commands like unhook and unalias. And since it isn't a valid regexp it shouldn't cause any compatibility issues.
commit b4270f0 Author: Aaron Schrab <[email protected]> Date: Sat Aug 10 21:34:44 2013 -0400 Allow removing all entries from replace lists Allow * to be used as the argument to unmailboxrx and unsubjectrx commands to remove all entries. This is useful for clearing the configuration before starting over while reconfiguring and for using hooks to have lists apply only in some situations such as in a single folder. diff --git a/init.c b/init.c index bc5fb1c..bd94288 100644 --- a/init.c +++ b/init.c @@ -543,6 +543,18 @@ static int remove_from_replace_list (REPLACE_LIST **list, const char *pat) cur = *list; if (!cur) return 0; + + if (!mutt_strcmp(pat, "*")) + { + while (cur) { + *list = cur->next; + mutt_free_regexp(&cur->rx); + FREE(&cur->template); + FREE(&cur); + } + return 0; + } + if (cur->rx && !mutt_strcmp(cur->rx->pattern, pat)) { *list = cur->next;
