From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Emanuele Santoro Newsgroups: gmane.emacs.help Subject: [GNUS] Displaying available news-groups, sorted by name Date: Fri, 12 Feb 2016 20:49:08 +0100 Organization: Aioe.org NNTP Server Message-ID: <871t8hlnez.fsf@santoro.tk> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1455316031 30846 80.91.229.3 (12 Feb 2016 22:27:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 12 Feb 2016 22:27:11 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Feb 12 23:27:05 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aUMB2-0007Oz-Me for geh-help-gnu-emacs@m.gmane.org; Fri, 12 Feb 2016 23:27:00 +0100 Original-Received: from localhost ([::1]:36794 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aUMB1-0000Aw-Vh for geh-help-gnu-emacs@m.gmane.org; Fri, 12 Feb 2016 17:26:59 -0500 Original-Path: usenet.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.xs4all.nl!newsfeed9.news.xs4all.nl!37.252.120.71.MISMATCH!2.eu.feeder.erje.net!feeder.erje.net!1.eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!news.mixmin.net!aioe.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 69 Original-NNTP-Posting-Host: F9iAQJRov7IgeFQCIi4WuQ.user.gioia.aioe.org Original-X-Complaints-To: abuse@aioe.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) X-Notice: Filtered by postfilter v. 0.8.2 Cancel-Lock: sha1:O44uE7ZGOD63d//S2ifIffxQz9U= Original-Xref: usenet.stanford.edu gnu.emacs.help:216860 X-Mailman-Approved-At: Fri, 12 Feb 2016 17:26:49 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:109154 Archived-At: Hi all! I recently configured Gnus on GNU Emacs 24.4.1 as newsreader. In order to subscribe to newsgroups, I type M-d, bound to the gnus-group-describe-all-groups. The problem is that newsgroups shown are not sorted by name, making quite anooying to browse. I tried to edit the gnus-group-describe-all-groups function as follows: (defun gnus-group-describe-all-groups (&optional force) "Pop up a buffer with descriptions of all newsgroups." (interactive "P") (when force (setq gnus-description-hashtb nil)) (when (not (or gnus-description-hashtb (gnus-read-all-descriptions-files))) (error "Couldn't request descriptions file")) ;; MODIFCATIONS START HERE ;; remove newsgroups with strange names that make sorting fail (setq gnus-description-hashtb (remove-if 'numberp gnus-description-hashtb)) ;; sort the gnus-description-hashtb (setq gnus-description-hashtb (cl-sort gnus-description-hashtb (lambda (x y) (string< (symbol-name y) (symbol-name x))))) ;; MODIFICATIONS END HERE (let ((buffer-read-only nil) b) (erase-buffer) (mapatoms (lambda (group) (setq b (point)) (let ((charset (gnus-group-name-charset nil (symbol-name group)))) (insert (format " *: %-20s %s\n" (gnus-group-name-decode (symbol-name group) charset) (gnus-group-name-decode (symbol-value group) charset)))) (gnus-add-text-properties b (1+ b) (list 'gnus-group group 'gnus-unread t 'gnus-marked nil 'gnus-level (1+ gnus-level-subscribed)))) gnus-description-hashtb) (goto-char (point-min)) (gnus-group-position-point))) Basically, since gnus-description-hashtb is a vector (not an hash-table as the name would suggest) of symbol whose name is the name of the newsgroup, my approach is to sort such vector and then let the mapatoms function work. I placed this function in my *scratch* buffer and evaluated it after loading Gnus, but reloading the newsgroup list shows no effect: the newsgroup list is still unsorted. Please note that I am not an expert Lisp programmer nor an expert GNU Emacs user. How could I solve this problem? Thanks in advance, -- Emanuele Santoro