Function: nndiary-request-replace-article

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

Signature

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

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/nndiary.el.gz
(deffoo nndiary-request-replace-article (article group buffer)
  (nndiary-possibly-change-directory group)
  (with-current-buffer buffer
    (nndiary-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 (nndiary-article-to-file article)
		   (expand-file-name (int-to-string article)
				     nndiary-current-directory))
	       nil (if (nnheader-be-verbose 5) nil 'nomesg))
	      t)
	(setq headers (nndiary-parse-head chars article))
	;; Replace the NOV line in the NOV file.
	(with-current-buffer (nndiary-open-nov group)
	  (goto-char (point-min))
	  (if (or (looking-at art)
		  (search-forward (concat "\n" art) nil t))
	      ;; Delete the old NOV line.
	      (delete-region (progn (beginning-of-line) (point))
			     (progn (forward-line 1) (point)))
	    ;; 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)
	  (nndiary-save-nov)
	  t)))))