<<< Date Index >>>     <<< Thread Index >>>

Re: Default groups



It turned out to be easy to add the default group feature I proposed, so
here's a patch to do so.

>>> Dan
-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
--- init.h.orig Wed Jan 16 00:00:05 2008
+++ init.h      Wed Mar 19 18:06:55 2008
@@ -3186,7 +3186,7 @@
 static int parse_unalternates (BUFFER *, BUFFER *, unsigned long, BUFFER *);
 
 /* Parse -group arguments */
-static int parse_group_context (group_context_t **ctx, BUFFER *buf, BUFFER *s, 
unsigned long data, BUFFER *err);
+static int parse_group_context (group_context_t **ctx, BUFFER *buf, BUFFER *s, 
unsigned long data, BUFFER *err, const char *defgroup);
 
 
 struct command_t
--- init.c.orig Tue Sep 18 00:00:06 2007
+++ init.c      Wed Mar 19 17:44:39 2008
@@ -696,7 +696,7 @@
   {
     mutt_extract_token (buf, s, 0);
 
-    if (parse_group_context (&gc, buf, s, data, err) == -1)
+    if (parse_group_context (&gc, buf, s, data, err, "_alternates") == -1)
       goto bail;
 
     remove_from_rx_list (&UnAlternates, buf->data);
@@ -837,7 +837,7 @@
   {
     mutt_extract_token (buf, s, 0);
     
-    if (parse_group_context (&gc, buf, s, data, err) == -1)
+    if (parse_group_context (&gc, buf, s, data, err, "_lists") == -1)
       goto bail;
     
     remove_from_rx_list (&UnMailLists, buf->data);
@@ -872,7 +872,7 @@
   do 
   {
     mutt_extract_token (buf, s, 0);
-    if (parse_group_context (&gc, buf, s, data, err) == -1)
+    if (parse_group_context (&gc, buf, s, data, err, "_group") == -1)
       goto bail;
     
     if (!mutt_strcasecmp (buf->data, "-rx"))
@@ -1212,7 +1212,7 @@
   {
     mutt_extract_token (buf, s, 0);
 
-    if (parse_group_context (&gc, buf, s, data, err) == -1)
+    if (parse_group_context (&gc, buf, s, data, err, "_subscribe") == -1)
       goto bail;
     
     remove_from_rx_list (&UnMailLists, buf->data);
@@ -1313,7 +1313,7 @@
 
   mutt_extract_token (buf, s, 0);
 
-  if (parse_group_context (&gc, buf, s, data, err) == -1)
+  if (parse_group_context (&gc, buf, s, data, err, "_alias") == -1)
     return -1;
   
   /* check to see if an alias with this name already exists */
@@ -3113,8 +3113,13 @@
   return 0;
 }
 
-static int parse_group_context (group_context_t **ctx, BUFFER *buf, BUFFER *s, 
unsigned long data, BUFFER *err)
+static int parse_group_context (group_context_t **ctx, BUFFER *buf, BUFFER *s, 
unsigned long data, BUFFER *err, const char *defgroup)
 {
+  if (mutt_strcasecmp (buf->data, "-group"))
+  {
+    mutt_group_context_add (ctx, mutt_pattern_group (defgroup));
+  }
+
   while (!mutt_strcasecmp (buf->data, "-group"))
   {
     if (!MoreArgs (s)) 
--- manual.xml.head.orig        Wed Dec 12 00:00:05 2007
+++ manual.xml.head     Thu Mar 20 10:32:49 2008
@@ -1558,11 +1558,12 @@
 in any order. The flags <literal>-rx</literal> and
 <literal>-addr</literal> specify what the following strings (that cannot
 begin with a hyphen) should be interpreted as: either a regular
-expression or an email address, respectively.
+expression or an email address, respectively.  If the <literal>-group</literal>
+flag is not provided, the group name ``_group'' is used.
 </para>
 
 <para>
-These address groups can also be created implicitely by the
+These address groups can also be created implicitly by the
 <link linkend="alias">alias</link>, <link linkend="lists">lists</link>,
 <link linkend="lists">subscribe</link> and
 <link linkend="alternates">alternates</link> commands by specifying the
@@ -1610,7 +1611,8 @@
 <para>
 The optional <literal>-group</literal> argument to
 <literal>alias</literal> causes the aliased address(es) to be added to
-the named <emphasis>group</emphasis>.
+the named <emphasis>group</emphasis>.  If the <literal>-group</literal>
+flag is not provided, the group name ``_alias'' is used.
 </para>
 
 <para>
@@ -2399,7 +2401,8 @@
 
 <para>
 The <literal>-group</literal> flag causes all of the subsequent regular 
expressions
-to be added to the named group.
+to be added to the named group. If the flag is not provided, the group
+name ``_alternates'' is used.
 </para>
 
 <para>
@@ -2475,7 +2478,8 @@
 
 <para>
 The <literal>-group</literal> flag adds all of the subsequent regular 
expressions
-to the named group.
+to the named group. If the flag is not provided, the group name ``_lists''
+or ``_subscribe'' is used, depending on the command.
 </para>
 
 <para>