Function: gnus-category-read

gnus-category-read is a byte-compiled function defined in gnus-agent.el.gz.

Signature

(gnus-category-read)

Documentation

Read the category alist.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-agent.el.gz
(defun gnus-category-read ()
  "Read the category alist."
  (setq gnus-category-alist
        (or
	 (let ((list
		(with-temp-buffer
		  (ignore-errors
		    (nnheader-insert-file-contents (nnheader-concat gnus-agent-directory "lib/categories"))
		    (goto-char (point-min))
		    ;; This code isn't temp, it will be needed so long as
		    ;; anyone may be migrating from an older version.

		    ;; Once we're certain that people will not revert to an
		    ;; earlier version, we can take out the old-list code in
		    ;; gnus-category-write.
		    (let* ((old-list (read (current-buffer)))
			   (new-list (ignore-errors (read (current-buffer)))))
		      (if new-list
			  new-list
			;; Convert from a positional list to an alist.
			(mapcar
			 (lambda (c)
			   (setcdr c
				   (delq nil
					 (gnus-mapcar
					  (lambda (valu symb)
					    (if valu
						(cons symb valu)))
					  (cdr c)
					  '(agent-predicate agent-score-file agent-groups))))
			   c)
			 old-list)))))))
	   ;; Possibly decode group names.
	   (dolist (cat list)
	     (setf (alist-get 'agent-groups cat)
		   (mapcar (lambda (g)
			     (if (string-match-p "[^[:ascii:]]" g)
				 (decode-coding-string g 'utf-8-emacs)
			       g))
			   (alist-get 'agent-groups cat))))
	   list)
         (list (gnus-agent-cat-make 'default 'short)))))