Function: nnml-save-mail

nnml-save-mail is a byte-compiled function defined in nnml.el.gz.

Signature

(nnml-save-mail GROUP-ART &optional SERVER FULL-NOV)

Documentation

Save a mail into the groups GROUP-ART in the nnml server SERVER.

GROUP-ART is a list that each element is a cons of a group name and an article number. This function is called narrowed to an article.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/nnml.el.gz
(defun nnml-save-mail (group-art &optional server full-nov)
  "Save a mail into the groups GROUP-ART in the nnml server SERVER.
GROUP-ART is a list that each element is a cons of a group name and an
article number.  This function is called narrowed to an article."
  (let* ((chars (nnmail-insert-lines))
	 (extension (and nnml-use-compressed-files
			 (> chars nnml-compressed-files-size-threshold)
			 (if (stringp nnml-use-compressed-files)
			     nnml-use-compressed-files
			   ".gz")))
	 file first headers)
    (nnmail-insert-xref group-art)
    (run-hooks 'nnmail-prepare-save-mail-hook)
    (run-hooks 'nnml-prepare-save-mail-hook)
    (goto-char (point-min))
    (while (looking-at "From ")
      (replace-match "X-From-Line: ")
      (forward-line 1))
    ;; We save the article in all the groups it belongs in.
    (dolist (ga group-art)
      (nnml-possibly-create-directory (car ga) server)
      (setq file (nnml-group-pathname
		  (car ga) (concat (number-to-string (cdr ga)) extension)
		  server))
      (if first
	  ;; It was already saved, so we just make a hard link.
	  (let ((file-name-coding-system nnmail-pathname-coding-system))
	    (funcall nnmail-crosspost-link-function first file t))
	;; Save the article.
	(nnmail-write-region (point-min) (point-max) file nil
			     (if (nnheader-be-verbose 5) nil 'nomesg))
	(setq first file)))
    ;; Generate a nov line for this article.  We generate the nov
    ;; line after saving, because nov generation destroys the
    ;; header.
    (setq headers (nnml-parse-head chars))
    ;; Output the nov line to all nov databases that should have it.
    (let ((func (if full-nov
		    'nnml-add-nov
		  'nnml-add-incremental-nov)))
      (dolist (ga group-art)
	(funcall func (car ga) (cdr ga) headers))))
  group-art)