Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* [GNUS] Displaying available news-groups, sorted by name
@ 2016-02-12 19:49 Emanuele Santoro
  2016-02-12 22:31 ` Adam Sjøgren
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Emanuele Santoro @ 2016-02-12 19:49 UTC (permalink / raw)
  To: info-gnus-english


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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [GNUS] Displaying available news-groups, sorted by name
  2016-02-12 19:49 [GNUS] Displaying available news-groups, sorted by name Emanuele Santoro
@ 2016-02-12 22:31 ` Adam Sjøgren
  2016-02-13  1:55   ` Emanuel Berg
  2016-02-13  1:50 ` Emanuel Berg
  2016-02-13  7:45 ` Lars Ingebrigtsen
  2 siblings, 1 reply; 7+ messages in thread
From: Adam Sjøgren @ 2016-02-12 22:31 UTC (permalink / raw)
  To: info-gnus-english

Not really an answer to your question, but if you go to the *Server*
buffer (by pressing ^ in the *Group* buffer), and then press RET on the
name of the server, I think you get the list of newsgroup sorted?

You can then (un)subscribe using u and exit the list with q and the
*Server* buffer with q as well.


  Best regards,

    Adam

-- 
 "Never never mind."                                          Adam Sjøgren
                                                         asjo@koldfront.dk


_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [GNUS] Displaying available news-groups, sorted by name
  2016-02-12 19:49 [GNUS] Displaying available news-groups, sorted by name Emanuele Santoro
  2016-02-12 22:31 ` Adam Sjøgren
@ 2016-02-13  1:50 ` Emanuel Berg
  2016-02-13  7:45 ` Lars Ingebrigtsen
  2 siblings, 0 replies; 7+ messages in thread
From: Emanuel Berg @ 2016-02-13  1:50 UTC (permalink / raw)
  To: info-gnus-english

Emanuele Santoro <manu@santoro.tk> writes:

> 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.

Speaking of "browse", another option is to, in the
Group buffer, do `gnus-group-enter-server-mode', then
find your server for news (e.g., news.gmane.org), and
hit RET.

Here is a screenshot what it can look like:

    http://user.it.uu.se/~embe8573/pics/gnus-server-color.png

I write "can" because to get the font lock, use the
font stuff in this file:

    http://user.it.uu.se/~embe8573/conf/emacs-init/gnus/browse.el

But to get the *sorting*, you don't have to
do anything!

> Please note that I am not an expert Lisp programmer
> nor an expert GNU Emacs user.

Who is? :)

-- 
underground experts united
http://user.it.uu.se/~embe8573



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [GNUS] Displaying available news-groups, sorted by name
  2016-02-12 22:31 ` Adam Sjøgren
@ 2016-02-13  1:55   ` Emanuel Berg
  2016-02-13 12:33     ` Adam Sjøgren
  0 siblings, 1 reply; 7+ messages in thread
From: Emanuel Berg @ 2016-02-13  1:55 UTC (permalink / raw)
  To: info-gnus-english

asjo@koldfront.dk (Adam Sjøgren) writes:

> Not really an answer to your question, but if you go
> to the *Server* buffer (by pressing ^ in the *Group*
> buffer), and then press RET on the name of the
> server, I think you get the list of
> newsgroup sorted?

Better yet, it is not only "sorted", it is *organized*
and all spelled out with the sweet old Usenet
notation, from the generic to the specific:

    comp.text.tex
    rec.bicycles.tech
    rec.sport.boxing

but now with the Gmane prefix as well:

    gmane.comp.graphics.gnuplot.user
    gmane.emacs.erc.general
    gmane.emacs.w3m

-- 
underground experts united
http://user.it.uu.se/~embe8573


_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [GNUS] Displaying available news-groups, sorted by name
  2016-02-12 19:49 [GNUS] Displaying available news-groups, sorted by name Emanuele Santoro
  2016-02-12 22:31 ` Adam Sjøgren
  2016-02-13  1:50 ` Emanuel Berg
@ 2016-02-13  7:45 ` Lars Ingebrigtsen
  2 siblings, 0 replies; 7+ messages in thread
From: Lars Ingebrigtsen @ 2016-02-13  7:45 UTC (permalink / raw)
  To: info-gnus-english

Emanuele Santoro <manu@santoro.tk> writes:

> 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've now changed the function to sort the groups before inserting.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [GNUS] Displaying available news-groups, sorted by name
  2016-02-13  1:55   ` Emanuel Berg
@ 2016-02-13 12:33     ` Adam Sjøgren
  2016-02-13 17:59       ` Emanuel Berg
  0 siblings, 1 reply; 7+ messages in thread
From: Adam Sjøgren @ 2016-02-13 12:33 UTC (permalink / raw)
  To: info-gnus-english

Emanuel writes:

> Better yet, it is not only "sorted", it is *organized* and all spelled
> out with the sweet old Usenet notation, from the generic to the
> specific:

Uh. I'm pretty sure that is nothing something Gnus does - Gnus just
shows the groups sorted.


  Best regards,

    Adam

-- 
 "Too little imagination, too much stomach acid!"             Adam Sjøgren
                                                         asjo@koldfront.dk


_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [GNUS] Displaying available news-groups, sorted by name
  2016-02-13 12:33     ` Adam Sjøgren
@ 2016-02-13 17:59       ` Emanuel Berg
  0 siblings, 0 replies; 7+ messages in thread
From: Emanuel Berg @ 2016-02-13 17:59 UTC (permalink / raw)
  To: info-gnus-english

asjo@koldfront.dk (Adam Sjøgren) writes:

>> Better yet, it is not only "sorted", it is
>> *organized* and all spelled out with the sweet old
>> Usenet notation, from the generic to the specific:
>
> Uh. I'm pretty sure that is nothing something Gnus
> does - Gnus just shows the groups sorted.

If one group was called emacs.gnus and the other
w3m.emacs they wouldn't be close to each other because
sorting alphabetically would place emacs.gnus at "E"
and w3m.emacs at "w".

So the organization makes the sorting have an even
better result!

-- 
underground experts united
http://user.it.uu.se/~embe8573


_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-02-13 17:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-12 19:49 [GNUS] Displaying available news-groups, sorted by name Emanuele Santoro
2016-02-12 22:31 ` Adam Sjøgren
2016-02-13  1:55   ` Emanuel Berg
2016-02-13 12:33     ` Adam Sjøgren
2016-02-13 17:59       ` Emanuel Berg
2016-02-13  1:50 ` Emanuel Berg
2016-02-13  7:45 ` Lars Ingebrigtsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).