diff options
-rw-r--r-- | emacs/notmuch-lib.el | 7 | ||||
-rw-r--r-- | emacs/notmuch-maildir-fcc.el | 14 |
2 files changed, 15 insertions, 6 deletions
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index f30bcb42..91132b50 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -68,6 +68,13 @@ the user hasn't set this variable with the old or new value." (match-string 2 long-string) "unknown"))) +(defun notmuch-database-path () + "Return the database.path value from the notmuch configuration." + ;; Trim off the trailing newline + (substring (shell-command-to-string + (concat notmuch-command " config get database.path")) + 0 -1)) + ;; ;; XXX: This should be a generic function in emacs somewhere, not diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el index 8bb41a89..ba22981c 100644 --- a/emacs/notmuch-maildir-fcc.el +++ b/emacs/notmuch-maildir-fcc.el @@ -18,6 +18,8 @@ (require 'message) +(require 'notmuch-lib) + (defvar notmuch-maildir-fcc-count 0) (defcustom notmuch-fcc-dirs nil @@ -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-variable<RET>message-directory<RET>) 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. @@ -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"))) |