From: epg <> Date: Fri, 18 Nov 2005 23:03:54 +0000 (+0000) Subject: Support custom sorting of folders in the .folders file. X-Git-Url: https://diplodocus.org/git/minc/commitdiff_plain/16099af33018947e46272d02333a0819f2223fca?ds=sidebyside Support custom sorting of folders in the .folders file. --- diff --git a/minc b/minc index 3011834..0db88cf 100755 --- a/minc +++ b/minc @@ -173,6 +173,13 @@ our $SCAN_P_FOLDER = 0.1; our $SCAN_P_MESSAGE = 0.0625; our $SCAN_P_FROM = 0.175; +our $folder_sorter = + sub { my ($a,$b) = @_; + $a eq 'inbox' and return -1; + $b eq 'inbox' and return 1; + return $a cmp $b; +}; + my $mh; $mh = `mhpath +`; @@ -620,9 +627,7 @@ sub update_folders { return; } - print($fh "inbox\n"); - for my $folder (sort(keys(%$folders))) { - $folder eq 'inbox' and next; + for my $folder (sort { $folder_sorter->($a,$b) } keys(%$folders)) { print($fh "$folder\n"); }