Function: nnmairix-replace-group-and-numbers
nnmairix-replace-group-and-numbers is a byte-compiled function defined
in nnmairix.el.gz.
Signature
(nnmairix-replace-group-and-numbers ARTICLES BACKENDGROUP MAIRIXGROUP NUMC TYPE)
Documentation
Replace folder names in Xref header and correct article numbers.
Do this for all ARTICLES on BACKENDGROUP. Replace using
MAIRIXGROUP. NUMC contains values for article number correction.
TYPE is either nov or headers.
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/nnmairix.el.gz
(defun nnmairix-replace-group-and-numbers (articles backendgroup mairixgroup numc type)
"Replace folder names in Xref header and correct article numbers.
Do this for all ARTICLES on BACKENDGROUP. Replace using
MAIRIXGROUP. NUMC contains values for article number correction.
TYPE is either `nov' or `headers'."
(nnheader-message 7 "nnmairix: Rewriting headers...")
(cond
((eq type 'nov)
(let ((buf (gnus-get-buffer-create " *nnmairix buffer*"))
(corr (not (zerop numc)))
(name (buffer-name nntp-server-buffer))
cur xref) ;; header
(with-current-buffer buf
(erase-buffer)
(set-buffer nntp-server-buffer)
(goto-char (point-min))
(mapc
(lambda (article)
(when (or (looking-at (number-to-string article))
(nnheader-find-nov-line article))
(setq cur (nnheader-parse-nov))
(when corr
(setq article (+ (mail-header-number cur) numc))
(setf (mail-header-number cur) article))
(setq xref (mail-header-xref cur))
(when (and (stringp xref)
(string-match (format "[ \t]%s:[0-9]+" backendgroup) xref))
(setq xref (replace-match (format " %s:%d" mairixgroup article) t nil xref))
(setf (mail-header-xref cur) xref))
(set-buffer buf)
(nnheader-insert-nov cur)
(set-buffer nntp-server-buffer)
(when (not (eobp))
(forward-line 1))))
articles)
(kill-buffer nntp-server-buffer)
(set-buffer buf)
(rename-buffer name)
(setq nntp-server-buffer buf))))
((and (eq type 'headers)
(not (zerop numc)))
(with-current-buffer nntp-server-buffer
(save-excursion
(goto-char (point-min))
(while (re-search-forward "^[23][0-9]+ \\([0-9]+\\)" nil t)
(replace-match (number-to-string
(+ (string-to-number (match-string 1)) numc))
t t nil 1))))))
(nnheader-message 7 "nnmairix: Rewriting headers... done"))