]> git.notmuchmail.org Git - notmuch/blobdiff - emacs/notmuch-maildir-fcc.el
emacs: fcc should fail at the right time if it doesn't point to a maildir
[notmuch] / emacs / notmuch-maildir-fcc.el
index 64f60bc62bee9a23989da3104765831c19b89068..34b19154ac94995d7ab7098251724c308e876107 100644 (file)
    (let ((subdir
           (cdr (assoc-string (message-fetch-field "from") notmuch-fcc-dirs t))))
      (if (eq subdir nil) (setq subdir (car (car notmuch-fcc-dirs))))
-     (message-remove-header "Fcc")
-     (message-add-header (concat "Fcc: " message-directory subdir)))))
+     (unless (message-fetch-field "fcc")
+       (message-add-header (concat "Fcc: " message-directory subdir)))
+     (unless (notmuch-maildir-fcc-dir-is-maildir-p 
+             (message-fetch-field "fcc"))
+       (error (format "%s is not a maildir." (message-fetch-field "fcc")))))))
 
 (defun notmuch-maildir-fcc-host-fixer (hostname)
   (replace-regexp-in-string "/\\|:"