Pungenday, the 71 day of The Aftermath in the YOLD 3180
You've got mail!
I recently switched from Gnus to another mail client, mu4e, which I use with offlineimap. I wrote here about the change a few days ago.
Using offlineimap means I now have all my mail in the local filesystem on my laptop again. Very handy in offline scenarios. Naturally, this also meant I needed a new way of telling me if I've got unread mail.
I duckduckgoed around a bit and found
nsbiff, a small Objective C program
that shows the number of unread mail in a single Maildir on the OS X
status bar. nsbiff is a really simple program, the real code is in
BIFFAppDelegate.m
and the file is all of 102 lines including empty
lines. I thought it quite neat and briefly considered adding stuff like
extra Maildirs to check and other small changes…
Then, I accidentelly discovered that the program took up 79 megabytes of resident memory! To count files in a directory and show a number in the status bar!? Really?
Instead, I opted for this in Emacs:
(setq display-time-mail-directory "~/Maildir/hack/INBOX/new") (setq display-time-string-forms '((if display-time-day-and-date (format "%s %s %s" dayname monthname day) "") (format "%s:%s" 24-hours minutes) (if mail (propertize " " 'display display-time-mail-icon)))) (display-time)
which shows me a small mail icon on the Emacs mode-line if there are any
files what so ever in the ~/Maildir/hack/INBOX/new
directory.
Since I spend almost all of my tube time in front of Emacs anyway, this will have to do.
I also whipped up this small shell script to list the number of unread mail in some important folders. It's very brute force, since it counts all the files on every run, but on small folders it takes almost no time.
#! /bin/sh prefix=/Users/mc/Maildir maildirs="/hack/INBOX /hack/mail.mc-plus and a lot of other folders..." for maildir in $maildirs do count=`ls "$prefix$maildir/new" | wc -l` if [ ${count} != "0" ] then echo $maildir $count fi done