Function: gnus-subscribe-hierarchically

gnus-subscribe-hierarchically is a byte-compiled function defined in gnus-start.el.gz.

Signature

(gnus-subscribe-hierarchically NEWGROUP)

Documentation

Subscribe new NEWGROUP and insert it in hierarchical newsgroup order.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-start.el.gz
(defun gnus-subscribe-hierarchically (newgroup)
  "Subscribe new NEWGROUP and insert it in hierarchical newsgroup order."
  ;; Basic ideas by mike-w@cs.aukuni.ac.nz (Mike Williams)
  (with-current-buffer (nnheader-find-file-noselect gnus-current-startup-file)
    (prog1
	(let ((groupkey newgroup) before)
	  (while (and (not before) groupkey)
	    (goto-char (point-min))
	    (let ((groupkey-re
		   (concat "^\\(" (regexp-quote groupkey) ".*\\)[!:]")))
	      (while (and (re-search-forward groupkey-re nil t)
			  (progn
			    (setq before (match-string 1))
			    (string< before newgroup)))))
	    ;; Remove tail of newsgroup name (eg. a.b.c -> a.b)
	    (setq groupkey
		  (when (string-match "^\\(.*\\)\\.[^.]+$" groupkey)
		    (substring groupkey (match-beginning 1) (match-end 1)))))
	  (gnus-subscribe-newsgroup newgroup before))
      (kill-buffer (current-buffer)))))