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

Re: Change of "important" character



On Thu, Oct 06, 2005 at 03:59:42AM -0400, Parv wrote:
> Could somebody please tell me which file(s) to i have to touch in
> source in order to change the "important" character from "!" to
> something thicker?

I've been using this related patch for years.  Instead of making it
bigger, I put it in its own column, so that it really stands out.
To use, replace %Z in hdr_format with something like %/!*/%.2Z%T.

Is there any interest in this patch, which makes all the flags more
configurable?  It was ignored the last time I posted it and I haven't
gotten around to refreshing it lately.

-- 
Daniel Jacobowitz
CodeSourcery, LLC
Index: mutt/hdrline.c
===================================================================
--- mutt.orig/hdrline.c 2005-08-25 13:03:13.000000000 -0400
+++ mutt/hdrline.c      2005-08-25 13:08:01.000000000 -0400
@@ -193,6 +193,55 @@
   return h->recipient;
 }
 
+static char choose_indicator_letter(const char *letters, int llen, HEADER 
*hdr, CONTEXT *ctx)
+{
+  int threads = ((Sort & SORT_MASK) == SORT_THREADS);
+  int i;
+  char ch = 0, op;
+
+#define THREAD_NEW (threads && hdr->collapsed && hdr->num_hidden > 1 && 
mutt_thread_contains_unread (ctx, hdr) == 1)
+#define THREAD_OLD (threads && hdr->collapsed && hdr->num_hidden > 1 && 
mutt_thread_contains_unread (ctx, hdr) == 2)
+
+  for (i = 0; (i < llen) && !ch; i++)
+    {
+      op = letters[i];
+
+      if (op == 'D' && hdr->deleted)
+       ch = 'D';
+      else if (op == 'd' && hdr->attach_del)
+       ch = 'd';
+      else if (op == '*' && hdr->tagged)
+       ch = '*';
+      else if (op == '!' && hdr->flagged)
+       ch = '!';
+      else if (op == 'r' && hdr->replied)
+       ch = 'r';
+      else if (op == '-' && hdr->read && (ctx && ctx->msgnotreadyet != 
hdr->msgno))
+       ch = '-';
+      else if (op == 'O' && hdr->old)
+       ch = 'O';
+      else if (op == 'o' && THREAD_OLD)
+       ch = 'o';
+      else if (op == 'N' && !hdr->old && !(hdr->read && (ctx && 
ctx->msgnotreadyet != hdr->msgno)))
+       ch = 'N';
+      else if (op == 'n' && THREAD_NEW)
+       ch = 'n';
+      else if (op == 'T')
+       {
+         if (Tochars && ((i = mutt_user_is_recipient (hdr)) < mutt_strlen 
(Tochars)))
+           if (Tochars[i] != ' ')
+             ch = Tochars[i];
+       }
+    }
+
+  if (!ch)
+    ch = ' ';
+
+  return ch;
+#undef THREAD_NEW
+#undef THREAD_OLD
+}
+
 /* %a = address of author
  * %A = reply-to address (if present; otherwise: address of author
  * %b = filename of the originating folder
@@ -691,6 +740,24 @@
 
       break;
 
+    case '/':
+      {
+       const char *cp;
+
+       /* extract the specifier string */
+       cp = strchr (src, '/');
+       if (! *cp)
+         {
+           snprintf (dest, destlen, "%%%s%c", prefix, op);
+           break;
+         }
+       buf2[0] = choose_indicator_letter (src, cp - src, hdr, ctx);
+       buf2[1] = '\0';
+       mutt_format_s (dest, destlen, prefix, buf2);
+       src = cp + 1;
+       break;
+      }
+
     default:
       snprintf (dest, destlen, "%%%s%c", prefix, op);
       break;
Index: mutt/init.h
===================================================================
--- mutt.orig/init.h    2005-08-25 13:04:02.000000000 -0400
+++ mutt/init.h 2005-08-25 13:07:16.000000000 -0400
@@ -1012,9 +1012,15 @@
   **                function ``strftime''; a leading bang disables locales.
   ** .dt %>X    .dd right justify the rest of the string and pad with 
character "X"
   ** .dt %|X    .dd pad to the end of the line with character "X"
+  ** .dt %/fmt/ .dd the first of an arbitrary group of status flags to apply to
+  **               the current message, or a space if none applies: 
Dd*!-OoNnrT,
+  **               respectively: deleted, deleted attachment, tagged, flagged, 
read, old,
+  **               collapsed thread containing old, new, collapsed thread 
containing
+  **               new, replied to, and to.  ``T'' us unique in that it 
expands as
+  **               %T ($$to_chars) instead of as the literal letter T.
   ** .de
   ** .pp
-  ** See also: ``$$to_chars''.
+  ** See also: $$to_chars.
   */
   { "ispell",          DT_PATH, R_NONE, UL &Ispell, UL ISPELL },
   /*