Contents |
header cache Color Status |
This patch is based on work done my Michael Elkins. I looked at the patch and tried to understand what he did. After that I started to code the stuff from scratch. Some things are recycled from his code. Also the places where the maildir header cache interferes are the same like in Michael Elkins original patch. But I am using a different (hopefully more performant) mechanism to save/restore the header information. Also I try to save all of the header (not only what I have to to get it working somehow). However, there are some exceptions to this: The next, parts and hdr pointer in the struct body (header->content) are not saved and not restored.
@@ -596,16 +594,6 @@ h->index = -1; - if (magic == M_MAILDIR) - { - /* - * maildir stores its flags in the filename, so ignore the - * flags in the header of the message - */ - - h->old = is_old; - maildir_parse_flags (h, fname); - } return h; } return NULL; @@ -638,7 +626,7 @@
Another problem I was hitting is when I used ndbm on Solaris and Linux. I got 200 hits and over 19000 misses (!) when I opend a maildir box which should be cached completely. Same problem appeared with Michael Elkins original patch: I found an answer in the sun manpage of ndbm and dbm and often alone the content has over 1024 bytes in my case:
The sum of the sizes of a key/content pair must not exceed the internal block size (currently 1024 bytes). Moreover all key/content pairs that hash together must fit on a single block. dbm_store() will return an error in the event that a disk block fills with inseparable data.
There are two versions of the header cache available. The first is against *current* CVS HEAD. The second one is against the latest release. Use the appropiate! The header cache follows mutt CVS HEAD very closely. So if there get any new features into mutt which have an effect to the header cache, the header cache is immediately updated. Build instructions for CVS HEAD follow: # Password is anonymous cvs -d:pserver:anonymous@cvs.mutt.org:/home/roessler/cvs login cvs -d:pserver:anonymous@cvs.mutt.org:/home/roessler/cvs co mutt cd mutt wget -o /dev/null -O - http://wwwcip.informatik.uni-erlangen.de/~sithglan/mutt/mutt-cvs-header-cache.29 | patch -p1 ./prepare ./configure --enable-hcache ... make
folder-hook . 'set header_cache="/var/tmp/sithglan-hcache"' folder-hook 'Maildir$' 'set header_cache=""'
make[2]: Entering directory `/home/matt/twister/src/mutt-from-cvs' gcc -Wall -pedantic -g -O2 -o mutt patchlist.o addrbook.o alias.o attach.o base64.o browser.o buffy.o color.o crypt.o cryptglue.o commands.o complete.o compose.o copy.o curs_lib.o curs_main.o date.o edit.o enter.o flags.o init.o filter.o from.o getdomain.o handler.o hash.o hdrline.o headers.o help.o hook.o keymap.o main.o mbox.o menu.o mh.o mx.o pager.o parse.o pattern.o postpone.o query.o recvattach.o recvcmd.o rfc822.o rfc1524.o rfc2047.o rfc2231.o score.o send.o sendlib.o signal.o sort.o status.o system.o thread.o charset.o history.o lib.o muttlib.o editmsg.o utf8.o mbyte.o wcwidth.o url.o ascii.o mutt_idna.o crypt-mod.o pgp.o pgpinvoke.o pgpkey.o pgplib.o gnupgparse.o pgpmicalg.o pgppacket.o crypt-mod-pgp-classic.o smime.o crypt-mod-smime-classic.o resize.o account.o mutt_socket.o mutt_tunnel.o mutt_ssl.o md5c.o -Limap -limap -lncurses -lssl -lcrypto muttlib.o(.text+0xb8): In function `mutt_adv_mktemp': /home/matt/twister/src/mutt-from-cvs/muttlib.c:76: warning: the use of `mktemp' is dangerous, better use `mkstemp' mh.o(.text+0x188e): In function `maildir_delayed_parsing': /home/matt/twister/src/mutt-from-cvs/mh.c:806: undefined reference to `mutt_hcache_open' mh.o(.text+0x18b7):/home/matt/twister/src/mutt-from-cvs/mh.c:840: undefined reference to `mutt_hcache_close' mh.o(.text+0x18e5):/home/matt/twister/src/mutt-from-cvs/mh.c:813: undefined reference to `mutt_hcache_fetch' mh.o(.text+0x19c9):/home/matt/twister/src/mutt-from-cvs/mh.c:834: undefined reference to `mutt_hcache_store' mh.o(.text+0x19f2):/home/matt/twister/src/mutt-from-cvs/mh.c:828: undefined reference to `mutt_hcache_restore' mh.o(.text+0x28fb): In function `mh_sync_mailbox': /home/matt/twister/src/mutt-from-cvs/mh.c:1422: undefined reference to `mutt_hcache_close' mh.o(.text+0x29a3):/home/matt/twister/src/mutt-from-cvs/mh.c:1385: undefined reference to `mutt_hcache_delete' mh.o(.text+0x2a54):/home/matt/twister/src/mutt-from-cvs/mh.c:1449: undefined reference to `mutt_hcache_close' mh.o(.text+0x2a8c):/home/matt/twister/src/mutt-from-cvs/mh.c:1371: undefined reference to `mutt_hcache_open' imap/libimap.a(message.o)(.text+0x2f): In function `imap_read_headers': /home/matt/twister/src/mutt-from-cvs/imap/message.c:75: undefined reference to `mutt_hcache_open' imap/libimap.a(message.o)(.text+0x2d1):/home/matt/twister/src/mutt-from-cvs/imap/message.c:153: undefined reference to `mutt_hcache_fetch' imap/libimap.a(message.o)(.text+0x427):/home/matt/twister/src/mutt-from-cvs/imap/message.c:299: undefined reference to `mutt_hcache_close' imap/libimap.a(message.o)(.text+0x7ab):/home/matt/twister/src/mutt-from-cvs/imap/message.c:269: undefined reference to `mutt_hcache_store' imap/libimap.a(message.o)(.text+0x85d):/home/matt/twister/src/mutt-from-cvs/imap/message.c:282: undefined reference to `mutt_hcache_close' imap/libimap.a(message.o)(.text+0x87a):/home/matt/twister/src/mutt-from-cvs/imap/message.c:157: undefined reference to `mutt_hcache_restore' collect2: ld returned 1 exit status make[2]: *** [mutt] Error 1 make[2]: Leaving directory `/home/matt/twister/src/mutt-from-cvs' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/matt/twister/src/mutt-from-cvs' make: *** [all] Error 2This linking problem pops up when you forgot to call ./prepare *after* patching the sources. See above for exact instructions.
cd /usr/ports/mail/mutt/snapshot env FLAVOR="hcache" nice make install
I also managed to compile an hcache enabled mutt by myself:
Get sure that you isntalled automake-2.59 and gdbm using the ports tree. tar xfz mutt-1.5.6i.tar.gz cd mutt-1.5.6 export AUTOCONF_VERSION=2.59 export CFLAGS="-I/usr/include -I/usr/local/include -L/usr/local/lib" ./prepare --enable-hcache --disable-iconv # Verify That your mutt is hcache enabled: strings mutt | grep sithglan sithglan@stud.uni-erlangen.de[sithglan]|hcache.c|20040928175752|08278
I installed mutt 1.5.6-r2 on gentoo, a package which includes the maildir header caching patch. The output of the install script says that the patch is applied, and the compile finishes successfully. But when I try to start mutt with the "set header_cache='/path/to/cache'" line in my .muttrc, I'm seeing: line 6: header_cache: unknown variable Is header_cache still the name of the variable?There was a lot of development in the last few months. The header cache now supports IMAP as well. That's why I changed some of the configuration variables. The documentation that comes with your distribution always provides the configuration variables to use. So please refer to the manual coming with your distribution. Also file a bug report in the BTS of your distribution to update to the latest header cache version. Every update has its reason.
6.3.98. maildir_cache Type: path Default: "" Path to the maildir cache file. If unset no cache will be used. 6.3.99. maildir_cache_verify Type: boolean Default: yes Check for programs other than mutt having modified maildir files when the header cache is in use. This incurs one stat(2) per message every time the folder is opened. 6.3.100. maildir_cache_page_size Type: number Default: 2048 Change the maildir header cache database page size. Too large or too small of a page size for the common header can waste space, memory effectiveness, or CPU time. You can use the db_dump utility to determine the optimal page size.And here is the missing manual for 1.5.6-r3 (current gentoo testing):
6.3.98. header_cache Type: path Default: "" Path to the header cache file. If unset no cache will be used. Otherwise the cache will be enabled for Maildir and IMAP mailboxes. 6.3.99. maildir_header_cache_verify Type: boolean Default: yes Check for Maildir unaware programs other than mutt having modified maildir files when the header cache is in use. This incurs one stat(2) per message every time the folder is opened. 6.3.100. header_cache_pagesize Type: number Default: 16384 Change the maildir header cache database page size. Too large or too small of a page size for the common header can waste space, memory effectiveness, or CPU time. You can use the db_dump utility to determine the optimal page size.
(faui03) [~] crontab -l 0 0 1 * * rm /tmp/sithglan-hcache
> I'd like a small little app that I can fire up, and give it a set of > maildir directories as parameters, and have it pre-cache those, before > I visit them with Mutt. > > This would be much faster than visiting them and waiting for mutt to > build the cache each time. (Processing time is cheap, connection time > is not). mutt -f ~/Maildir/.lists.uml -e 'exec exit' ~~~~~~~~~~~~~~~~~~~~ -> Insert your mailbox here.
> I use the patch-1.5.7.tg.hcache.1 with gdbm3 for Maildirs. It > works but I can't say it works fine, probably because I had the > wrong expectations: the naïve idea was that mailboxes would take > less time to load -- which is only some time the case. Often -- > at least so it seems to me -- the database gets refreshed even if > the mailbox hasn't changed and loading takes longer than with > header cache off. Disable clamav or any nother virus scanners for MAC OSX. It is very likeley that they cause the problem. In this example opening a maildir with 50T messages took 12 minutes to open. Without clamav it was below 4 seconds.
The color status bar makes it possible to colorize the status bar in mutt. Currently only the index and the pager status bar is supported for colorization. Have a look at the screenshot.
Documentation# Set DEFAULT status color color status blue white # Highlight the regular expression color status brightred white (New|Del|Post|Inc|Flag):[0-9]+ # Match the expression, but Highlight only the S color status brightcyan white ^..(s) 1 color status brightred white ^..(S) 1 # If you want to escape a special char like '*', '(' or '[' you have to put # *three* \\\ before it. :-) color status brightred white ^.(\\\*) 1 color status brightred white \\\((all|end|no\ mailbox)\\\) 1 color status brightred white \\\(([0-9]+%)\\\) 1 # Highlight [COMMIT] style indicators color status brightred white \\\[([A-Za-z0-9\ ]+)\\\] 1 # Highlight mailbox ordering in case it isn't set to the default color status brightred white \\\(([^)]+/[^)]+)\\\) 1 color status blue white \\\((threads/date-received)\\\) 1
Last modified: 2014-02-09 | Thomas Glanzmann |