Function: nnspool-retrieve-headers

nnspool-retrieve-headers is a byte-compiled function defined in nnspool.el.gz.

Signature

(nnspool-retrieve-headers ARTICLES &optional GROUP SERVER FETCH-OLD)

Documentation

Retrieve the headers of ARTICLES.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/nnspool.el.gz
(deffoo nnspool-retrieve-headers (articles &optional group _server fetch-old)
  "Retrieve the headers of ARTICLES."
  (with-current-buffer nntp-server-buffer
    (erase-buffer)
    (when (nnspool-possibly-change-directory group)
      (let* ((number (length articles))
	     (count 0)
	     (default-directory nnspool-current-directory)
	     (do-message (and (numberp nnspool-large-newsgroup)
			      (> number nnspool-large-newsgroup)))
	     (nnheader-file-coding-system nnspool-file-coding-system)
	     file beg article ag)
	(if (and (numberp (car articles))
		 (nnspool-retrieve-headers-with-nov articles fetch-old))
	    ;; We successfully retrieved the NOV headers.
	    'nov
	  ;; No NOV headers here, so we do it the hard way.
	  (while (setq article (pop articles))
	    (if (stringp article)
		;; This is a Message-ID.
		(setq ag (nnspool-find-id article)
		      file (and ag (nnspool-article-pathname
				    (car ag) (cdr ag)))
		      article (cdr ag))
	      ;; This is an article in the current group.
	      (setq file (int-to-string article)))
	    ;; Insert the head of the article.
	    (when (and file
		       (file-exists-p file))
	      (insert "221 ")
	      (princ article (current-buffer))
	      (insert " Article retrieved.\n")
	      (setq beg (point))
	      (inline (nnheader-insert-head file))
	      (goto-char beg)
	      (if (search-forward "\n\n" nil t)
		  (progn
		    (forward-char -1)
		    (insert ".\n"))
		(goto-char (point-max))
		(if (bolp)
		    (insert ".\n")
		  (insert "\n.\n")))
	      (delete-region (point) (point-max)))

	    (and do-message
                 (zerop (% (incf count) 20))
		 (nnheader-message 5 "nnspool: Receiving headers... %d%%"
				   (floor (* count 100.0) number))))

	  (when do-message
	    (nnheader-message 5 "nnspool: Receiving headers...done"))

	  ;; Fold continuation lines.
	  (nnheader-fold-continuation-lines)
	  'headers)))))