Gnus development mailing list
 help / color / mirror / Atom feed
From: Shenghuo ZHU <zsh@cs.rochester.edu>
Subject: Re: Topic sorting
Date: 21 Oct 1999 16:41:32 -0400	[thread overview]
Message-ID: <5bhfjkfnur.fsf@giga.cs.rochester.edu> (raw)
In-Reply-To: Toni Drabik's message of "21 Oct 1999 19:35:03 +0200"

>>>>> "Toni" == Toni Drabik <tdrabik@public.srce.hr> writes:

Toni> It seems to me that there is no easy way to sort group
Toni> topics. Gnus manual explains only how to sort groups. I suppose
Toni> that I should manually edit `.newsrc.eld' file to change the
Toni> order in which topics appear in my *Group* buffer?

Toni> Wouldn't it be nice if this could be done in more elegant
Toni> fashion?

[...]

I just wrote the function. I'll put it into CVS if people like it.

-- 
Shenghuo ZHU


(defun zsh/gnus-topic-sort-topics-1 (top reverse)
  (if (cdr top)
      (let ((subtop
	     (mapcar `(lambda (top)
			(zsh/gnus-topic-sort-topics-1 top ,reverse))
		     (sort (cdr top)
			   '(lambda (t1 t2) 
			      (string-lessp (caar t1) (caar t2)))))))
	(setcdr top (if reverse (reverse subtop) subtop))))
  top)

(defun zsh/gnus-topic-sort-topics (&optional topic reverse)
  "Sort topics in TOPIC alphabeticaly by topic name.
If REVERSE, reverse the sorting order."
  (interactive 
   (list (completing-read "Sort topic: " gnus-topic-alist nil t 
			  (gnus-current-topic))
	 current-prefix-arg))
  (let ((topic-topology (or (and topic (cdr (gnus-topic-find-topology topic)))
			    gnus-topic-topology)))
    (zsh/gnus-topic-sort-topics-1 topic-topology reverse)
    (gnus-topic-enter-dribble)
    (gnus-group-list-groups)
    (gnus-topic-goto-topic topic)))


  parent reply	other threads:[~1999-10-21 20:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-10-21 17:35 Toni Drabik
1999-10-21 18:40 ` Robin S. Socha
1999-10-21 19:09   ` Hrvoje Niksic
1999-10-21 20:34     ` Robin S. Socha
1999-10-22 14:16       ` Toni Drabik
1999-10-22 15:13         ` Shenghuo ZHU
1999-10-21 20:07 ` Justin Sheehy
1999-10-21 20:41 ` Shenghuo ZHU [this message]
1999-10-22  6:33   ` Norbert Koch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5bhfjkfnur.fsf@giga.cs.rochester.edu \
    --to=zsh@cs.rochester.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).