Re: What's needed for mutt 1.6?
On Thu, 22 Feb 2007 the mental interface of
Brendan Cully told:
> 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).
http://greek0.net/patches/mutt-1.5.12-indexcolor-3+cb.diff
Update for 1.5.13 get from debian repo
http://lunar-linux.org/~tchan/mutt/patch-1.5.13.sidebar.20061023.txt
In Addition:
ak.sidebar-shortenname.diff (attached)
nion.sidebar-color.diff (atached)
THX
Elimar
--
"Talking much about oneself can also
be a means to conceal oneself."
-Friedrich Nietzsche
Index: mutt/mutt.h
===================================================================
--- mutt.orig/mutt.h 2007-01-03 13:34:34.000000000 +0100
+++ mutt/mutt.h 2007-01-03 13:34:59.000000000 +0100
@@ -450,6 +450,7 @@
OPTSAVENAME,
OPTSCORE,
OPTSIDEBAR,
+ OPTSIDEBARSHORTEN,
OPTSIGDASHES,
OPTSIGONTOP,
OPTSORTRE,
Index: mutt/sidebar.c
===================================================================
--- mutt.orig/sidebar.c 2007-01-03 13:34:50.000000000 +0100
+++ mutt/sidebar.c 2007-01-03 13:34:59.000000000 +0100
@@ -125,10 +125,44 @@
}
}
+static char * find_next_after_delim(char * buf, char * delimchars) {
+ while (buf[0] != '\0' && strchr(delimchars,buf[0])==NULL)
+ ++buf;
+ if (buf[0] == '\0')
+ return NULL;
+ return buf+1;
+}
+
+static char * sidebar_shorten_name(char * buf, size_t bufsize, char * boxname)
{
+/* TODO: check bufsize!! */
+ char * p1, * p2;
+ buf[0] = '\0';
+ p1 = boxname;
+#ifdef USE_IMAP
+ p2 = find_next_after_delim(p1+1,ImapDelimChars);
+#else
+ p2 = find_next_after_delim(p1+1,".");
+#endif
+ while (p2) {
+ strncat(buf,p1,1);
+ strcat(buf,".");
+ p1 = p2;
+#ifdef USE_IMAP
+ p2 = find_next_after_delim(p1+1,ImapDelimChars);
+#else
+ p2 = find_next_after_delim(p1+1,".");
+#endif
+ }
+ strcat(buf,p1);
+ return buf;
+}
+
int draw_sidebar(int menu) {
int lines = option(OPTHELP) ? 1 : 0;
BUFFY *tmp;
+ char * box_name;
+ char shortened_boxname[SHORT_STRING];
#ifndef USE_SLANG_CURSES
attr_t attrs;
#endif
@@ -233,8 +267,31 @@
tmp->msg_unread = Context->unread;
tmp->msgcount = Context->msgcount;
}
+
+ box_name = basename(tmp->path);
+
+#ifdef USE_IMAP
+# define DELIM_CHARS ImapDelimChars
+#else
+# define DELIM_CHARS "."
+#endif
+
+ if (SidebarRemovePrefix) {
+ if (strlen(box_name) > strlen(SidebarRemovePrefix) &&
+
strncmp(box_name,SidebarRemovePrefix,strlen(SidebarRemovePrefix))==0 &&
+ DELIM_CHARS &&
strchr(DELIM_CHARS,box_name[strlen(SidebarRemovePrefix)])!=NULL) {
+ box_name += strlen(SidebarRemovePrefix) + 1;
+ }
+ }
+
+#undef DELIM_CHARS
+
+ if (option(OPTSIDEBARSHORTEN)) {
+ box_name =
sidebar_shorten_name(shortened_boxname,sizeof(shortened_boxname),box_name);
+ }
+
printw( "%.*s", SidebarWidth - delim_len + 1,
- make_sidebar_entry(basename(tmp->path), tmp->msgcount,
+ make_sidebar_entry(box_name, tmp->msgcount,
tmp->msg_unread));
lines++;
}
Index: mutt/globals.h
===================================================================
--- mutt.orig/globals.h 2007-01-03 13:34:44.000000000 +0100
+++ mutt/globals.h 2007-01-03 13:34:59.000000000 +0100
@@ -126,6 +126,7 @@
WHERE char *Sendmail;
WHERE char *Shell;
WHERE char *SidebarDelim;
+WHERE char *SidebarRemovePrefix;
WHERE char *Signin;
WHERE char *Signature;
WHERE char *Signoff;
Index: mutt/init.h
===================================================================
--- mutt.orig/init.h 2007-01-03 13:34:44.000000000 +0100
+++ mutt/init.h 2007-01-03 13:34:59.000000000 +0100
@@ -1677,6 +1677,18 @@
** .pp
** The width of the sidebar.
*/
+ { "sidebar_remove_prefix", DT_STR, R_BOTH, &SidebarRemovePrefix, 0 },
+ /*
+ ** .pp
+ ** If set, the prefix will be removed from the sidebar entry (if found).
+ */
+ { "sidebar_shorten_hierarchy", DT_BOOL, R_BOTH, OPTSIDEBARSHORTEN, 0 },
+ /*
+ ** .pp
+ ** If true, long box names will be shortened by hierarchy, e.g.
+ ** de.alt.sysadmin.recovery becomes d.a.s.recovery.
+ ** Useful for newsgroups.
+ */
{ "smime_is_default", DT_BOOL, R_NONE, OPTSMIMEISDEFAULT, 0},
/*
** .pp
Index: mutt/PATCHES
===================================================================
--- mutt.orig/PATCHES 2007-01-03 13:34:50.000000000 +0100
+++ mutt/PATCHES 2007-01-03 13:34:59.000000000 +0100
@@ -1,3 +1,4 @@
+ak.sidebar-shortenname
nion.sidebar-color
ak.umask
patch-1.5.13.sidebar.20061023.txt
Index: sidebar.c
===================================================================
--- sidebar.c.orig 2006-10-30 16:29:58.000000000 +0100
+++ sidebar.c 2006-10-31 08:52:51.000000000 +0100
@@ -85,7 +85,7 @@
static char *entry = 0;
char *c;
int i = 0;
- int delim_len = strlen(SidebarDelim);
+ int delim_len = strlen(NONULL(SidebarDelim));
c = realloc(entry, SidebarWidth - delim_len + 2);
if ( c ) entry = c;
@@ -132,7 +132,7 @@
#ifndef USE_SLANG_CURSES
attr_t attrs;
#endif
- short delim_len = strlen(SidebarDelim);
+ short delim_len = strlen(NONULL(SidebarDelim));
short color_pair;
static bool initialized = false;
@@ -187,22 +187,26 @@
}
/* get attributes for divider */
- SETCOLOR(MT_COLOR_STATUS);
+ SETCOLOR(MT_COLOR_SIDEBAR);
#ifndef USE_SLANG_CURSES
attr_get(&attrs, &color_pair, 0);
#else
color_pair = attr_get();
#endif
- SETCOLOR(MT_COLOR_NORMAL);
+ /* SETCOLOR(MT_COLOR_SIDEBAR); */
/* draw the divider */
for ( ; lines < LINES-1-(menu != MENU_PAGER || option(OPTSTATUSONTOP));
lines++ ) {
move(lines, SidebarWidth - delim_len);
- addstr(NONULL(SidebarDelim));
-#ifndef USE_SLANG_CURSES
- mvchgat(lines, SidebarWidth - delim_len, delim_len, 0,
color_pair, NULL);
-#endif
+ if (option (OPTASCIICHARS))
+ addstr (NONULL (SidebarDelim));
+ else if (!option (OPTASCIICHARS) && !strcmp
(NONULL(SidebarDelim), "|"))
+ addch (ACS_VLINE);
+ else if ((Charset_is_utf8) && !strcmp (NONULL(SidebarDelim),
"|"))
+ addstr ("\342\224\202");
+ else
+ addstr (NONULL (SidebarDelim));
}
if ( Incoming == 0 ) return 0;
Index: color.c
===================================================================
--- color.c.orig 2006-10-30 16:29:58.000000000 +0100
+++ color.c 2006-10-31 08:52:39.000000000 +0100
@@ -94,6 +94,7 @@
{ "underline", MT_COLOR_UNDERLINE },
{ "index", MT_COLOR_INDEX },
{ "sidebar_new", MT_COLOR_NEW },
+ { "sidebar", MT_COLOR_SIDEBAR },
{ NULL, 0 }
};
@@ -143,6 +144,7 @@
/* set some defaults */
ColorDefs[MT_COLOR_STATUS] = A_REVERSE;
+ ColorDefs[MT_COLOR_SIDEBAR] = A_REVERSE;
ColorDefs[MT_COLOR_INDICATOR] = A_REVERSE;
ColorDefs[MT_COLOR_SEARCH] = A_REVERSE;
ColorDefs[MT_COLOR_MARKERS] = A_REVERSE;
Index: mutt_curses.h
===================================================================
--- mutt_curses.h.orig 2006-10-30 16:29:58.000000000 +0100
+++ mutt_curses.h 2006-10-31 08:52:39.000000000 +0100
@@ -125,6 +125,7 @@
MT_COLOR_ATTACHMENT,
MT_COLOR_SEARCH,
MT_COLOR_BOLD,
+ MT_COLOR_SIDEBAR,
MT_COLOR_UNDERLINE,
MT_COLOR_INDEX,
MT_COLOR_NEW,
Index: PATCHES
===================================================================
--- PATCHES.orig 2006-10-30 16:29:58.000000000 +0100
+++ PATCHES 2006-10-31 08:52:40.000000000 +0100
@@ -1,3 +1,4 @@
+nion.sidebar-color
ak.umask
patch-1.5.13.sidebar.20061023.txt
ak.fullname-scoring