]> granicus.if.org Git - neomutt/commitdiff
Allow "unsubjectrc *" to remove all patterns.
authorKevin McCarthy <kevin@8t8.us>
Tue, 24 Jan 2017 23:33:23 +0000 (15:33 -0800)
committerKevin McCarthy <kevin@8t8.us>
Tue, 24 Jan 2017 23:33:23 +0000 (15:33 -0800)
Thanks to Aaron Schrab for the original patch.

doc/manual.xml.head
init.c

index 14a190b46ac0c4dfb19115f446bbd0385cad3bc6..44e38082e678973f8519de35e41d6ca5dda27f65 100644 (file)
@@ -6098,9 +6098,14 @@ that either is reproduced elsewhere, or is of secondary interest.
 </arg>
 
 <command>unsubjectrx</command>
+<group choice="req">
+<arg choice="plain">
+<replaceable class="parameter">*</replaceable>
+</arg>
 <arg choice="plain">
 <replaceable class="parameter">pattern</replaceable>
 </arg>
+</group>
 </cmdsynopsis>
 
 <para>
@@ -6121,8 +6126,9 @@ entire subject, not just the match!
 </para>
 
 <para>
-<literal>unsubjectrx</literal> removes a given subjectrx from the substitution
-list.
+<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">
@@ -10062,13 +10068,18 @@ The following are the commands understood by Mutt:
 <replaceable class="parameter">pattern</replaceable>
 </arg>
 <arg choice="plain">
-<replaceable class="parameter">format</replaceable>
+<replaceable class="parameter">replacement</replaceable>
 </arg>
 
 <command><link linkend="display-munging">unsubjectrx</link></command>
+<group choice="req">
+<arg choice="plain">
+<replaceable class="parameter">*</replaceable>
+</arg>
 <arg choice="plain">
 <replaceable class="parameter">pattern</replaceable>
 </arg>
+</group>
 </cmdsynopsis>
 </listitem>
 
diff --git a/init.c b/init.c
index cdbfb820a6391f45c636e6bf063ac64b80184c34..cf2813569189cf6a9e1721f0675f7430d366b4ac 100644 (file)
--- a/init.c
+++ b/init.c
@@ -801,6 +801,14 @@ static int parse_unreplace_list (BUFFER *buf, BUFFER *s, unsigned long data, BUF
   }
 
   mutt_extract_token(buf, s, 0);
+
+  /* "*" is a special case. */
+  if (!mutt_strcmp (buf->data, "*"))
+  {
+    mutt_free_replace_list (list);
+    return 0;
+  }
+
   remove_from_replace_list(list, buf->data);
   return 0;
 }