Function: message-do-fcc
message-do-fcc is a byte-compiled function defined in message.el.gz.
Signature
(message-do-fcc)
Documentation
Process Fcc headers in the current buffer.
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/message.el.gz
(defun message-do-fcc ()
"Process Fcc headers in the current buffer."
(let ((case-fold-search t)
(buf (current-buffer))
(encoded-cache message-encoded-mail-cache)
(mml-externalize-attachments message-fcc-externalize-attachments)
(file (message-field-value "fcc" t))
list)
(when file
(with-temp-buffer
(insert-buffer-substring buf)
(message-clone-locals buf)
;; Avoid re-doing things like GPG-encoding secret parts, unless
;; the user has requested that attachments be externalized, in
;; which case we have to re-encode the message body.
(if (or mml-externalize-attachments (not encoded-cache))
(message-encode-message-body)
(erase-buffer)
(insert encoded-cache))
(save-restriction
(message-narrow-to-headers)
(while (setq file (message-fetch-field "fcc" t))
(push file list)
(message-remove-header "fcc" nil t))
(let ((rfc2047-header-encoding-alist
(cons '("Newsgroups" . default)
rfc2047-header-encoding-alist)))
(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))
(if (string-match "^[ \t]*|[ \t]*\\(.*\\)[ \t]*$" file)
;; Pipe the article to the program in question.
(call-shell-region (point-min) (point-max) (match-string 1 file))
;; Save the article.
(setq file (expand-file-name file))
(unless (file-exists-p (file-name-directory file))
(make-directory (file-name-directory file) t))
(if (and message-fcc-handler-function
(not (eq message-fcc-handler-function 'rmail-output)))
(funcall message-fcc-handler-function file)
;; FIXME this option, rmail-output (also used if
;; message-fcc-handler-function is nil) is not
;; documented anywhere AFAICS. It should work in Emacs
;; 23; I suspect it does not work in Emacs 22.
;; FIXME I don't see the need for the two different cases here.
;; mail-use-rfc822 makes no difference (in Emacs 23),and
;; the third argument just controls \"Wrote file\" message.
(if (and (file-readable-p file) (mail-file-babyl-p file))
(rmail-output file 1 nil t)
(let ((mail-use-rfc822 t))
(rmail-output file 1 t t))))))))))