I use a mix of mutt
and Thunderbird to read mail. Thunderbird uses directories named with
an extension .sbd
appended to the folder name. However,
for each folder directory folder.sbd
there are also files
folder
and folder.msf
. I've found it a pain
to navigate these with mutt because filename completion for
fo
, for example, might complete to folder
but
I really want it to comlpete to the correctdirectory name
folder.sbd
. The short
patch below looks for .sbd
directories to complete to:
--- a/complete.c Mon Jul 16 10:46:49 2007 -0700 +++ b/complete.c Thu Nov 15 00:18:21 2007 -0500 @@ -186,10 +186,22 @@ int mutt_complete (char *s, size_t slen) if (dirpart[0]) { + char buf[_POSIX_PATH_MAX]; + struct stat st; + strfcpy (s, dirpart, slen); if (mutt_strcmp ("/", dirpart) != 0 && dirpart[0] != '=' && dirpart[0] != '+') strfcpy (s + strlen (s), "/", slen - strlen (s)); strfcpy (s + strlen (s), filepart, slen - strlen (s)); + + /* complete to xxx.sbd instead of xxx if it exists and is a directory */ + strfcpy (buf, exp_dirpart, sizeof (buf)); + strfcpy (buf + strlen (buf), "/", sizeof (buf) - strlen (buf)); + strfcpy (buf + strlen (buf), filepart, sizeof(buf) - strlen (buf)); + strfcpy (buf + strlen (buf), ".sbd", sizeof (buf) - strlen (buf)); + if (stat (buf, &st) != -1 && (st.st_mode & S_IFDIR)) + strfcpy (s + strlen (s), ".sbd/", slen - strlen (s)); + } else strfcpy (s, filepart, slen);
I have used this with the current stable (1.4.2.3) and development releases (1.5.17) as of 2007-11-15. Application should be a simple matter of:
simeon@ice mutt-1.5.17>cat ../mutt_sbd_patch_2007-11-15 | patch -p1 patching file complete.c simeon@ice mutt-1.5.17>./configure ... simeon@ice mutt-1.5.17>make ... simeon@ice mutt-1.5.17>sudo make install
(I offer this patch under the same GPL terms as mutt.)
Cheers,
Simeon