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

Sebastian Spaeth Sebastian at SSpaeth.de
Fri Apr 23 00:13:06 PDT 2010


On 2010-04-22, Dirk Hohndel wrote:
> ;; This is the list of alternatives that should be configurable as
> ;; defcustom (or simply set in .emacs for now)
> (setq notmuch-fcc-dirs '(
>       ("Dirk Hohndel <dirk.hohndel at intel.com>" . "Maildir/Sent Items")
>       ("Dirk Hohndel <hohndel at infradead.org>" . "MaildirInfradead/Sent")))
> 
> ;This constructs a path, concatenating the content of the variable
> ;"message-directory" and the second part in the alist:
> (defun my-fcc-header-setup ()
> (let ((subdir (cdr (assoc (message-fetch-field "from") notmuch-fcc-dirs))))
>      (message-add-header (concat "Fcc: " message-directory subdir))))
> (add-hook 'message-send-hook 'my-fcc-header-setup)

> The disadvantage is that with the message-send-hook I don't get to see /
> correct the FCC line in the message buffer - but since I trust the logic
> here (and tested it quite a bit), I'm less concerned about this.

Another disadvantage is that this does not provide a fallback, so if you
type "dirk" rather than "Dirk" in your from, the fcc dir will be nil, so
it tries to deliver just to "message-directory". The user should be able
to configure a default FCC dir, I think.

Sebastian


More information about the notmuch mailing list