[notmuch] Fcc, Maildir, and Emacs message-mode -- a bit of code

Jesse Rosenthal jrosenthal at jhu.edu
Thu Jan 21 10:36:38 PST 2010


Dear all,

First of all, many thanks to Carl and others for writing notmuch.

Some folks on IRC were bemoaning message-mode's annoying inability to
save sent-mail to a Maildir using Fcc. I mentioned that I had written a
bit of Maildir elisp code for that purpose a while back, and it was
suggested that I share it with the list.

Some caveats:

- I've tested this a good number of times, but not very robustly, since
  I don't actually use it (I found that I prefer blind-copying
  myself). Please test it out somewhere safe, on a maildir you can
  afford to lose.

- The hardlinking performed by `add-name-to-file' might be platform and
  filesystem specific. I'm using linux/ext3, and it works here. I don't
  know what will happen anywhere else.

- I imagine there's a much better implementation inside of Wanderlust,
  if you can dig through all the libraries.

- It's not really commented, but I hope the function names are pretty
  self-explanatory.

- It requires that the directory in the `Fcc:' header already exist and
  be a maildir (i.e. have cur/, new/, and tmp/). It should be pretty
  simple to add in a prompt for creating a directory if it points to a
  nonexistent place.

Anyway, here it is:

http://jkr.acm.jhu.edu/jkr-maildir.el

To use it, set one of the following:

If you want Fcc'd messages to be marked as read:

     (setq message-fcc-handler-function 
          '(lambda (destdir) 
	     (jkr/maildir-write-buffer-to-maildir destdir t)))

If you want Fcc'd messages to be marked as new:

     (setq message-fcc-handler-function 
          '(lambda (destdir) 
	     (jkr/maildir-write-buffer-to-maildir destdir nil)))


Best,
Jesse



More information about the notmuch mailing list