Function: mh-write-msg-to-file
mh-write-msg-to-file is an autoloaded, interactive and byte-compiled
function defined in mh-folder.el.gz.
Signature
(mh-write-msg-to-file MESSAGE FILE NO-HEADER)
Documentation
Append MESSAGE to end of FILE.
You are prompted for the filename. If the file already exists,
the message is appended to it. You can also write the message to
the file without the header by specifying a prefix argument
NO-HEADER. Subsequent writes to the same file can be made with
the command ! (mh-refile-or-write-again).
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/mh-e/mh-folder.el.gz
;;;###mh-autoload
(defun mh-write-msg-to-file (message file no-header)
"Append MESSAGE to end of FILE\\<mh-folder-mode-map>.
You are prompted for the filename. If the file already exists,
the message is appended to it. You can also write the message to
the file without the header by specifying a prefix argument
NO-HEADER. Subsequent writes to the same file can be made with
the command \\[mh-refile-or-write-again]."
(interactive
(list (mh-get-msg-num t)
(let ((default-dir (if (eq 'write (car mh-last-destination-write))
(file-name-directory
(car (cdr mh-last-destination-write)))
default-directory)))
(read-file-name (format "Save message%s in file: "
(if current-prefix-arg " body" ""))
default-dir
(if (eq 'write (car mh-last-destination-write))
(car (cdr mh-last-destination-write))
(expand-file-name "mail.out" default-dir))))
current-prefix-arg))
(let ((msg-file-to-output (mh-msg-filename message))
(output-file (mh-expand-file-name file)))
(setq mh-last-destination (list 'write file (if no-header 'no-header))
mh-last-destination-write mh-last-destination)
(with-current-buffer (get-buffer-create mh-temp-buffer)
(erase-buffer)
(insert-file-contents msg-file-to-output)
(goto-char (point-min))
(if no-header (search-forward "\n\n"))
(append-to-file (point) (point-max) output-file))))