X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=emacs%2Fnotmuch-maildir-fcc.el;h=c2f2f4cb127db3d9f2c786b8c8236cffe558193e;hp=07eedba22a33a28ae802f260781c3fbfdeeca582;hb=d0553ad524f241ba42f685cba6745c8a3a9ba20a;hpb=03aff8499d55614377d01e0296a4f186e0ed8735 diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el index 07eedba2..c2f2f4cb 100644 --- a/emacs/notmuch-maildir-fcc.el +++ b/emacs/notmuch-maildir-fcc.el @@ -59,23 +59,19 @@ yet when sending a mail." :require 'notmuch-fcc-initialization :group 'notmuch-send) -(defun notmuch-fcc-initialization () - "If notmuch-fcc-directories is set, - hook them into the message-fcc-handler-function" - ;; Set up the message-fcc-handler to move mails to the maildir in Fcc - ;; The parameter is set to mark messages as "seen" - (setq message-fcc-handler-function - (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-header-setup-hook 'notmuch-fcc-header-setup)) +(defun notmuch-fcc-handler (destdir) + "Write buffer to `destdir', marking it as sent + +Intended to be dynamically bound to `message-fcc-handler-function'" + (notmuch-maildir-fcc-write-buffer-to-maildir destdir t)) (defun notmuch-fcc-header-setup () "Add an Fcc header to the current message buffer. -Can be added to `message-send-hook' and will set the Fcc header -based on the values of `notmuch-fcc-dirs'. An existing Fcc header -will NOT be removed or replaced." +Sets the Fcc header based on the values of `notmuch-fcc-dirs'. + +Originally intended to be use a hook function, but now called directly +by notmuch-mua-mail" (let ((subdir (cond @@ -213,6 +209,5 @@ return t if successful, and nil otherwise." (delete-file (concat destdir "/tmp/" msg-id)))) t))) -(notmuch-fcc-initialization) (provide 'notmuch-maildir-fcc)