Function: pop3-write-to-file
pop3-write-to-file is a byte-compiled function defined in pop3.el.gz.
Signature
(pop3-write-to-file FILE MESSAGES)
Source Code
;; Defined in /usr/src/emacs/lisp/net/pop3.el.gz
(defun pop3-write-to-file (file messages)
(let ((pop-buffer (current-buffer))
beg end
temp-buffer)
(with-temp-buffer
(setq temp-buffer (current-buffer))
(with-current-buffer pop-buffer
(goto-char (point-min))
(while (re-search-forward "^\\+OK" nil t)
(forward-line 1)
(setq beg (point))
(when (re-search-forward "^\\.\r?\n" nil t)
(forward-line -1)
(setq end (point)))
(with-current-buffer temp-buffer
(goto-char (point-max))
(let ((hstart (point)))
(insert-buffer-substring pop-buffer beg end)
(pop3-clean-region hstart (point))
(goto-char (point-max))
(pop3-munge-message-separator hstart (point))
(when pop3-leave-mail-on-server
(pop3-uidl-add-xheader hstart (pop messages)))
(goto-char (point-max))))))
(let ((coding-system-for-write 'binary))
(goto-char (point-min))
;; Check whether something inserted a newline at the start and
;; delete it.
(when (eolp)
(delete-char 1))
(write-region (point-min) (point-max) file nil 'nomesg)))))