Function: gnus-group-apropos

gnus-group-apropos is an interactive and byte-compiled function defined in gnus-group.el.gz.

Signature

(gnus-group-apropos REGEXP &optional SEARCH-DESCRIPTION)

Documentation

List all newsgroups that have names that match a regexp.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-group.el.gz
;; Suggested by Daniel Quinlan <quinlan@best.com>.
(defun gnus-group-apropos (regexp &optional search-description)
  "List all newsgroups that have names that match a regexp."
  (interactive "sGnus apropos (regexp): " gnus-group-mode)
  (let ((prev "")
	(obuf (current-buffer))
	groups des)
    ;; Go through all newsgroups that are known to Gnus.
    (maphash
     (lambda (g-name _)
       (and (string-match regexp g-name)
	    (push g-name groups)))
     gnus-active-hashtb)
    ;; Also go through all descriptions that are known to Gnus.
    (when search-description
      (dolist (g-name (hash-table-keys gnus-description-hashtb))
	(when (string-match regexp g-name)
	  (push g-name groups))))
    (if (not groups)
	(gnus-message 3 "No groups matched \"%s\"." regexp)
      ;; Print out all the groups.
      (save-excursion
	(pop-to-buffer "*Gnus Help*")
	(buffer-disable-undo)
	(erase-buffer)
	(setq groups (sort groups #'string<))
	(while groups
	  ;; Groups may be entered twice into the list of groups.
	  (when (not (string= (car groups) prev))
	    (setq prev (car groups))
	    (let ((charset (gnus-group-name-charset nil prev)))
	      (insert (gnus-group-name-decode prev charset) "\n")
	      (when (and gnus-description-hashtb
			 (setq des (gethash (car groups)
					    gnus-description-hashtb)))
		(insert "  " (gnus-group-name-decode des charset) "\n"))))
	  (setq groups (cdr groups)))
	(goto-char (point-min))))
    (pop-to-buffer obuf)))