Function: gnus-score-find-bnews
gnus-score-find-bnews is a byte-compiled function defined in
gnus-score.el.gz.
Signature
(gnus-score-find-bnews GROUP)
Documentation
Return a list of score files for GROUP.
The score files are those files in the ~/News/ directory which matches GROUP using BNews sys file syntax.
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/gnus-score.el.gz
(defun gnus-score-find-bnews (group)
"Return a list of score files for GROUP.
The score files are those files in the ~/News/ directory which matches
GROUP using BNews sys file syntax."
(let* ((sfiles (append (gnus-score-score-files group)
gnus-internal-global-score-files))
(kill-dir (file-name-as-directory
(expand-file-name gnus-kill-files-directory)))
(klen (length kill-dir))
(score-regexp (gnus-score-file-regexp))
(trans (cdr (assq ?: nnheader-file-name-translation-alist)))
(group-trans (nnheader-translate-file-chars group t))
ofiles not-match regexp)
(with-current-buffer (gnus-get-buffer-create "*gnus score files*")
(buffer-disable-undo)
;; Go through all score file names and create regexp with them
;; as the source.
(while sfiles
(erase-buffer)
(insert (car sfiles))
(goto-char (point-min))
;; First remove the suffix itself.
(when (re-search-forward score-regexp nil t)
(unless (= (match-end 0) (match-beginning 0)) ; non-empty suffix
(replace-match "" t t)
(delete-char -1)) ; remove the "." before the suffix
(goto-char (point-min))
(if (looking-at (regexp-quote kill-dir))
;; If the file name was just "SCORE", `klen' is one character
;; too much.
(delete-char (min (1- (point-max)) klen))
(goto-char (point-max))
(if (re-search-backward gnus-directory-sep-char-regexp nil t)
(delete-region (1+ (point)) (point-min))
(gnus-message 1 "Can't find directory separator in %s"
(car sfiles))))
;; If short file names were used, we have to translate slashes.
(goto-char (point-min))
(let ((regexp (concat
"[/:" (if trans (char-to-string trans)) "]")))
(while (re-search-forward regexp nil t)
(replace-match "." t t)))
;; Kludge to get rid of "nntp+" problems.
(goto-char (point-min))
(when (looking-at "nn[a-z]+\\+")
(search-forward "+")
(forward-char -1)
(insert "\\")
(forward-char 1))
;; Kludge to deal with "++".
(while (search-forward "+" nil t)
(replace-match "\\+" t t))
;; Translate "all" to ".*".
(goto-char (point-min))
(while (search-forward "all" nil t)
(replace-match ".*" t t))
(goto-char (point-min))
;; Deal with "not."s.
(if (looking-at "not.")
(progn
(setq not-match t)
(setq regexp
(concat "^" (buffer-substring 5 (point-max)) "$")))
(setq regexp (concat "^" (buffer-substring 1 (point-max)) "$"))
(setq not-match nil))
;; Finally - if this resulting regexp matches the group name,
;; we add this score file to the list of score files
;; applicable to this group.
(when (or (and not-match
(ignore-errors
(not (string-match regexp group-trans))))
(and (not not-match)
(ignore-errors (string-match regexp group-trans))))
(push (car sfiles) ofiles)))
(setq sfiles (cdr sfiles)))
(gnus-kill-buffer (current-buffer))
;; Slight kludge here - the last score file returned should be
;; the local score file, whether it exists or not. This is so
;; that any score commands the user enters will go to the right
;; file, and not end up in some global score file.
(let ((localscore (gnus-score-file-name group)))
(setq ofiles (cons localscore (delete localscore ofiles))))
(gnus-sort-score-files (nreverse ofiles)))))