Topic: Mutt mbox display

This one is embarrassing as I'm sure the answer is there somewhere, but I can't find it.

I have both muttng and mutt-devel-lite on my machine.  The mutt-devel-lite displays each mbox size in KB, while muttng displays it in bytes.  (I think mutt-devel-lite used to do the same thing till a recent upgrade.)

I thought that the KB display was rather nice.  I decided to do the same thing for muttng, which I use more frequently.  However, there doesn't seem to be any default difference in the /usr/local/etc/Muttngrc and /usr/local/etc/Muttng files.  I did my googling and RTFM-ing, and thought it might have to do with folder_format or index_format, but both of those are identical, and actually, from what I can figure out from the manual, should both display size in bytes, rather than KB's. 

I even tried renaming both my default systemwide rc files and $HOME rc files to see if the difference was in one of them, but it isn't.  I looked at recent changes on the mutt home page to see if it was mentioned there (as I said, I believe this only happened after a recent upgrade). 

Anyway, if anyone knows how to do this, I'd be grateful.  I'm not sure what index_format or folder_format variable to change--one shows %s as default and the other %8s as default, on both mutt-devel-lite and mutt-ng.

<@andre> i would be so much more efficient if i wasn't so stupid

Re: Mutt mbox display

I had a quick look at the source, and could found no code to do what you want. However, while there I saw that it was a trivial 30 second matter to whip up a patch that adds the desired functionality:

--- muttng-20061125.orig/browser.c    Sun Oct  9 12:54:48 2005
+++ muttng-20061125/browser.c    Sun Jul  1 13:19:56 2007
@@ -298,6 +298,15 @@
       mutt_format_s (dest, destlen, fmt, "");
     break;
 
+  case 'S':
+    if (folder->ff->st != NULL) {
+      snprintf (tmp, sizeof (tmp), "%%%sldk", fmt);
+      snprintf (dest, destlen, tmp, (long) (folder->ff->st->st_size/1024));
+    }
+    else
+      mutt_format_s (dest, destlen, fmt, "");
+    break;
+
   case 't':
     snprintf (tmp, sizeof (tmp), "%%%sc", fmt);
     snprintf (dest, destlen, tmp, folder->ff->tagged ? '*' : ' ');

Now you can use %S in place of %s for folder_format, and you'll get something like "4k" instead of "4237". If you don't like the k and would prefer KB or nothing instead, just replace the k in the third +-prefixed line of the patch, where it says "sldk" (leave the sld part untouched though).

Re: Mutt mbox display

You are the man!   I will take a deeper look at this today.

Thank you, as always.

<@andre> i would be so much more efficient if i wasn't so stupid

Re: Mutt mbox display

Update--I tried it with the patch and it worked.  Thanks, that was pretty neat.

<@andre> i would be so much more efficient if i wasn't so stupid