I've been using this patch in my build for quite a while now (from the logs in my dotfiles repo it looks like a bit over 3 years) and it's been working well for me. I have added the attached patch on top to allow me to use folder-hooks to change the replacements in use.
commit 2de07b2
Author: Aaron Schrab <aa...@schrab.com>
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/doc/manual.xml.head b/doc/manual.xml.head
index 435f303..2e3027b 100644
--- a/doc/manual.xml.head
+++ b/doc/manual.xml.head
@@ -6058,6 +6058,7 @@ entire subject, not just the match!
 <para>
 <literal>unsubjectrx</literal> removes a given subjectrx from the substitution
 list.
+If <literal>*</literal> is used as the pattern, all substitutions will be removed.
 </para>
 
 <example id="ex-subjectrx">
diff --git a/init.c b/init.c
index b1a1c4c..c9f4ec2 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;

Attachment: signature.asc
Description: PGP signature

Reply via email to