* Topic sorting @ 1999-10-21 17:35 Toni Drabik 1999-10-21 18:40 ` Robin S. Socha ` (2 more replies) 0 siblings, 3 replies; 9+ messages in thread From: Toni Drabik @ 1999-10-21 17:35 UTC (permalink / raw) It seems to me that there is no easy way to sort group topics. Gnus manual explains only how to sort groups. I suppose that I should manually edit `.newsrc.eld' file to change the order in which topics appear in my *Group* buffer? Wouldn't it be nice if this could be done in more elegant fashion? -- Toni Drabik <tdrabik@public.srce.hr> Warning: This article may be fatal if swallowed. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Topic sorting 1999-10-21 17:35 Topic sorting Toni Drabik @ 1999-10-21 18:40 ` Robin S. Socha 1999-10-21 19:09 ` Hrvoje Niksic 1999-10-21 20:07 ` Justin Sheehy 1999-10-21 20:41 ` Shenghuo ZHU 2 siblings, 1 reply; 9+ messages in thread From: Robin S. Socha @ 1999-10-21 18:40 UTC (permalink / raw) Cc: ding * Toni Drabik <tdrabik@public.srce.hr> writes: > It seems to me that there is no easy way to sort group topics. Gnus > manual explains only how to sort groups. I suppose that I should > manually edit `.newsrc.eld' file to change the order in which topics > appear in my *Group* buffer? C-h a gnus.*topic RET: gnus-topic-sort-groups - Sort the current topic according to FUNC. [...] -- Robin S. Socha <http://socha.net/Gnus/> ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Topic sorting 1999-10-21 18:40 ` Robin S. Socha @ 1999-10-21 19:09 ` Hrvoje Niksic 1999-10-21 20:34 ` Robin S. Socha 0 siblings, 1 reply; 9+ messages in thread From: Hrvoje Niksic @ 1999-10-21 19:09 UTC (permalink / raw) "Robin S. Socha" <robin@socha.net> writes: > * Toni Drabik <tdrabik@public.srce.hr> writes: > > It seems to me that there is no easy way to sort group topics. Gnus > > manual explains only how to sort groups. I suppose that I should > > manually edit `.newsrc.eld' file to change the order in which topics > > appear in my *Group* buffer? > > C-h a gnus.*topic RET: > gnus-topic-sort-groups - Sort the current topic according to FUNC. > [...] Are you sure this does what Toni wants? I haven't tried it, but I believe that gnus-topic-sort-groups sorts the groups within a particular topic, whereas Toni wants to sort topics themselves. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Topic sorting 1999-10-21 19:09 ` Hrvoje Niksic @ 1999-10-21 20:34 ` Robin S. Socha 1999-10-22 14:16 ` Toni Drabik 0 siblings, 1 reply; 9+ messages in thread From: Robin S. Socha @ 1999-10-21 20:34 UTC (permalink / raw) * Hrvoje Niksic <hniksic@srce.hr> writes: > "Robin S. Socha" <robin@socha.net> writes: >> * Toni Drabik <tdrabik@public.srce.hr> writes: >> > It seems to me that there is no easy way to sort group topics. Gnus >> > manual explains only how to sort groups. I suppose that I should >> > manually edit `.newsrc.eld' file to change the order in which >> > topics appear in my *Group* buffer? Ok. Just C-k and C-y them in the order you like. >> C-h a gnus.*topic RET: gnus-topic-sort-groups - Sort the current >> topic according to FUNC. [...] > Are you sure this does what Toni wants? No. Indeed, I was talking BS. > I haven't tried it, but I believe that gnus-topic-sort-groups sorts > the groups within a particular topic, whereas Toni wants to sort > topics themselves. I stand corrected. :-/ -- Robin S. Socha <http://socha.net/Gnus/> ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Topic sorting 1999-10-21 20:34 ` Robin S. Socha @ 1999-10-22 14:16 ` Toni Drabik 1999-10-22 15:13 ` Shenghuo ZHU 0 siblings, 1 reply; 9+ messages in thread From: Toni Drabik @ 1999-10-22 14:16 UTC (permalink / raw) "Robin S. Socha" <robin@socha.net> writes: [...] > >> > manual explains only how to sort groups. I suppose that I should > >> > manually edit `.newsrc.eld' file to change the order in which > >> > topics appear in my *Group* buffer? > > Ok. Just C-k and C-y them in the order you like. Justin Sheehy <dworkin@ccs.neu.edu> writes: [...] > > I suppose that I should manually edit `.newsrc.eld' file to change > > the order in which topics appear in my *Group* buffer? > > You could... or you could kill and yank them with C-k and C-y Thanks. Shenghuo ZHU <zsh@cs.rochester.edu> writes: > Toni> Wouldn't it be nice if this could be done in more elegant fashion? > > [...] > > I just wrote the function. I'll put it into CVS if people like it. Yes, please. -- Toni Drabik <tdrabik@public.srce.hr> Warning: This article may be fatal if swallowed. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Topic sorting 1999-10-22 14:16 ` Toni Drabik @ 1999-10-22 15:13 ` Shenghuo ZHU 0 siblings, 0 replies; 9+ messages in thread From: Shenghuo ZHU @ 1999-10-22 15:13 UTC (permalink / raw) [-- Attachment #1: Type: text/plain, Size: 641 bytes --] >>>>> "Toni" == Toni Drabik <tdrabik@public.srce.hr> writes: [...] >> I just wrote the function. I'll put it into CVS if people like it. Toni> Yes, please. [...] CVS'd (Topics Topics Sort). Another function, gnus-move-topic, will move topic itself by pressing `T m' on a topic button while no groups are marked. -- Shenghuo ZHU 1999-10-22 11:03:00 Shenghuo ZHU <zsh@cs.rochester.edu> * gnus-topic.el (gnus-topic-sort-topics-1): New function. (gnus-topic-sort-topics): New function. (gnus-topic-make-menu-bar): Add sort-topics. (gnus-topic-move): New function. (gnus-topic-move-group): Move the topic if no group selected. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 97-113.diff --] [-- Type: text/x-patch, Size: 3967 bytes --] Index: gnus-topic.el =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/gnus-topic.el,v retrieving revision 5.8 diff -u -r5.8 gnus-topic.el --- gnus-topic.el 1999/09/27 21:32:59 5.8 +++ gnus-topic.el 1999/10/22 15:08:22 @@ -982,6 +982,7 @@ ["Create" gnus-topic-create-topic t] ["Mark" gnus-topic-mark-topic t] ["Indent" gnus-topic-indent t] + ["Sort" gnus-topic-sort-topics t] ["Toggle hide empty" gnus-topic-toggle-display-empty-topics t] ["Edit parameters" gnus-topic-edit-parameters t]) ["List active" gnus-topic-list-active t])))) @@ -1120,23 +1121,25 @@ (completing-read "Move to topic: " gnus-topic-alist nil t))) (let ((groups (gnus-group-process-prefix n)) (topicl (assoc topic gnus-topic-alist)) - (start-group (progn (forward-line 1) (gnus-group-group-name))) (start-topic (gnus-group-topic-name)) + (start-group (progn (forward-line 1) (gnus-group-group-name))) entry) - (mapcar - (lambda (g) - (gnus-group-remove-mark g) - (when (and - (setq entry (assoc (gnus-current-topic) gnus-topic-alist)) - (not copyp)) - (setcdr entry (gnus-delete-first g (cdr entry)))) - (nconc topicl (list g))) - groups) - (gnus-topic-enter-dribble) - (if start-group - (gnus-group-goto-group start-group) - (gnus-topic-goto-topic start-topic)) - (gnus-group-list-groups))) + (if (and (not groups) (not copyp) start-topic) + (gnus-topic-move start-topic topic) + (mapcar + (lambda (g) + (gnus-group-remove-mark g) + (when (and + (setq entry (assoc (gnus-current-topic) gnus-topic-alist)) + (not copyp)) + (setcdr entry (gnus-delete-first g (cdr entry)))) + (nconc topicl (list g))) + groups) + (gnus-topic-enter-dribble) + (if start-group + (gnus-group-goto-group start-group) + (gnus-topic-goto-topic start-topic)) + (gnus-group-list-groups)))) (defun gnus-topic-remove-group (&optional arg) "Remove the current group from the topic." @@ -1475,6 +1478,55 @@ If REVERSE, sort in reverse order." (interactive "P") (gnus-topic-sort-groups 'gnus-group-sort-by-method reverse)) + +(defun gnus-topic-sort-topics-1 (top reverse) + (if (cdr top) + (let ((subtop + (mapcar `(lambda (top) + (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 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 topics in : " 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))) + (gnus-topic-sort-topics-1 topic-topology reverse) + (gnus-topic-enter-dribble) + (gnus-group-list-groups) + (gnus-topic-goto-topic topic))) + +(defun gnus-topic-move (current to) + "Move the CURRENT topic to TO." + (interactive + (list + (gnus-group-topic-name) + (completing-read "Move to topic: " gnus-topic-alist nil t))) + (unless (and current to) + (error "Can't find topic")) + (let ((current-top (cdr (gnus-topic-find-topology current))) + (to-top (cdr (gnus-topic-find-topology to)))) + (unless current-top + (error "Can't find topic `%s'" current)) + (unless to-top + (error "Can't find topic `%s'" to)) + (if (gnus-topic-find-topology to current-top 0) ;; Don't care the level + (error "Can't move `%s' to its sub-level" current)) + (gnus-topic-find-topology current nil nil 'delete) + (while (cdr to-top) + (setq to-top (cdr to-top))) + (setcdr to-top (list current-top)) + (gnus-topic-enter-dribble) + (gnus-group-list-groups) + (gnus-topic-goto-topic current))) (provide 'gnus-topic) ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Topic sorting 1999-10-21 17:35 Topic sorting Toni Drabik 1999-10-21 18:40 ` Robin S. Socha @ 1999-10-21 20:07 ` Justin Sheehy 1999-10-21 20:41 ` Shenghuo ZHU 2 siblings, 0 replies; 9+ messages in thread From: Justin Sheehy @ 1999-10-21 20:07 UTC (permalink / raw) Toni Drabik <tdrabik@public.srce.hr> writes: > I suppose that I should manually edit `.newsrc.eld' file to change > the order in which topics appear in my *Group* buffer? You could... or you could kill and yank them with C-k and C-y -Justin ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Topic sorting 1999-10-21 17:35 Topic sorting Toni Drabik 1999-10-21 18:40 ` Robin S. Socha 1999-10-21 20:07 ` Justin Sheehy @ 1999-10-21 20:41 ` Shenghuo ZHU 1999-10-22 6:33 ` Norbert Koch 2 siblings, 1 reply; 9+ messages in thread From: Shenghuo ZHU @ 1999-10-21 20:41 UTC (permalink / raw) >>>>> "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))) ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Topic sorting 1999-10-21 20:41 ` Shenghuo ZHU @ 1999-10-22 6:33 ` Norbert Koch 0 siblings, 0 replies; 9+ messages in thread From: Norbert Koch @ 1999-10-22 6:33 UTC (permalink / raw) Cc: ding Shenghuo ZHU <zsh@cs.rochester.edu> writes: > I just wrote the function. I'll put it into CVS if people like it. Please do so. If Lars doesn't like it, he'll remove it anyway, though I doubt it :-) norbert. ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~1999-10-22 15:13 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 1999-10-21 17:35 Topic sorting 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 1999-10-22 6:33 ` Norbert Koch
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).