[notmuch] Fcc, Maildir, and Emacs message-mode -- a bit of code
Dirk Hohndel
hohndel at infradead.org
Wed Apr 7 13:04:53 PDT 2010
On Wed, 27 Jan 2010 09:44:41 -0500, Jameson Rollins <jrollins at finestructure.net> wrote:
> Hey, folks. Following up on this thread about better fcc handling,
> Jesse passed on a simple python script he wrote that uses the python
> "mailbox" module to deliver a message on stdin to a specified maildir
> directory. It's very a simple, elegant and general purpose script
> (attached).
>
> I then put the following in my notmuch .emacs to use the new script in
> message-mode to fcc sent mail to my ~/.mail/sent directory:
>
> ;; fcc handler
> (defun maildir-deliver-region(destdir)
> (shell-command-on-region
> (point-min) (point-max)
> (concat "maildir-deliver.py -c -s -d " destdir)))
> (setq message-fcc-handler-function 'maildir-deliver-region)
> (defun my-message-header-setup ()
> (message-add-header "Fcc: ~/.mail/sent"))
> (add-hook 'message-send-hook 'my-message-header-setup)
This is really nice - just what I needed. Well, almost.
Instead of passing in destdir it would be even better if the lisp code
figured out which MailDir to use. So we'd have a configuration variable
that matched From addresses to MailDirs
"dirk at hohndel.org" "~/MailDirHohndel"
"dirk.hohndel at intel.com" "~/MailDirIntel"
etc.
And just for safety used the passed in destdir as fallback / default.
Anyone willing / able to add this? I can't lisp to save my life...
/D
--
Dirk Hohndel
Intel Open Source Technology Center
More information about the notmuch
mailing list