X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=emacs%2Fnotmuch-maildir-fcc.el;h=693d8d42bc19bfcd49f2212c646723fd396d96f4;hb=d5e4ff0580c9635740fe745f766ec9d10a94809e;hp=8bb41a89a848a598d3adee37e059dd55e49cdd5d;hpb=fc73737ff5651c1a270232dcd982f9d1ee0b442f;p=notmuch diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el index 8bb41a89..693d8d42 100644 --- a/emacs/notmuch-maildir-fcc.el +++ b/emacs/notmuch-maildir-fcc.el @@ -18,9 +18,11 @@ (require 'message) +(require 'notmuch-lib) + (defvar notmuch-maildir-fcc-count 0) -(defcustom notmuch-fcc-dirs nil +(defcustom notmuch-fcc-dirs "sent" "Determines the maildir directory to save outgoing mails in. If set to non-nil, this will cause message mode to file your @@ -43,10 +45,9 @@ used. The first entry is used as a default fallback when nothing else matches. - In all cases, the complete FCC directory will be constructed by - concatenating the content of the variable 'message-directory' - ('~/Mail/' by default and customizable via M-x - customize-variablemessage-directory) and this value. + In all cases, a relative FCC directory will be understood to + specify a directory within the notmuch mail store, (as set by + the database.path option in the notmuch configuration file). You will be prompted to create the directory if it does not exist yet when sending a mail. @@ -67,7 +68,7 @@ '(lambda (destdir) (notmuch-maildir-fcc-write-buffer-to-maildir destdir t))) ;;add a hook to actually insert the Fcc header when sending - (add-hook 'message-send-hook 'notmuch-fcc-header-setup)) + (add-hook 'message-header-setup-hook 'notmuch-fcc-header-setup)) (defun notmuch-fcc-header-setup () "Adds an appropriate fcc header to the current mail buffer @@ -90,8 +91,9 @@ ;; if there is no fcc header yet, add ours (unless (message-fetch-field "fcc") (message-add-header (concat "Fcc: " - (file-name-as-directory message-directory) - subdir))) + (if (= (elt subdir 0) ?/) + subdir + (concat (notmuch-database-path) "/" subdir))))) ;; finally test if fcc points to a valid maildir (let ((fcc-header (message-fetch-field "fcc")))