;;; Code:
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
+
(require 'message)
(require 'notmuch-lib)
:group 'notmuch-send)
(defcustom notmuch-maildir-use-notmuch-insert 't
- "Should fcc use notmuch insert instead of simple fcc"
+ "Should fcc use notmuch insert instead of simple fcc."
:type '(choice :tag "Fcc Method"
(const :tag "Use notmuch insert" t)
(const :tag "Use simple fcc" nil))
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"
+by notmuch-mua-mail."
(let ((subdir
(cond
;; really want this header inserted.
(when (or (not (= (elt subdir 0) ?/))
- (y-or-n-p (format "Fcc header %s is an absolute path and notmuch insert is requested.\nInsert header anyway? "
- subdir)))
+ (y-or-n-p
+ (format "Fcc header %s is an absolute path and notmuch insert is requested.
+Insert header anyway? " subdir)))
(message-add-header (concat "Fcc: " subdir))))
(defun notmuch-maildir-add-file-style-fcc-header (subdir)
(message-encode-message-body)
(save-restriction
(message-narrow-to-headers)
- (let ((mail-parse-charset message-default-charset))
- (mail-encode-encoded-word-buffer)))
+ (mail-encode-encoded-word-buffer))
(goto-char (point-min))
(when (re-search-forward
(concat "^" (regexp-quote mail-header-separator) "$")
;; typo, or just the user want a new folder, let the user decide
;; how to deal with it.
(error
- (let ((response (read-char-choice
- "Insert failed: (r)etry, (c)reate folder, (i)gnore, or (e)dit the header? "
- '(?r ?c ?i ?e))))
- (case response
- (?r (notmuch-maildir-fcc-with-notmuch-insert fcc-header))
- (?c (notmuch-maildir-fcc-with-notmuch-insert fcc-header 't))
- (?i 't)
- (?e (notmuch-maildir-fcc-with-notmuch-insert
- (read-from-minibuffer "Fcc header: " fcc-header)))))))))
+ (let ((response (notmuch-read-char-choice "Insert failed: \
+\(r)etry, (c)reate folder, (i)gnore, or (e)dit the header? " '(?r ?c ?i ?e))))
+ (cl-case response
+ (?r (notmuch-maildir-fcc-with-notmuch-insert fcc-header))
+ (?c (notmuch-maildir-fcc-with-notmuch-insert fcc-header 't))
+ (?i 't)
+ (?e (notmuch-maildir-fcc-with-notmuch-insert
+ (read-from-minibuffer "Fcc header: " fcc-header)))))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun notmuch-maildir-fcc-make-uniq-maildir-id ()
(let* ((ftime (float-time))
(microseconds (mod (* 1000000 ftime) 1000000))
- (hostname (notmuch-maildir-fcc-host-fixer system-name)))
+ (hostname (notmuch-maildir-fcc-host-fixer (system-name))))
(setq notmuch-maildir-fcc-count (+ notmuch-maildir-fcc-count 1))
(format "%d.%d_%d_%d.%s"
ftime
(notmuch-maildir-fcc-write-buffer-to-maildir fcc-header 't)
;; The fcc-header is not a valid maildir see if the user wants to
;; fix it in some way.
- (let* ((prompt (format "Fcc %s is not a maildir: (r)etry, (c)reate folder, (i)gnore, or (e)dit the header? "
- fcc-header))
- (response (read-char-choice prompt '(?r ?c ?i ?e))))
- (case response
- (?r (notmuch-maildir-fcc-file-fcc fcc-header))
- (?c (if (file-writable-p fcc-header)
- (notmuch-maildir-fcc-create-maildir fcc-header)
- (message "No permission to create %s." fcc-header)
- (sit-for 2))
- (notmuch-maildir-fcc-file-fcc fcc-header))
- (?i 't)
- (?e (notmuch-maildir-fcc-file-fcc
- (read-from-minibuffer "Fcc header: " fcc-header)))))))
+ (let* ((prompt (format "Fcc %s is not a maildir: \
+\(r)etry, (c)reate folder, (i)gnore, or (e)dit the header? " fcc-header))
+ (response (notmuch-read-char-choice prompt '(?r ?c ?i ?e))))
+ (cl-case response
+ (?r (notmuch-maildir-fcc-file-fcc fcc-header))
+ (?c (if (file-writable-p fcc-header)
+ (notmuch-maildir-fcc-create-maildir fcc-header)
+ (message "No permission to create %s." fcc-header)
+ (sit-for 2))
+ (notmuch-maildir-fcc-file-fcc fcc-header))
+ (?i 't)
+ (?e (notmuch-maildir-fcc-file-fcc
+ (read-from-minibuffer "Fcc header: " fcc-header)))))))
(defun notmuch-maildir-fcc-write-buffer-to-maildir (destdir &optional mark-seen)
"Writes the current buffer to maildir destdir. If mark-seen is