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

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

Date: Fri, 23 Apr 2010 09:13:06 +0200

To: Dirk Hohndel, notmuch@notmuchmail.org

Cc:

From: Sebastian Spaeth


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@intel.com>" . "Maildir/Sent Items")
>       ("Dirk Hohndel <hohndel@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

Thread: