On Thu, Feb 22, 2007 at 09:30:33AM -0800, Brendan Cully wrote:
> I intend to cut 1.5.14 this weekend. I'd like to make 1.5.15 the last
> proper dev release for 1.6 - that is, feature-freeze after
> 1.5.15. So, I'd like to hear once again which patches everyone would
> like to see in 1.6 (and which patches people object to).

I'm sorry I haven't gotten back to cleaning up my patch to add 'uncolor
body' and 'uncolor index' commands. I'd love to have it in 1.6. :)

(What I have now is attached, simply because I'm afraid if I'll forget
if I take the time to figure out how to use hg and then rediff.. :)
--- mutt-1.5.9/color.c.uncolor-body-header	2005-02-03 10:47:52.000000000 -0800
+++ mutt-1.5.9/color.c	2006-02-07 17:53:13.000000000 -0800
@@ -369,7 +369,8 @@
 			 short parse_uncolor)
 {
   int object = 0, do_cache = 0;
-  COLOR_LINE *tmp, *last = NULL;
+  char *list;
+  COLOR_LINE *which, *tmp, *last = NULL;
 
   mutt_extract_token (buf, s, 0);
 
@@ -379,11 +380,22 @@
     return (-1);
   }
 
-  if (mutt_strncmp (buf->data, "index", 5) != 0)
+  list = strdup(buf->data);
+  if (!list)
   {
     snprintf (err->data, err->dsize,
-	      _("%s: command valid only for index object"), 
-	      parse_uncolor ? "uncolor" : "unmono");
+	      _("%s: could not allocate storage for %.16s"),
+	      parse_uncolor ? "uncolor" : "unmono", buf->data);
+    return (-1);
+  }
+  if (!((mutt_strncmp (list, "index", 5) == 0) ||
+              (mutt_strncmp (list, "body", 4) ==0) ||
+              (mutt_strncmp (list, "header", 7) ==0)))
+  {
+    snprintf (err->data, err->dsize,
+	      _("%s: command valid only for index, body, header objects, not %.16s"), 
+	      parse_uncolor ? "uncolor" : "unmono", buf->data);
+    free(list);
     return (-1);
   }
   
@@ -391,6 +403,7 @@
   {
     snprintf (err->data, err->dsize,
 	      _("%s: too few arguments"), parse_uncolor ? "uncolor" : "unmono");
+    free(list);
     return (-1);
   }
 
@@ -413,16 +426,24 @@
       mutt_extract_token (buf, s, 0);
     while (MoreArgs (s));
 
+    free(list);
     return 0;
   }
      
   
+  if (mutt_strncmp(list, "index", 5) == 0)
+    which = ColorIndexList;
+  else if (mutt_strncmp(list, "body", 4) == 0)
+    which = ColorBodyList;
+  else if (mutt_strncmp(list, "header", 7) == 0)
+    which = ColorHdrList;
+
   do
   {
     mutt_extract_token (buf, s, 0);
     if (!mutt_strcmp ("*", buf->data))
     {
-      for (tmp = ColorIndexList; tmp; )
+      for (tmp = which; tmp; )
       {
         if (!do_cache)
 	  do_cache = 1;
@@ -430,22 +451,33 @@
 	tmp = tmp->next;
 	mutt_free_color_line(&last, parse_uncolor);
       }
-      ColorIndexList = NULL;
+      if (mutt_strncmp(list, "index", 5) == 0)
+        ColorIndexList = NULL;
+      else if (mutt_strncmp(list, "body", 4) == 0)
+        ColorBodyList = NULL;
+      else if (mutt_strncmp(list, "header", 7) == 0)
+        ColorHdrList = NULL;
     }
     else
     {
-      for (last = NULL, tmp = ColorIndexList; tmp; last = tmp, tmp = tmp->next)
+      for (last = NULL, tmp = which; tmp; last = tmp, tmp = tmp->next)
       {
 	if (!mutt_strcmp (buf->data, tmp->pattern))
 	{
           if (!do_cache)
 	    do_cache = 1;
-	  dprint(1,(debugfile,"Freeing pattern \"%s\" from ColorIndexList\n",
-	                       tmp->pattern));
+	  dprint(1,(debugfile,"Freeing pattern \"%s\" from \"%s\"\n",
+	                       tmp->pattern, list ? list : "NULL"));
 	  if (last)
 	    last->next = tmp->next;
-	  else
-	    ColorIndexList = tmp->next;
+	  else {
+	    if (mutt_strncmp(list, "index", 5) == 0)
+              ColorIndexList = tmp->next;
+	    else if (mutt_strncmp(list, "body", 4) == 0)
+              ColorBodyList = tmp->next;
+	    else if (mutt_strncmp(list, "header", 7) == 0)
+              ColorHdrList = tmp->next;
+	  }
 	  mutt_free_color_line(&tmp, parse_uncolor);
 	  break;
 	}
@@ -463,6 +495,7 @@
     for (i = 0; Context && i < Context->msgcount; i++)
       Context->hdrs[i]->pair = 0;
   }
+  free(list);
   return (0);
 }
 

Attachment: pgpC3sPJ7dyFx.pgp
Description: PGP signature

Reply via email to