Hi,
* Sadiq Al-Lawatia [02-06-27 10:53:30 +0200] wrote:
> Is there a way of getting %f to just display the mailbox
> name rather than the full pathname of it? I have mailboxes
> nested in sub-directories and the name run off off the
> screen, so having just the mailbox name would really make
> it helpful.
No, it isn't possible out of the box. I use a nntp patch
(vvv.nntp) and therefore the mailbox name fills my screen
with the username, server and group which was in most cases
about 30 to 40 characters on a terminal with 80 characters
per line...
To make it short: I've made a patch which adds '%B' to
status_format to print only the last portion of '%f'. It's
attached.
Just copy it to the directory with mutt sources and run:
'patch -p1 < status_format.diff'
Cheers, Rocco
diff -udrP mutt-1.4/init.h mutt-1.4.orig/init.h
--- mutt-1.4/init.h Thu Apr 25 15:26:37 2002
+++ mutt-1.4.orig/init.h Thu Jun 27 12:14:05 2002
@@ -2119,6 +2119,7 @@
** .pp
** .dl
** .dt %b .dd number of mailboxes with new mail *
+ ** .dt %B .dd short mailbox name without path
** .dt %d .dd number of deleted messages *
** .dt %h .dd local hostname
** .dt %f .dd the full pathname of the current mailbox
diff -udrP mutt-1.4/status.c mutt-1.4.orig/status.c
--- mutt-1.4/status.c Fri Mar 3 11:10:14 2000
+++ mutt-1.4.orig/status.c Thu Jun 27 12:14:05 2002
@@ -37,6 +37,7 @@
}
/* %b = number of incoming folders with unread messages [option]
+ * %B = short mailbox name without path
* %d = number of deleted messages [option]
* %f = full mailbox path
* %F = number of flagged messages [option]
@@ -76,6 +77,20 @@
optional = 0;
break;
+ case 'B':
+ snprintf (fmt, sizeof (fmt), "%%%ss", prefix);
+ if (Context && Context->path)
+ {
+ if ((p = strrchr (Context->path, '/')))
+ strfcpy (tmp, p + 1, sizeof (tmp));
+ else
+ strfcpy (tmp, Context->path, sizeof (tmp));
+ }
+ else
+ strfcpy (tmp, _("no mailbox"), sizeof (tmp));
+ snprintf (buf, buflen, fmt, tmp);
+ break;
+
case 'd':
if (!optional)
{