X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=emacs%2Fnotmuch-maildir-fcc.el;h=b01f00985fa3d0818becf73b0bc5791036f45c1b;hb=aa1e8352de30a8dc272552ee65c7272166f39695;hp=835258f87b962992d96fa7e7cc0d78bc1d7eb97c;hpb=37859d1fcb1ad661666dbdb95372becaa98d46cb;p=notmuch diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el index 835258f8..b01f0098 100644 --- a/emacs/notmuch-maildir-fcc.el +++ b/emacs/notmuch-maildir-fcc.el @@ -120,6 +120,45 @@ by notmuch-mua-mail" subdir (concat (notmuch-database-path) "/" subdir)))))) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Functions for saving a message either using notmuch insert or file +;; fcc. First functions common to the two cases. + +(defun notmuch-maildir-message-do-fcc () + "Process Fcc headers in the current buffer. + +This is a rearranged version of message mode's message-do-fcc." + (let ((case-fold-search t) + (buf (current-buffer)) + list file + (mml-externalize-attachments message-fcc-externalize-attachments)) + (save-excursion + (save-restriction + (message-narrow-to-headers) + (setq file (message-fetch-field "fcc" t))) + (when file + (set-buffer (get-buffer-create " *message temp*")) + (erase-buffer) + (insert-buffer-substring buf) + (message-encode-message-body) + (save-restriction + (message-narrow-to-headers) + (while (setq file (message-fetch-field "fcc" t)) + (push file list) + (message-remove-header "fcc" nil t)) + (let ((mail-parse-charset message-default-charset)) + (mail-encode-encoded-word-buffer))) + (goto-char (point-min)) + (when (re-search-forward + (concat "^" (regexp-quote mail-header-separator) "$") + nil t) + (replace-match "" t t )) + ;; Process FCC operations. + (while list + (setq file (pop list)) + (notmuch-fcc-handler file)) + (kill-buffer (current-buffer)))))) + (defun notmuch-fcc-handler (fcc-header) "Store message with file fcc." (notmuch-maildir-fcc-file-fcc fcc-header))