Function: nnml-request-replace-article

nnml-request-replace-article is a byte-compiled function defined in nnml.el.gz.

Signature

(nnml-request-replace-article ARTICLE GROUP BUFFER)

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/nnml.el.gz
(deffoo nnml-request-replace-article (article group buffer)
  (nnml-possibly-change-directory group)
  (with-current-buffer buffer
    (nnml-possibly-create-directory group)
    (let ((chars (nnmail-insert-lines))
	  (art (concat (int-to-string article) "\t"))
	  headers)
      (when (ignore-errors
	      (nnmail-write-region
	       (point-min) (point-max)
	       (or (nnml-article-to-file article)
		   (expand-file-name (int-to-string article)
				     nnml-current-directory))
	       nil (if (nnheader-be-verbose 5) nil 'nomesg))
	      t)
	(setq headers (nnml-parse-head chars article))
	;; Replace the NOV line in the NOV file.
	(with-current-buffer (nnml-open-nov group)
	  (goto-char (point-min))
	  (if (or (looking-at art)
		  (search-forward (concat "\n" art) nil t))
	      ;; Delete the old NOV line.
	      (gnus-delete-line)
	    ;; The line isn't here, so we have to find out where
	    ;; we should insert it.  (This situation should never
	    ;; occur, but one likes to make sure...)
	    (while (and (looking-at "[0-9]+\t")
			(< (string-to-number
			    (buffer-substring
			     (match-beginning 0) (match-end 0)))
			   article)
			(zerop (forward-line 1)))))
	  (beginning-of-line)
	  (nnheader-insert-nov headers)
	  (nnml-save-nov)
	  t)))))