Function: nnvirtual-update-xref-header

nnvirtual-update-xref-header is a byte-compiled function defined in nnvirtual.el.gz.

Signature

(nnvirtual-update-xref-header GROUP ARTICLE PREFIX SYSNAME)

Documentation

Edit current NOV header to have xref to component group and correct prefix.

This function edits the current NOV header in current buffer so that it has an xref to the component group, and also ensures any existing xref lines have the correct component server prefix.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/nnvirtual.el.gz
(defun nnvirtual-update-xref-header (group article prefix sysname)
  "Edit current NOV header to have xref to component group and correct prefix.
This function edits the current NOV header in current buffer so that it
has an xref to the component group, and also ensures any existing xref
lines have the correct component server prefix."
  ;; Move to beginning of Xref field, creating a slot if needed.
  (beginning-of-line)
  (looking-at
   "[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t")
  (goto-char (match-end 0))
  (unless (search-forward "\t" (line-end-position) 'move)
    (insert "\t"))

  ;; Remove any spaces at the beginning of the Xref field.
  (while (eq (char-after (1- (point))) ? )
    (forward-char -1)
    (delete-char 1))

  (insert "Xref: " sysname " " group ":")
  (princ article (current-buffer))
  (insert " ")

  ;; If there were existing xref lines, clean them up to have the correct
  ;; component server prefix.
  (save-restriction
    (narrow-to-region (point)
                      (or (search-forward "\t" (line-end-position) t)
                          (line-end-position)))
    (goto-char (point-min))
    (when (re-search-forward "Xref: *[^\n:0-9 ]+ *" nil t)
      (replace-match "" t t))
    (goto-char (point-min))
    (when (re-search-forward
	   (concat (regexp-quote (gnus-group-real-name group)) ":[0-9]+")
	   nil t)
      (replace-match "" t t))
    (unless (eobp)
      (insert " ")
      (when (not (string= "" prefix))
	(while (re-search-forward "[^ ]+:[0-9]+" nil t)
	  (save-excursion
	    (goto-char (match-beginning 0))
	    (insert prefix))))))

  ;; Ensure a trailing \t.
  (end-of-line)
  (or (eq (char-after (1- (point))) ?\t)
      (insert ?\t)))