]> git.notmuchmail.org Git - notmuch/blobdiff - emacs/notmuch-maildir-fcc.el
emacs: When refreshing a show buffer, only mark read when resetting state
[notmuch] / emacs / notmuch-maildir-fcc.el
index 3f1c124d4689d80fd8569953c3a005fd71921697..dcfbc4b373fddbddb1d88588913f73f063c5cc22 100644 (file)
@@ -51,13 +51,13 @@ 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."
 
- :require 'notmuch-fcc-initialization
- :group 'notmuch
  :type '(choice
         (const :tag "No FCC header" nil)
         (string :tag "A single folder")
         (repeat :tag "A folder based on the From header"
-                (cons regexp (string :tag "Folder")))))
+                (cons regexp (string :tag "Folder"))))
+ :require 'notmuch-fcc-initialization
+ :group 'notmuch-send)
 
 (defun notmuch-fcc-initialization ()
   "If notmuch-fcc-directories is set,
@@ -65,8 +65,8 @@ yet when sending a mail."
     ;; 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)))
+          (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))
 
@@ -80,7 +80,7 @@ will NOT be removed or replaced."
   (let ((subdir
         (cond
          ((or (not notmuch-fcc-dirs)
-              (message-fetch-field "Fcc"))
+              (message-field-value "Fcc"))
           ;; Nothing set or an existing header.
           nil)
 
@@ -88,12 +88,12 @@ will NOT be removed or replaced."
           notmuch-fcc-dirs)
 
          ((and (listp notmuch-fcc-dirs)
-               (= 1 (length (car notmuch-fcc-dirs))))
+               (stringp (car notmuch-fcc-dirs)))
           ;; Old style - no longer works.
           (error "Invalid `notmuch-fcc-dirs' setting (old style)"))
 
          ((listp notmuch-fcc-dirs)
-          (let* ((from (message-fetch-field "From"))
+          (let* ((from (message-field-value "From"))
                  (match
                   (catch 'first-match
                     (dolist (re-folder notmuch-fcc-dirs)
@@ -118,7 +118,7 @@ will NOT be removed or replaced."
                  (concat (notmuch-database-path) "/" subdir)))))
       
       ;; finally test if fcc points to a valid maildir
-      (let ((fcc-header (message-fetch-field "Fcc")))
+      (let ((fcc-header (message-field-value "Fcc")))
        (unless (notmuch-maildir-fcc-dir-is-maildir-p fcc-header)
          (cond ((not (file-writable-p fcc-header))
                 (error (format "No permission to create %s, which does not exist"
@@ -131,10 +131,10 @@ will NOT be removed or replaced."
  
 (defun notmuch-maildir-fcc-host-fixer (hostname)
   (replace-regexp-in-string "/\\|:"
-                           '(lambda (s)
-                               (cond ((string-equal s "/") "\\057")
-                                     ((string-equal s ":") "\\072")
-                                     (t s)))
+                           (lambda (s)
+                             (cond ((string-equal s "/") "\\057")
+                                   ((string-equal s ":") "\\072")
+                                   (t s)))
                            hostname
                            t
                            t))
@@ -163,7 +163,7 @@ will NOT be removed or replaced."
         (make-directory (concat path "/new/") t)
         (make-directory (concat path "/tmp/") t))
        ((file-regular-p path)
-        (error "%s is a file. Can't creat maildir." path))
+        (error "%s is a file. Can't create maildir." path))
        (t
         (error "I don't know how to create a maildir here"))))