Mercurial > emacs
annotate lisp/gnus/gnus-topic.el @ 61693:ee35f03204fe
Remove eol whitespace; nfc.
author | Thien-Thi Nguyen <ttn@gnuvola.org> |
---|---|
date | Wed, 20 Apr 2005 10:54:46 +0000 |
parents | 55fd4f77387a |
children | 18a818a2ee7c cce1c0ee76ee |
rev | line source |
---|---|
17493 | 1 ;;; gnus-topic.el --- a folding minor mode for Gnus group buffers |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
2 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3 ;; Free Software Foundation, Inc. |
17493 | 4 |
5 ;; Author: Ilja Weis <kult@uni-paderborn.de> | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
6 ;; Lars Magne Ingebrigtsen <larsi@gnus.org> |
17493 | 7 ;; Keywords: news |
8 | |
9 ;; This file is part of GNU Emacs. | |
10 | |
11 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
12 ;; it under the terms of the GNU General Public License as published by | |
13 ;; the Free Software Foundation; either version 2, or (at your option) | |
14 ;; any later version. | |
15 | |
16 ;; GNU Emacs is distributed in the hope that it will be useful, | |
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 ;; GNU General Public License for more details. | |
20 | |
21 ;; You should have received a copy of the GNU General Public License | |
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
24 ;; Boston, MA 02111-1307, USA. | |
25 | |
26 ;;; Commentary: | |
27 | |
28 ;;; Code: | |
29 | |
19521
6f6cf9184e93
Require cl at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
17493
diff
changeset
|
30 (eval-when-compile (require 'cl)) |
6f6cf9184e93
Require cl at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
17493
diff
changeset
|
31 |
17493 | 32 (require 'gnus) |
33 (require 'gnus-group) | |
34 (require 'gnus-start) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
35 (require 'gnus-util) |
17493 | 36 |
37 (defgroup gnus-topic nil | |
38 "Group topics." | |
39 :group 'gnus-group) | |
40 | |
41 (defvar gnus-topic-mode nil | |
42 "Minor mode for Gnus group buffers.") | |
43 | |
44 (defcustom gnus-topic-mode-hook nil | |
45 "Hook run in topic mode buffers." | |
46 :type 'hook | |
47 :group 'gnus-topic) | |
48 | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
49 (when (featurep 'xemacs) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
50 (add-hook 'gnus-topic-mode-hook 'gnus-xmas-topic-menu-add)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
51 |
17493 | 52 (defcustom gnus-topic-line-format "%i[ %(%{%n%}%) -- %A ]%v\n" |
53 "Format of topic lines. | |
54 It works along the same lines as a normal formatting string, | |
55 with some simple extensions. | |
56 | |
57 %i Indentation based on topic level. | |
58 %n Topic name. | |
59 %v Nothing if the topic is visible, \"...\" otherwise. | |
60 %g Number of groups in the topic. | |
61 %a Number of unread articles in the groups in the topic. | |
62 %A Number of unread articles in the groups in the topic and its subtopics. | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
63 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
64 General format specifiers can also be used. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
65 See Info node `(gnus)Formatting Variables'." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
66 :link '(custom-manual "(gnus)Formatting Variables") |
17493 | 67 :type 'string |
68 :group 'gnus-topic) | |
69 | |
70 (defcustom gnus-topic-indent-level 2 | |
71 "*How much each subtopic should be indented." | |
72 :type 'integer | |
73 :group 'gnus-topic) | |
74 | |
75 (defcustom gnus-topic-display-empty-topics t | |
76 "*If non-nil, display the topic lines even of topics that have no unread articles." | |
77 :type 'boolean | |
78 :group 'gnus-topic) | |
79 | |
80 ;; Internal variables. | |
81 | |
82 (defvar gnus-topic-active-topology nil) | |
83 (defvar gnus-topic-active-alist nil) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
84 (defvar gnus-topic-unreads nil) |
17493 | 85 |
86 (defvar gnus-topology-checked-p nil | |
87 "Whether the topology has been checked in this session.") | |
88 | |
89 (defvar gnus-topic-killed-topics nil) | |
90 (defvar gnus-topic-inhibit-change-level nil) | |
91 | |
92 (defconst gnus-topic-line-format-alist | |
93 `((?n name ?s) | |
94 (?v visible ?s) | |
95 (?i indentation ?s) | |
96 (?g number-of-groups ?d) | |
97 (?a (gnus-topic-articles-in-topic entries) ?d) | |
98 (?A total-number-of-articles ?d) | |
99 (?l level ?d))) | |
100 | |
101 (defvar gnus-topic-line-format-spec nil) | |
102 | |
103 ;;; Utility functions | |
104 | |
105 (defun gnus-group-topic-name () | |
106 "The name of the topic on the current line." | |
107 (let ((topic (get-text-property (gnus-point-at-bol) 'gnus-topic))) | |
108 (and topic (symbol-name topic)))) | |
109 | |
110 (defun gnus-group-topic-level () | |
111 "The level of the topic on the current line." | |
112 (get-text-property (gnus-point-at-bol) 'gnus-topic-level)) | |
113 | |
114 (defun gnus-group-topic-unread () | |
115 "The number of unread articles in topic on the current line." | |
116 (get-text-property (gnus-point-at-bol) 'gnus-topic-unread)) | |
117 | |
118 (defun gnus-topic-unread (topic) | |
119 "Return the number of unread articles in TOPIC." | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
120 (or (cdr (assoc topic gnus-topic-unreads)) |
17493 | 121 0)) |
122 | |
123 (defun gnus-group-topic-p () | |
124 "Return non-nil if the current line is a topic." | |
125 (gnus-group-topic-name)) | |
126 | |
127 (defun gnus-topic-visible-p () | |
128 "Return non-nil if the current topic is visible." | |
129 (get-text-property (gnus-point-at-bol) 'gnus-topic-visible)) | |
130 | |
131 (defun gnus-topic-articles-in-topic (entries) | |
132 (let ((total 0) | |
133 number) | |
134 (while entries | |
135 (when (numberp (setq number (car (pop entries)))) | |
136 (incf total number))) | |
137 total)) | |
138 | |
139 (defun gnus-group-topic (group) | |
140 "Return the topic GROUP is a member of." | |
141 (let ((alist gnus-topic-alist) | |
142 out) | |
143 (while alist | |
144 (when (member group (cdar alist)) | |
145 (setq out (caar alist) | |
146 alist nil)) | |
147 (setq alist (cdr alist))) | |
148 out)) | |
149 | |
150 (defun gnus-group-parent-topic (group) | |
151 "Return the topic GROUP is member of by looking at the group buffer." | |
152 (save-excursion | |
153 (set-buffer gnus-group-buffer) | |
154 (if (gnus-group-goto-group group) | |
155 (gnus-current-topic) | |
156 (gnus-group-topic group)))) | |
157 | |
158 (defun gnus-topic-goto-topic (topic) | |
159 (when topic | |
160 (gnus-goto-char (text-property-any (point-min) (point-max) | |
161 'gnus-topic (intern topic))))) | |
162 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
163 (defun gnus-topic-jump-to-topic (topic) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
164 "Go to TOPIC." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
165 (interactive |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
166 (list (completing-read "Go to topic: " |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
167 (mapcar 'list (gnus-topic-list)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
168 nil t))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
169 (dolist (topic (gnus-current-topics topic)) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
170 (gnus-topic-goto-topic topic) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
171 (gnus-topic-fold t)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
172 (gnus-topic-goto-topic topic)) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48588
diff
changeset
|
173 |
17493 | 174 (defun gnus-current-topic () |
175 "Return the name of the current topic." | |
176 (let ((result | |
177 (or (get-text-property (point) 'gnus-topic) | |
178 (save-excursion | |
179 (and (gnus-goto-char (previous-single-property-change | |
180 (point) 'gnus-topic)) | |
181 (get-text-property (max (1- (point)) (point-min)) | |
182 'gnus-topic)))))) | |
183 (when result | |
184 (symbol-name result)))) | |
185 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
186 (defun gnus-current-topics (&optional topic) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
187 "Return a list of all current topics, lowest in hierarchy first. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
188 If TOPIC, start with that topic." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
189 (let ((topic (or topic (gnus-current-topic))) |
17493 | 190 topics) |
191 (while topic | |
192 (push topic topics) | |
193 (setq topic (gnus-topic-parent-topic topic))) | |
194 (nreverse topics))) | |
195 | |
196 (defun gnus-group-active-topic-p () | |
197 "Say whether the current topic comes from the active topics." | |
198 (save-excursion | |
199 (beginning-of-line) | |
200 (get-text-property (point) 'gnus-active))) | |
201 | |
31785 | 202 (defun gnus-topic-find-groups (topic &optional level all lowest recursive) |
203 "Return entries for all visible groups in TOPIC. | |
204 If RECURSIVE is t, return groups in its subtopics too." | |
17493 | 205 (let ((groups (cdr (assoc topic gnus-topic-alist))) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
206 info clevel unread group params visible-groups entry active) |
17493 | 207 (setq lowest (or lowest 1)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
208 (setq level (or level gnus-level-unsubscribed)) |
17493 | 209 ;; We go through the newsrc to look for matches. |
210 (while groups | |
211 (when (setq group (pop groups)) | |
212 (setq entry (gnus-gethash group gnus-newsrc-hashtb) | |
213 info (nth 2 entry) | |
214 params (gnus-info-params info) | |
215 active (gnus-active group) | |
216 unread (or (car entry) | |
217 (and (not (equal group "dummy.group")) | |
218 active | |
219 (- (1+ (cdr active)) (car active)))) | |
220 clevel (or (gnus-info-level info) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
221 (if (member group gnus-zombie-list) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
222 gnus-level-zombie gnus-level-killed)))) |
17493 | 223 (and |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
224 info ; nil means that the group is dead. |
17493 | 225 (<= clevel level) |
226 (>= clevel lowest) ; Is inside the level we want. | |
227 (or all | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
228 (if (or (eq unread t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
229 (eq unread nil)) |
17493 | 230 gnus-group-list-inactive-groups |
231 (> unread 0)) | |
232 (and gnus-list-groups-with-ticked-articles | |
233 (cdr (assq 'tick (gnus-info-marks info)))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
234 ;; Has right readedness. |
17493 | 235 ;; Check for permanent visibility. |
236 (and gnus-permanently-visible-groups | |
237 (string-match gnus-permanently-visible-groups group)) | |
238 (memq 'visible params) | |
239 (cdr (assq 'visible params))) | |
240 ;; Add this group to the list of visible groups. | |
241 (push (or entry group) visible-groups))) | |
31785 | 242 (setq visible-groups (nreverse visible-groups)) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48588
diff
changeset
|
243 (when recursive |
31785 | 244 (if (eq recursive t) |
245 (setq recursive (cdr (gnus-topic-find-topology topic)))) | |
246 (mapcar (lambda (topic-topology) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48588
diff
changeset
|
247 (setq visible-groups |
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48588
diff
changeset
|
248 (nconc visible-groups |
31785 | 249 (gnus-topic-find-groups |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48588
diff
changeset
|
250 (caar topic-topology) |
31785 | 251 level all lowest topic-topology)))) |
252 (cdr recursive))) | |
253 visible-groups)) | |
17493 | 254 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
255 (defun gnus-topic-goto-previous-topic (n) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
256 "Go to the N'th previous topic." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
257 (interactive "p") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
258 (gnus-topic-goto-next-topic (- n))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
259 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
260 (defun gnus-topic-goto-next-topic (n) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
261 "Go to the N'th next topic." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
262 (interactive "p") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
263 (let ((backward (< n 0)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
264 (n (abs n)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
265 (topic (gnus-current-topic))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
266 (while (and (> n 0) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
267 (setq topic |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
268 (if backward |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
269 (gnus-topic-previous-topic topic) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
270 (gnus-topic-next-topic topic)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
271 (gnus-topic-goto-topic topic) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
272 (setq n (1- n))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
273 (when (/= 0 n) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
274 (gnus-message 7 "No more topics")) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
275 n)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
276 |
17493 | 277 (defun gnus-topic-previous-topic (topic) |
278 "Return the previous topic on the same level as TOPIC." | |
279 (let ((top (cddr (gnus-topic-find-topology | |
280 (gnus-topic-parent-topic topic))))) | |
281 (unless (equal topic (caaar top)) | |
282 (while (and top (not (equal (caaadr top) topic))) | |
283 (setq top (cdr top))) | |
284 (caaar top)))) | |
285 | |
286 (defun gnus-topic-parent-topic (topic &optional topology) | |
287 "Return the parent of TOPIC." | |
288 (unless topology | |
289 (setq topology gnus-topic-topology)) | |
290 (let ((parent (car (pop topology))) | |
291 result found) | |
292 (while (and topology | |
293 (not (setq found (equal (caaar topology) topic))) | |
294 (not (setq result (gnus-topic-parent-topic | |
295 topic (car topology))))) | |
296 (setq topology (cdr topology))) | |
297 (or result (and found parent)))) | |
298 | |
299 (defun gnus-topic-next-topic (topic &optional previous) | |
300 "Return the next sibling of TOPIC." | |
301 (let ((parentt (cddr (gnus-topic-find-topology | |
302 (gnus-topic-parent-topic topic)))) | |
303 prev) | |
304 (while (and parentt | |
305 (not (equal (caaar parentt) topic))) | |
306 (setq prev (caaar parentt) | |
307 parentt (cdr parentt))) | |
308 (if previous | |
309 prev | |
310 (caaadr parentt)))) | |
311 | |
312 (defun gnus-topic-forward-topic (num) | |
313 "Go to the next topic on the same level as the current one." | |
314 (let* ((topic (gnus-current-topic)) | |
315 (way (if (< num 0) 'gnus-topic-previous-topic | |
316 'gnus-topic-next-topic)) | |
317 (num (abs num))) | |
318 (while (and (not (zerop num)) | |
319 (setq topic (funcall way topic))) | |
320 (when (gnus-topic-goto-topic topic) | |
321 (decf num))) | |
322 (unless (zerop num) | |
323 (goto-char (point-max))) | |
324 num)) | |
325 | |
326 (defun gnus-topic-find-topology (topic &optional topology level remove) | |
327 "Return the topology of TOPIC." | |
328 (unless topology | |
329 (setq topology gnus-topic-topology) | |
330 (setq level 0)) | |
331 (let ((top topology) | |
332 result) | |
333 (if (equal (caar topology) topic) | |
334 (progn | |
335 (when remove | |
336 (delq topology remove)) | |
337 (cons level topology)) | |
338 (setq topology (cdr topology)) | |
339 (while (and topology | |
340 (not (setq result (gnus-topic-find-topology | |
341 topic (car topology) (1+ level) | |
342 (and remove top))))) | |
343 (setq topology (cdr topology))) | |
344 result))) | |
345 | |
346 (defvar gnus-tmp-topics nil) | |
347 (defun gnus-topic-list (&optional topology) | |
348 "Return a list of all topics in the topology." | |
349 (unless topology | |
350 (setq topology gnus-topic-topology | |
351 gnus-tmp-topics nil)) | |
352 (push (caar topology) gnus-tmp-topics) | |
353 (mapcar 'gnus-topic-list (cdr topology)) | |
354 gnus-tmp-topics) | |
355 | |
356 ;;; Topic parameter jazz | |
357 | |
358 (defun gnus-topic-parameters (topic) | |
359 "Return the parameters for TOPIC." | |
360 (let ((top (gnus-topic-find-topology topic))) | |
361 (when top | |
362 (nth 3 (cadr top))))) | |
363 | |
364 (defun gnus-topic-set-parameters (topic parameters) | |
365 "Set the topic parameters of TOPIC to PARAMETERS." | |
366 (let ((top (gnus-topic-find-topology topic))) | |
367 (unless top | |
368 (error "No such topic: %s" topic)) | |
369 ;; We may have to extend if there is no parameters here | |
370 ;; to begin with. | |
371 (unless (nthcdr 2 (cadr top)) | |
372 (nconc (cadr top) (list nil))) | |
373 (unless (nthcdr 3 (cadr top)) | |
374 (nconc (cadr top) (list nil))) | |
375 (setcar (nthcdr 3 (cadr top)) parameters) | |
376 (gnus-dribble-enter | |
377 (format "(gnus-topic-set-parameters %S '%S)" topic parameters)))) | |
378 | |
379 (defun gnus-group-topic-parameters (group) | |
380 "Compute the group parameters for GROUP taking into account inheritance from topics." | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
381 (let ((params-list (copy-sequence (gnus-group-get-parameter group)))) |
17493 | 382 (save-excursion |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
383 (nconc params-list |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
384 (gnus-topic-hierarchical-parameters |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
385 ;; First we try to go to the group within the group |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
386 ;; buffer and find the topic for the group that way. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
387 ;; This hopefully copes well with groups that are in |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
388 ;; more than one topic. Failing that (i.e. when the |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
389 ;; group isn't visible in the group buffer) we find a |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
390 ;; topic for the group via gnus-group-topic. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
391 (or (and (gnus-group-goto-group group) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
392 (gnus-current-topic)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
393 (gnus-group-topic group))))))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
394 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
395 (defun gnus-topic-hierarchical-parameters (topic) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
396 "Return a topic list computed for TOPIC." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
397 (let ((topics (gnus-current-topics topic)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
398 params-list param out params) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
399 (while topics |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
400 (push (gnus-topic-parameters (pop topics)) params-list)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
401 ;; We probably have lots of nil elements here, so |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
402 ;; we remove them. Probably faster than doing this "properly". |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
403 (setq params-list (delq nil params-list)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
404 ;; Now we have all the parameters, so we go through them |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
405 ;; and do inheritance in the obvious way. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
406 (while (setq params (pop params-list)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
407 (while (setq param (pop params)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
408 (when (atom param) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
409 (setq param (cons param t))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
410 ;; Override any old versions of this param. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
411 (gnus-pull (car param) out) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
412 (push param out))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
413 ;; Return the resulting parameter list. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
414 out)) |
17493 | 415 |
416 ;;; General utility functions | |
417 | |
418 (defun gnus-topic-enter-dribble () | |
419 (gnus-dribble-enter | |
420 (format "(setq gnus-topic-topology '%S)" gnus-topic-topology))) | |
421 | |
422 ;;; Generating group buffers | |
423 | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
424 (defun gnus-group-prepare-topics (level &optional predicate lowest |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
425 regexp list-topic topic-level) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
426 "List all newsgroups with unread articles of level LEVEL or lower. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
427 Use the `gnus-group-topics' to sort the groups. |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
428 If PREDICTE is a function, list groups that the function returns non-nil; |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
429 if it is t, list groups that have no unread articles. |
17493 | 430 If LOWEST is non-nil, list all newsgroups of level LOWEST or higher." |
431 (set-buffer gnus-group-buffer) | |
432 (let ((buffer-read-only nil) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
433 (lowest (or lowest 1)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
434 (not-in-list |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
435 (and gnus-group-listed-groups |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
436 (copy-sequence gnus-group-listed-groups)))) |
17493 | 437 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
438 (gnus-update-format-specifications nil 'topic) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
439 |
17493 | 440 (when (or (not gnus-topic-alist) |
441 (not gnus-topology-checked-p)) | |
442 (gnus-topic-check-topology)) | |
443 | |
444 (unless list-topic | |
445 (erase-buffer)) | |
446 | |
447 ;; List dead groups? | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
448 (when (or gnus-group-listed-groups |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
449 (and (>= level gnus-level-zombie) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
450 (<= lowest gnus-level-zombie))) |
17493 | 451 (gnus-group-prepare-flat-list-dead |
452 (setq gnus-zombie-list (sort gnus-zombie-list 'string<)) | |
453 gnus-level-zombie ?Z | |
454 regexp)) | |
455 | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
456 (when (or gnus-group-listed-groups |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
457 (and (>= level gnus-level-killed) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
458 (<= lowest gnus-level-killed))) |
17493 | 459 (gnus-group-prepare-flat-list-dead |
460 (setq gnus-killed-list (sort gnus-killed-list 'string<)) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
461 gnus-level-killed ?K regexp) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
462 (when not-in-list |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
463 (unless gnus-killed-hashtb |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
464 (gnus-make-hashtable-from-killed)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
465 (gnus-group-prepare-flat-list-dead |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
466 (gnus-remove-if (lambda (group) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
467 (or (gnus-gethash group gnus-newsrc-hashtb) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
468 (gnus-gethash group gnus-killed-hashtb))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
469 not-in-list) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
470 gnus-level-killed ?K regexp))) |
17493 | 471 |
472 ;; Use topics. | |
473 (prog1 | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
474 (when (or (< lowest gnus-level-zombie) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
475 gnus-group-listed-groups) |
17493 | 476 (if list-topic |
477 (let ((top (gnus-topic-find-topology list-topic))) | |
478 (gnus-topic-prepare-topic (cdr top) (car top) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
479 (or topic-level level) predicate |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
480 nil lowest regexp)) |
17493 | 481 (gnus-topic-prepare-topic gnus-topic-topology 0 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
482 (or topic-level level) predicate |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
483 nil lowest regexp))) |
17493 | 484 (gnus-group-set-mode-line) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
485 (setq gnus-group-list-mode (cons level predicate)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
486 (gnus-run-hooks 'gnus-group-prepare-hook)))) |
17493 | 487 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
488 (defun gnus-topic-prepare-topic (topicl level &optional list-level |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
489 predicate silent |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
490 lowest regexp) |
17493 | 491 "Insert TOPIC into the group buffer. |
492 If SILENT, don't insert anything. Return the number of unread | |
493 articles in the topic and its subtopics." | |
494 (let* ((type (pop topicl)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
495 (entries (gnus-topic-find-groups |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
496 (car type) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
497 (if gnus-group-listed-groups |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
498 gnus-level-killed |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
499 list-level) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
500 (or predicate gnus-group-listed-groups |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
501 (cdr (assq 'visible |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
502 (gnus-topic-hierarchical-parameters |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
503 (car type))))) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
504 (if gnus-group-listed-groups 0 lowest))) |
17493 | 505 (visiblep (and (eq (nth 1 type) 'visible) (not silent))) |
506 (gnus-group-indentation | |
507 (make-string (* gnus-topic-indent-level level) ? )) | |
508 (beg (progn (beginning-of-line) (point))) | |
509 (topicl (reverse topicl)) | |
510 (all-entries entries) | |
511 (point-max (point-max)) | |
512 (unread 0) | |
513 (topic (car type)) | |
514 info entry end active tick) | |
515 ;; Insert any sub-topics. | |
516 (while topicl | |
517 (incf unread | |
518 (gnus-topic-prepare-topic | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
519 (pop topicl) (1+ level) list-level predicate |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
520 (not visiblep) lowest regexp))) |
17493 | 521 (setq end (point)) |
522 (goto-char beg) | |
523 ;; Insert all the groups that belong in this topic. | |
524 (while (setq entry (pop entries)) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
525 (when (if (stringp entry) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
526 (gnus-group-prepare-logic |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
527 entry |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
528 (and |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
529 (or (not gnus-group-listed-groups) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
530 (if (< list-level gnus-level-zombie) nil |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
531 (let ((entry-level |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
532 (if (member entry gnus-zombie-list) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
533 gnus-level-zombie gnus-level-killed))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
534 (and (<= entry-level list-level) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
535 (>= entry-level lowest))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
536 (cond |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
537 ((stringp regexp) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
538 (string-match regexp entry)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
539 ((functionp regexp) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
540 (funcall regexp entry)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
541 ((null regexp) t) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
542 (t nil)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
543 (setq info (nth 2 entry)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
544 (gnus-group-prepare-logic |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
545 (gnus-info-group info) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
546 (and (or (not gnus-group-listed-groups) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
547 (let ((entry-level (gnus-info-level info))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
548 (and (<= entry-level list-level) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
549 (>= entry-level lowest)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
550 (or (not (functionp predicate)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
551 (funcall predicate info)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
552 (or (not (stringp regexp)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
553 (string-match regexp (gnus-info-group info)))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
554 (when visiblep |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
555 (if (stringp entry) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
556 ;; Dead groups. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
557 (gnus-group-insert-group-line |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
558 entry (if (member entry gnus-zombie-list) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
559 gnus-level-zombie gnus-level-killed) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
560 nil (- (1+ (cdr (setq active (gnus-active entry)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
561 (car active)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
562 nil) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
563 ;; Living groups. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
564 (when (setq info (nth 2 entry)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
565 (gnus-group-insert-group-line |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
566 (gnus-info-group info) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
567 (gnus-info-level info) (gnus-info-marks info) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
568 (car entry) (gnus-info-method info))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
569 (when (and (listp entry) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
570 (numberp (car entry))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
571 (incf unread (car entry))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
572 (when (listp entry) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
573 (setq tick t)))) |
17493 | 574 (goto-char beg) |
575 ;; Insert the topic line. | |
576 (when (and (not silent) | |
577 (or gnus-topic-display-empty-topics ;We want empty topics | |
578 (not (zerop unread)) ;Non-empty | |
579 tick ;Ticked articles | |
580 (/= point-max (point-max)))) ;Unactivated groups | |
581 (gnus-extent-start-open (point)) | |
582 (gnus-topic-insert-topic-line | |
583 (car type) visiblep | |
584 (not (eq (nth 2 type) 'hidden)) | |
585 level all-entries unread)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
586 (gnus-topic-update-unreads (car type) unread) |
17493 | 587 (goto-char end) |
588 unread)) | |
589 | |
590 (defun gnus-topic-remove-topic (&optional insert total-remove hide in-level) | |
591 "Remove the current topic." | |
592 (let ((topic (gnus-group-topic-name)) | |
593 (level (gnus-group-topic-level)) | |
594 (beg (progn (beginning-of-line) (point))) | |
595 buffer-read-only) | |
596 (when topic | |
597 (while (and (zerop (forward-line 1)) | |
598 (> (or (gnus-group-topic-level) (1+ level)) level))) | |
599 (delete-region beg (point)) | |
600 ;; Do the change in this rather odd manner because it has been | |
601 ;; reported that some topics share parts of some lists, for some | |
602 ;; reason. I have been unable to determine why this is the | |
603 ;; case, but this hack seems to take care of things. | |
604 (let ((data (cadr (gnus-topic-find-topology topic)))) | |
605 (setcdr data | |
606 (list (if insert 'visible 'invisible) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
607 (caddr data) |
17493 | 608 (cadddr data)))) |
609 (if total-remove | |
610 (setq gnus-topic-alist | |
611 (delq (assoc topic gnus-topic-alist) gnus-topic-alist)) | |
612 (gnus-topic-insert-topic topic in-level))))) | |
613 | |
614 (defun gnus-topic-insert-topic (topic &optional level) | |
615 "Insert TOPIC." | |
616 (gnus-group-prepare-topics | |
617 (car gnus-group-list-mode) (cdr gnus-group-list-mode) | |
618 nil nil topic level)) | |
619 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
620 (defun gnus-topic-fold (&optional insert topic) |
17493 | 621 "Remove/insert the current topic." |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
622 (let ((topic (or topic (gnus-group-topic-name)))) |
17493 | 623 (when topic |
624 (save-excursion | |
625 (if (not (gnus-group-active-topic-p)) | |
626 (gnus-topic-remove-topic | |
627 (or insert (not (gnus-topic-visible-p)))) | |
628 (let ((gnus-topic-topology gnus-topic-active-topology) | |
629 (gnus-topic-alist gnus-topic-active-alist) | |
630 (gnus-group-list-mode (cons 5 t))) | |
631 (gnus-topic-remove-topic | |
632 (or insert (not (gnus-topic-visible-p))) nil nil 9) | |
633 (gnus-topic-enter-dribble))))))) | |
634 | |
635 (defun gnus-topic-insert-topic-line (name visiblep shownp level entries | |
636 &optional unread) | |
637 (let* ((visible (if visiblep "" "...")) | |
638 (indentation (make-string (* gnus-topic-indent-level level) ? )) | |
639 (total-number-of-articles unread) | |
640 (number-of-groups (length entries)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
641 (active-topic (eq gnus-topic-alist gnus-topic-active-alist)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
642 gnus-tmp-header) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
643 (gnus-topic-update-unreads name unread) |
17493 | 644 (beginning-of-line) |
645 ;; Insert the text. | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
646 (if shownp |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
647 (gnus-add-text-properties |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
648 (point) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
649 (prog1 (1+ (point)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
650 (eval gnus-topic-line-format-spec)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
651 (list 'gnus-topic (intern name) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
652 'gnus-topic-level level |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
653 'gnus-topic-unread unread |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
654 'gnus-active active-topic |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
655 'gnus-topic-visible visiblep))))) |
17493 | 656 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
657 (defun gnus-topic-update-unreads (topic unreads) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
658 (setq gnus-topic-unreads (delq (assoc topic gnus-topic-unreads) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
659 gnus-topic-unreads)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
660 (push (cons topic unreads) gnus-topic-unreads)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
661 |
17493 | 662 (defun gnus-topic-update-topics-containing-group (group) |
663 "Update all topics that have GROUP as a member." | |
664 (when (and (eq major-mode 'gnus-group-mode) | |
665 gnus-topic-mode) | |
666 (save-excursion | |
667 (let ((alist gnus-topic-alist)) | |
668 ;; This is probably not entirely correct. If a topic | |
669 ;; isn't shown, then it's not updated. But the updating | |
670 ;; should be performed in any case, since the topic's | |
671 ;; parent should be updated. Pfft. | |
672 (while alist | |
673 (when (and (member group (cdar alist)) | |
674 (gnus-topic-goto-topic (caar alist))) | |
675 (gnus-topic-update-topic-line (caar alist))) | |
676 (pop alist)))))) | |
677 | |
678 (defun gnus-topic-update-topic () | |
679 "Update all parent topics to the current group." | |
680 (when (and (eq major-mode 'gnus-group-mode) | |
681 gnus-topic-mode) | |
682 (let ((group (gnus-group-group-name)) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
683 (m (point-marker)) |
17493 | 684 (buffer-read-only nil)) |
685 (when (and group | |
686 (gnus-get-info group) | |
687 (gnus-topic-goto-topic (gnus-current-topic))) | |
688 (gnus-topic-update-topic-line (gnus-group-topic-name)) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
689 (goto-char m) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
690 (set-marker m nil) |
17493 | 691 (gnus-group-position-point))))) |
692 | |
693 (defun gnus-topic-goto-missing-group (group) | |
694 "Place point where GROUP is supposed to be inserted." | |
695 (let* ((topic (gnus-group-topic group)) | |
696 (groups (cdr (assoc topic gnus-topic-alist))) | |
697 (g (cdr (member group groups))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
698 (unfound t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
699 entry) |
17493 | 700 ;; Try to jump to a visible group. |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
701 (while (and g |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
702 (not (gnus-group-goto-group (car g) t))) |
17493 | 703 (pop g)) |
704 ;; It wasn't visible, so we try to see where to insert it. | |
705 (when (not g) | |
706 (setq g (cdr (member group (reverse groups)))) | |
707 (while (and g unfound) | |
708 (when (gnus-group-goto-group (pop g) t) | |
709 (forward-line 1) | |
710 (setq unfound nil))) | |
711 (when (and unfound | |
712 topic | |
713 (not (gnus-topic-goto-missing-topic topic))) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
714 (gnus-topic-display-missing-topic topic))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
715 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
716 (defun gnus-topic-display-missing-topic (topic) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
717 "Insert topic lines recursively for missing topics." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
718 (let ((parent (gnus-topic-find-topology |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
719 (gnus-topic-parent-topic topic)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
720 (when (and parent |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
721 (not (gnus-topic-goto-missing-topic (caadr parent)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
722 (gnus-topic-display-missing-topic (caadr parent)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
723 (gnus-topic-goto-missing-topic topic) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
724 (let* ((top (gnus-topic-find-topology topic)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
725 (children (cddr top)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
726 (type (cadr top)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
727 (unread 0) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
728 (entries (gnus-topic-find-groups |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
729 (car type) (car gnus-group-list-mode) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
730 (cdr gnus-group-list-mode))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
731 entry) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
732 (while children |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
733 (incf unread (gnus-topic-unread (caar (pop children))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
734 (while (setq entry (pop entries)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
735 (when (numberp (car entry)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
736 (incf unread (car entry)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
737 (gnus-topic-insert-topic-line |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
738 topic t t (car (gnus-topic-find-topology topic)) nil unread))) |
17493 | 739 |
740 (defun gnus-topic-goto-missing-topic (topic) | |
741 (if (gnus-topic-goto-topic topic) | |
742 (forward-line 1) | |
743 ;; Topic not displayed. | |
744 (let* ((top (gnus-topic-find-topology | |
745 (gnus-topic-parent-topic topic))) | |
746 (tp (reverse (cddr top)))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
747 (if (not top) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
748 (gnus-topic-insert-topic-line |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
749 topic t t (car (gnus-topic-find-topology topic)) nil 0) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
750 (while (not (equal (caaar tp) topic)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
751 (setq tp (cdr tp))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
752 (pop tp) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
753 (while (and tp |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
754 (not (gnus-topic-goto-topic (caaar tp)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
755 (pop tp)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
756 (if tp |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
757 (gnus-topic-forward-topic 1) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
758 (gnus-topic-goto-missing-topic (caadr top))))) |
17493 | 759 nil)) |
760 | |
761 (defun gnus-topic-update-topic-line (topic-name &optional reads) | |
762 (let* ((top (gnus-topic-find-topology topic-name)) | |
763 (type (cadr top)) | |
764 (children (cddr top)) | |
765 (entries (gnus-topic-find-groups | |
766 (car type) (car gnus-group-list-mode) | |
767 (cdr gnus-group-list-mode))) | |
768 (parent (gnus-topic-parent-topic topic-name)) | |
769 (all-entries entries) | |
770 (unread 0) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
771 old-unread entry new-unread) |
17493 | 772 (when (gnus-topic-goto-topic (car type)) |
773 ;; Tally all the groups that belong in this topic. | |
774 (if reads | |
775 (setq unread (- (gnus-group-topic-unread) reads)) | |
776 (while children | |
777 (incf unread (gnus-topic-unread (caar (pop children))))) | |
778 (while (setq entry (pop entries)) | |
779 (when (numberp (car entry)) | |
780 (incf unread (car entry))))) | |
781 (setq old-unread (gnus-group-topic-unread)) | |
782 ;; Insert the topic line. | |
783 (gnus-topic-insert-topic-line | |
784 (car type) (gnus-topic-visible-p) | |
785 (not (eq (nth 2 type) 'hidden)) | |
786 (gnus-group-topic-level) all-entries unread) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
787 (gnus-delete-line) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
788 (forward-line -1) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
789 (setq new-unread (gnus-group-topic-unread))) |
17493 | 790 (when parent |
791 (forward-line -1) | |
792 (gnus-topic-update-topic-line | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
793 parent |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
794 (- (or old-unread 0) (or new-unread 0)))) |
17493 | 795 unread)) |
796 | |
797 (defun gnus-topic-group-indentation () | |
798 (make-string | |
799 (* gnus-topic-indent-level | |
800 (or (save-excursion | |
801 (forward-line -1) | |
802 (gnus-topic-goto-topic (gnus-current-topic)) | |
803 (gnus-group-topic-level)) | |
804 0)) | |
805 ? )) | |
806 | |
807 ;;; Initialization | |
808 | |
809 (gnus-add-shutdown 'gnus-topic-close 'gnus) | |
810 | |
811 (defun gnus-topic-close () | |
812 (setq gnus-topic-active-topology nil | |
813 gnus-topic-active-alist nil | |
814 gnus-topic-killed-topics nil | |
815 gnus-topology-checked-p nil)) | |
816 | |
817 (defun gnus-topic-check-topology () | |
818 ;; The first time we set the topology to whatever we have | |
819 ;; gotten here, which can be rather random. | |
820 (unless gnus-topic-alist | |
821 (gnus-topic-init-alist)) | |
822 | |
823 (setq gnus-topology-checked-p t) | |
824 ;; Go through the topic alist and make sure that all topics | |
825 ;; are in the topic topology. | |
826 (let ((topics (gnus-topic-list)) | |
827 (alist gnus-topic-alist) | |
828 changed) | |
829 (while alist | |
830 (unless (member (caar alist) topics) | |
831 (nconc gnus-topic-topology | |
832 (list (list (list (caar alist) 'visible)))) | |
833 (setq changed t)) | |
834 (setq alist (cdr alist))) | |
835 (when changed | |
836 (gnus-topic-enter-dribble)) | |
837 ;; Conversely, go through the topology and make sure that all | |
838 ;; topologies have alists. | |
839 (while topics | |
840 (unless (assoc (car topics) gnus-topic-alist) | |
841 (push (list (car topics)) gnus-topic-alist)) | |
842 (pop topics))) | |
843 ;; Go through all living groups and make sure that | |
844 ;; they belong to some topic. | |
845 (let* ((tgroups (apply 'append (mapcar (lambda (entry) (cdr entry)) | |
846 gnus-topic-alist))) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
847 (entry (last (assoc (caar gnus-topic-topology) gnus-topic-alist))) |
17493 | 848 (newsrc (cdr gnus-newsrc-alist)) |
849 group) | |
850 (while newsrc | |
851 (unless (member (setq group (gnus-info-group (pop newsrc))) tgroups) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
852 (setcdr entry (list group)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
853 (setq entry (cdr entry))))) |
17493 | 854 ;; Go through all topics and make sure they contain only living groups. |
855 (let ((alist gnus-topic-alist) | |
856 topic) | |
857 (while (setq topic (pop alist)) | |
858 (while (cdr topic) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
859 (if (and (cadr topic) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
860 (gnus-gethash (cadr topic) gnus-newsrc-hashtb)) |
17493 | 861 (setq topic (cdr topic)) |
862 (setcdr topic (cddr topic))))))) | |
863 | |
864 (defun gnus-topic-init-alist () | |
865 "Initialize the topic structures." | |
866 (setq gnus-topic-topology | |
867 (cons (list "Gnus" 'visible) | |
868 (mapcar (lambda (topic) | |
869 (list (list (car topic) 'visible))) | |
870 '(("misc"))))) | |
871 (setq gnus-topic-alist | |
872 (list (cons "misc" | |
873 (mapcar (lambda (info) (gnus-info-group info)) | |
874 (cdr gnus-newsrc-alist))) | |
875 (list "Gnus"))) | |
876 (gnus-topic-enter-dribble)) | |
877 | |
878 ;;; Maintenance | |
879 | |
880 (defun gnus-topic-clean-alist () | |
881 "Remove bogus groups from the topic alist." | |
882 (let ((topic-alist gnus-topic-alist) | |
883 result topic) | |
884 (unless gnus-killed-hashtb | |
885 (gnus-make-hashtable-from-killed)) | |
886 (while (setq topic (pop topic-alist)) | |
887 (let ((topic-name (pop topic)) | |
888 group filtered-topic) | |
889 (while (setq group (pop topic)) | |
890 (when (and (or (gnus-gethash group gnus-active-hashtb) | |
891 (gnus-info-method (gnus-get-info group))) | |
892 (not (gnus-gethash group gnus-killed-hashtb))) | |
893 (push group filtered-topic))) | |
894 (push (cons topic-name (nreverse filtered-topic)) result))) | |
895 (setq gnus-topic-alist (nreverse result)))) | |
896 | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
897 (defun gnus-topic-change-level (group level oldlevel &optional previous) |
17493 | 898 "Run when changing levels to enter/remove groups from topics." |
899 (save-excursion | |
900 (set-buffer gnus-group-buffer) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
901 (let ((buffer-read-only nil)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
902 (unless gnus-topic-inhibit-change-level |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
903 (gnus-group-goto-group (or (car (nth 2 previous)) group)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
904 (when (and gnus-topic-mode |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
905 gnus-topic-alist |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
906 (not gnus-topic-inhibit-change-level)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
907 ;; Remove the group from the topics. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
908 (if (and (< oldlevel gnus-level-zombie) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
909 (>= level gnus-level-zombie)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
910 (let ((alist gnus-topic-alist)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
911 (while (gnus-group-goto-group group) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
912 (gnus-delete-line)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
913 (while alist |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
914 (when (member group (car alist)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
915 (setcdr (car alist) (delete group (cdar alist)))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
916 (pop alist))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
917 ;; If the group is subscribed we enter it into the topics. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
918 (when (and (< level gnus-level-zombie) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
919 (>= oldlevel gnus-level-zombie)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
920 (let* ((prev (gnus-group-group-name)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
921 (gnus-topic-inhibit-change-level t) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
922 (gnus-group-indentation |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
923 (make-string |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
924 (* gnus-topic-indent-level |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
925 (or (save-excursion |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
926 (gnus-topic-goto-topic (gnus-current-topic)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
927 (gnus-group-topic-level)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
928 0)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
929 ? )) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
930 (yanked (list group)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
931 alist talist end) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
932 ;; Then we enter the yanked groups into the topics |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
933 ;; they belong to. |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
934 (when (setq alist (assoc (save-excursion |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
935 (forward-line -1) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
936 (or |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
937 (gnus-current-topic) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
938 (caar gnus-topic-topology))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
939 gnus-topic-alist)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
940 (setq talist alist) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
941 (when (stringp yanked) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
942 (setq yanked (list yanked))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
943 (if (not prev) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
944 (nconc alist yanked) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
945 (if (not (cdr alist)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
946 (setcdr alist (nconc yanked (cdr alist))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
947 (while (and (not end) (cdr alist)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
948 (when (equal (cadr alist) prev) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
949 (setcdr alist (nconc yanked (cdr alist))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
950 (setq end t)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
951 (setq alist (cdr alist))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
952 (unless end |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
953 (nconc talist yanked)))))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
954 (gnus-topic-update-topic)))))))) |
17493 | 955 |
956 (defun gnus-topic-goto-next-group (group props) | |
957 "Go to group or the next group after group." | |
958 (if (not group) | |
959 (if (not (memq 'gnus-topic props)) | |
960 (goto-char (point-max)) | |
961 (gnus-topic-goto-topic (symbol-name (cadr (memq 'gnus-topic props))))) | |
962 (if (gnus-group-goto-group group) | |
963 t | |
964 ;; The group is no longer visible. | |
965 (let* ((list (assoc (gnus-group-topic group) gnus-topic-alist)) | |
966 (after (cdr (member group (cdr list))))) | |
967 ;; First try to put point on a group after the current one. | |
968 (while (and after | |
969 (not (gnus-group-goto-group (car after)))) | |
970 (setq after (cdr after))) | |
971 ;; Then try to put point on a group before point. | |
972 (unless after | |
973 (setq after (cdr (member group (reverse (cdr list))))) | |
974 (while (and after | |
975 (not (gnus-group-goto-group (car after)))) | |
976 (setq after (cdr after)))) | |
977 ;; Finally, just put point on the topic. | |
978 (if (not (car list)) | |
979 (goto-char (point-min)) | |
980 (unless after | |
981 (gnus-topic-goto-topic (car list)) | |
982 (setq after nil))) | |
983 t)))) | |
984 | |
985 ;;; Topic-active functions | |
986 | |
987 (defun gnus-topic-grok-active (&optional force) | |
988 "Parse all active groups and create topic structures for them." | |
989 ;; First we make sure that we have really read the active file. | |
990 (when (or force | |
991 (not gnus-topic-active-alist)) | |
992 (let (groups) | |
993 ;; Get a list of all groups available. | |
994 (mapatoms (lambda (g) (when (symbol-value g) | |
995 (push (symbol-name g) groups))) | |
996 gnus-active-hashtb) | |
997 (setq groups (sort groups 'string<)) | |
998 ;; Init the variables. | |
999 (setq gnus-topic-active-topology (list (list "" 'visible))) | |
1000 (setq gnus-topic-active-alist nil) | |
1001 ;; Descend the top-level hierarchy. | |
1002 (gnus-topic-grok-active-1 gnus-topic-active-topology groups) | |
1003 ;; Set the top-level topic names to something nice. | |
1004 (setcar (car gnus-topic-active-topology) "Gnus active") | |
1005 (setcar (car gnus-topic-active-alist) "Gnus active")))) | |
1006 | |
1007 (defun gnus-topic-grok-active-1 (topology groups) | |
1008 (let* ((name (caar topology)) | |
1009 (prefix (concat "^" (regexp-quote name))) | |
1010 tgroups ntopology group) | |
1011 (while (and groups | |
1012 (string-match prefix (setq group (car groups)))) | |
1013 (if (not (string-match "\\." group (match-end 0))) | |
1014 ;; There are no further hierarchies here, so we just | |
1015 ;; enter this group into the list belonging to this | |
1016 ;; topic. | |
1017 (push (pop groups) tgroups) | |
1018 ;; New sub-hierarchy, so we add it to the topology. | |
1019 (nconc topology (list (setq ntopology | |
1020 (list (list (substring | |
1021 group 0 (match-end 0)) | |
1022 'invisible))))) | |
1023 ;; Descend the hierarchy. | |
1024 (setq groups (gnus-topic-grok-active-1 ntopology groups)))) | |
1025 ;; We remove the trailing "." from the topic name. | |
1026 (setq name | |
1027 (if (string-match "\\.$" name) | |
1028 (substring name 0 (match-beginning 0)) | |
1029 name)) | |
1030 ;; Add this topic and its groups to the topic alist. | |
1031 (push (cons name (nreverse tgroups)) gnus-topic-active-alist) | |
1032 (setcar (car topology) name) | |
1033 ;; We return the rest of the groups that didn't belong | |
1034 ;; to this topic. | |
1035 groups)) | |
1036 | |
1037 ;;; Topic mode, commands and keymap. | |
1038 | |
1039 (defvar gnus-topic-mode-map nil) | |
1040 (defvar gnus-group-topic-map nil) | |
1041 | |
1042 (unless gnus-topic-mode-map | |
1043 (setq gnus-topic-mode-map (make-sparse-keymap)) | |
1044 | |
1045 ;; Override certain group mode keys. | |
1046 (gnus-define-keys gnus-topic-mode-map | |
1047 "=" gnus-topic-select-group | |
1048 "\r" gnus-topic-select-group | |
1049 " " gnus-topic-read-group | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1050 "\C-c\C-x" gnus-topic-expire-articles |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1051 "c" gnus-topic-catchup-articles |
17493 | 1052 "\C-k" gnus-topic-kill-group |
1053 "\C-y" gnus-topic-yank-group | |
1054 "\M-g" gnus-topic-get-new-news-this-topic | |
1055 "AT" gnus-topic-list-active | |
1056 "Gp" gnus-topic-edit-parameters | |
1057 "#" gnus-topic-mark-topic | |
1058 "\M-#" gnus-topic-unmark-topic | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1059 [tab] gnus-topic-indent |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1060 [(meta tab)] gnus-topic-unindent |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1061 "\C-i" gnus-topic-indent |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1062 "\M-\C-i" gnus-topic-unindent |
17493 | 1063 gnus-mouse-2 gnus-mouse-pick-topic) |
1064 | |
1065 ;; Define a new submap. | |
1066 (gnus-define-keys (gnus-group-topic-map "T" gnus-group-mode-map) | |
1067 "#" gnus-topic-mark-topic | |
1068 "\M-#" gnus-topic-unmark-topic | |
1069 "n" gnus-topic-create-topic | |
1070 "m" gnus-topic-move-group | |
1071 "D" gnus-topic-remove-group | |
1072 "c" gnus-topic-copy-group | |
1073 "h" gnus-topic-hide-topic | |
1074 "s" gnus-topic-show-topic | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1075 "j" gnus-topic-jump-to-topic |
17493 | 1076 "M" gnus-topic-move-matching |
1077 "C" gnus-topic-copy-matching | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1078 "\M-p" gnus-topic-goto-previous-topic |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1079 "\M-n" gnus-topic-goto-next-topic |
17493 | 1080 "\C-i" gnus-topic-indent |
1081 [tab] gnus-topic-indent | |
1082 "r" gnus-topic-rename | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
1083 "\177" gnus-topic-delete |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
1084 [delete] gnus-topic-delete |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1085 "H" gnus-topic-toggle-display-empty-topics) |
17493 | 1086 |
1087 (gnus-define-keys (gnus-topic-sort-map "S" gnus-group-topic-map) | |
1088 "s" gnus-topic-sort-groups | |
1089 "a" gnus-topic-sort-groups-by-alphabet | |
1090 "u" gnus-topic-sort-groups-by-unread | |
1091 "l" gnus-topic-sort-groups-by-level | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1092 "e" gnus-topic-sort-groups-by-server |
17493 | 1093 "v" gnus-topic-sort-groups-by-score |
1094 "r" gnus-topic-sort-groups-by-rank | |
1095 "m" gnus-topic-sort-groups-by-method)) | |
1096 | |
1097 (defun gnus-topic-make-menu-bar () | |
1098 (unless (boundp 'gnus-topic-menu) | |
1099 (easy-menu-define | |
1100 gnus-topic-menu gnus-topic-mode-map "" | |
1101 '("Topics" | |
1102 ["Toggle topics" gnus-topic-mode t] | |
1103 ("Groups" | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1104 ["Copy..." gnus-topic-copy-group t] |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1105 ["Move..." gnus-topic-move-group t] |
17493 | 1106 ["Remove" gnus-topic-remove-group t] |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1107 ["Copy matching..." gnus-topic-copy-matching t] |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1108 ["Move matching..." gnus-topic-move-matching t]) |
17493 | 1109 ("Topics" |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1110 ["Goto..." gnus-topic-jump-to-topic t] |
17493 | 1111 ["Show" gnus-topic-show-topic t] |
1112 ["Hide" gnus-topic-hide-topic t] | |
1113 ["Delete" gnus-topic-delete t] | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1114 ["Rename..." gnus-topic-rename t] |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1115 ["Create..." gnus-topic-create-topic t] |
17493 | 1116 ["Mark" gnus-topic-mark-topic t] |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
1117 ["Indent" gnus-topic-indent t] |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1118 ["Sort" gnus-topic-sort-topics t] |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1119 ["Previous topic" gnus-topic-goto-previous-topic t] |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1120 ["Next topic" gnus-topic-goto-next-topic t] |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
1121 ["Toggle hide empty" gnus-topic-toggle-display-empty-topics t] |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
1122 ["Edit parameters" gnus-topic-edit-parameters t]) |
17493 | 1123 ["List active" gnus-topic-list-active t])))) |
1124 | |
1125 (defun gnus-topic-mode (&optional arg redisplay) | |
1126 "Minor mode for topicsifying Gnus group buffers." | |
1127 (interactive (list current-prefix-arg t)) | |
1128 (when (eq major-mode 'gnus-group-mode) | |
1129 (make-local-variable 'gnus-topic-mode) | |
1130 (setq gnus-topic-mode | |
1131 (if (null arg) (not gnus-topic-mode) | |
1132 (> (prefix-numeric-value arg) 0))) | |
1133 ;; Infest Gnus with topics. | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1134 (if (not gnus-topic-mode) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1135 (setq gnus-goto-missing-group-function nil) |
17493 | 1136 (when (gnus-visual-p 'topic-menu 'menu) |
1137 (gnus-topic-make-menu-bar)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1138 (gnus-set-format 'topic t) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1139 (gnus-add-minor-mode 'gnus-topic-mode " Topic" |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1140 gnus-topic-mode-map nil (lambda (&rest junk) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1141 (interactive) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1142 (gnus-topic-mode nil t))) |
17493 | 1143 (add-hook 'gnus-group-catchup-group-hook 'gnus-topic-update-topic) |
1144 (set (make-local-variable 'gnus-group-prepare-function) | |
1145 'gnus-group-prepare-topics) | |
1146 (set (make-local-variable 'gnus-group-get-parameter-function) | |
1147 'gnus-group-topic-parameters) | |
1148 (set (make-local-variable 'gnus-group-goto-next-group-function) | |
1149 'gnus-topic-goto-next-group) | |
1150 (set (make-local-variable 'gnus-group-indentation-function) | |
1151 'gnus-topic-group-indentation) | |
1152 (set (make-local-variable 'gnus-group-update-group-function) | |
1153 'gnus-topic-update-topics-containing-group) | |
1154 (set (make-local-variable 'gnus-group-sort-alist-function) | |
1155 'gnus-group-sort-topic) | |
1156 (setq gnus-group-change-level-function 'gnus-topic-change-level) | |
1157 (setq gnus-goto-missing-group-function 'gnus-topic-goto-missing-group) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1158 (gnus-make-local-hook 'gnus-check-bogus-groups-hook) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1159 (add-hook 'gnus-check-bogus-groups-hook 'gnus-topic-clean-alist |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1160 nil 'local) |
17493 | 1161 (setq gnus-topology-checked-p nil) |
1162 ;; We check the topology. | |
1163 (when gnus-newsrc-alist | |
1164 (gnus-topic-check-topology)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1165 (gnus-run-hooks 'gnus-topic-mode-hook)) |
17493 | 1166 ;; Remove topic infestation. |
1167 (unless gnus-topic-mode | |
1168 (remove-hook 'gnus-summary-exit-hook 'gnus-topic-update-topic) | |
33326
bea963b6e539
2000-10-11 John Wiegley <johnw@gnu.org>
Dave Love <fx@gnu.org>
parents:
31785
diff
changeset
|
1169 (setq gnus-group-change-level-function nil) |
17493 | 1170 (remove-hook 'gnus-check-bogus-groups-hook 'gnus-topic-clean-alist) |
1171 (setq gnus-group-prepare-function 'gnus-group-prepare-flat) | |
1172 (setq gnus-group-sort-alist-function 'gnus-group-sort-flat)) | |
1173 (when redisplay | |
1174 (gnus-group-list-groups)))) | |
1175 | |
1176 (defun gnus-topic-select-group (&optional all) | |
1177 "Select this newsgroup. | |
1178 No article is selected automatically. | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1179 If the group is opened, just switch the summary buffer. |
17493 | 1180 If ALL is non-nil, already read articles become readable. |
1181 If ALL is a number, fetch this number of articles. | |
1182 | |
1183 If performed over a topic line, toggle folding the topic." | |
1184 (interactive "P") | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1185 (when (and (eobp) (not (gnus-group-group-name))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1186 (forward-line -1)) |
17493 | 1187 (if (gnus-group-topic-p) |
1188 (let ((gnus-group-list-mode | |
1189 (if all (cons (if (numberp all) all 7) t) gnus-group-list-mode))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1190 (gnus-topic-fold all) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1191 (gnus-dribble-touch)) |
17493 | 1192 (gnus-group-select-group all))) |
1193 | |
1194 (defun gnus-mouse-pick-topic (e) | |
1195 "Select the group or topic under the mouse pointer." | |
1196 (interactive "e") | |
1197 (mouse-set-point e) | |
1198 (gnus-topic-read-group nil)) | |
1199 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1200 (defun gnus-topic-expire-articles (topic) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1201 "Expire articles in this topic or group." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1202 (interactive (list (gnus-group-topic-name))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1203 (if (not topic) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1204 (call-interactively 'gnus-group-expire-articles) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1205 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1206 (gnus-message 5 "Expiring groups in %s..." topic) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1207 (let ((gnus-group-marked |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1208 (mapcar (lambda (entry) (car (nth 2 entry))) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1209 (gnus-topic-find-groups topic gnus-level-killed t |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1210 nil t)))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1211 (gnus-group-expire-articles nil)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1212 (gnus-message 5 "Expiring groups in %s...done" topic)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1213 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1214 (defun gnus-topic-catchup-articles (topic) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1215 "Catchup this topic or group. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1216 Also see `gnus-group-catchup'." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1217 (interactive (list (gnus-group-topic-name))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1218 (if (not topic) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1219 (call-interactively 'gnus-group-catchup-current) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1220 (save-excursion |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1221 (let* ((groups |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1222 (mapcar (lambda (entry) (car (nth 2 entry))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1223 (gnus-topic-find-groups topic gnus-level-killed t |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1224 nil t))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1225 (buffer-read-only nil) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1226 (gnus-group-marked groups)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1227 (gnus-group-catchup-current) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1228 (mapcar 'gnus-topic-update-topics-containing-group groups))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1229 |
17493 | 1230 (defun gnus-topic-read-group (&optional all no-article group) |
1231 "Read news in this newsgroup. | |
1232 If the prefix argument ALL is non-nil, already read articles become | |
1233 readable. IF ALL is a number, fetch this number of articles. If the | |
1234 optional argument NO-ARTICLE is non-nil, no article will be | |
1235 auto-selected upon group entry. If GROUP is non-nil, fetch that | |
1236 group. | |
1237 | |
1238 If performed over a topic line, toggle folding the topic." | |
1239 (interactive "P") | |
1240 (if (gnus-group-topic-p) | |
1241 (let ((gnus-group-list-mode | |
1242 (if all (cons (if (numberp all) all 7) t) gnus-group-list-mode))) | |
1243 (gnus-topic-fold all)) | |
1244 (gnus-group-read-group all no-article group))) | |
1245 | |
1246 (defun gnus-topic-create-topic (topic parent &optional previous full-topic) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
1247 "Create a new TOPIC under PARENT. |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
1248 When used interactively, PARENT will be the topic under point." |
17493 | 1249 (interactive |
1250 (list | |
1251 (read-string "New topic: ") | |
1252 (gnus-current-topic))) | |
1253 ;; Check whether this topic already exists. | |
1254 (when (gnus-topic-find-topology topic) | |
1255 (error "Topic already exists")) | |
1256 (unless parent | |
1257 (setq parent (caar gnus-topic-topology))) | |
1258 (let ((top (cdr (gnus-topic-find-topology parent))) | |
34858
6c93e7d6a930
* message.el (message-setup): Use cons. Suggested by Johan Vromans
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33326
diff
changeset
|
1259 (full-topic (or full-topic (list (list topic 'visible nil nil))))) |
17493 | 1260 (unless top |
1261 (error "No such parent topic: %s" parent)) | |
1262 (if previous | |
1263 (progn | |
1264 (while (and (cdr top) | |
1265 (not (equal (caaadr top) previous))) | |
1266 (setq top (cdr top))) | |
1267 (setcdr top (cons full-topic (cdr top)))) | |
1268 (nconc top (list full-topic))) | |
1269 (unless (assoc topic gnus-topic-alist) | |
1270 (push (list topic) gnus-topic-alist))) | |
1271 (gnus-topic-enter-dribble) | |
1272 (gnus-group-list-groups) | |
1273 (gnus-topic-goto-topic topic)) | |
1274 | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48588
diff
changeset
|
1275 ;; FIXME: |
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48588
diff
changeset
|
1276 ;; 1. When the marked groups are overlapped with the process |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1277 ;; region, the behavior of move or remove is not right. |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48588
diff
changeset
|
1278 ;; 2. Can't process on several marked groups with a same name, |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1279 ;; because gnus-group-marked only keeps one copy. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1280 |
17493 | 1281 (defun gnus-topic-move-group (n topic &optional copyp) |
1282 "Move the next N groups to TOPIC. | |
1283 If COPYP, copy the groups instead." | |
1284 (interactive | |
1285 (list current-prefix-arg | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1286 (gnus-completing-read "Move to topic" gnus-topic-alist nil t |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1287 'gnus-topic-history))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48588
diff
changeset
|
1288 (let ((use-marked (and (not n) (not (gnus-region-active-p)) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1289 gnus-group-marked t)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1290 (groups (gnus-group-process-prefix n)) |
17493 | 1291 (topicl (assoc topic gnus-topic-alist)) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1292 (start-topic (gnus-group-topic-name)) |
17493 | 1293 (start-group (progn (forward-line 1) (gnus-group-group-name))) |
1294 entry) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1295 (if (and (not groups) (not copyp) start-topic) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1296 (gnus-topic-move start-topic topic) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1297 (mapcar |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1298 (lambda (g) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1299 (gnus-group-remove-mark g use-marked) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1300 (when (and |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1301 (setq entry (assoc (gnus-current-topic) gnus-topic-alist)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1302 (not copyp)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1303 (setcdr entry (gnus-delete-first g (cdr entry)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1304 (nconc topicl (list g))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1305 groups) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1306 (gnus-topic-enter-dribble) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1307 (if start-group |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1308 (gnus-group-goto-group start-group) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1309 (gnus-topic-goto-topic start-topic)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1310 (gnus-group-list-groups)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1311 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1312 (defun gnus-topic-remove-group (&optional n) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1313 "Remove the current group from the topic." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1314 (interactive "P") |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48588
diff
changeset
|
1315 (let ((use-marked (and (not n) (not (gnus-region-active-p)) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1316 gnus-group-marked t)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1317 (groups (gnus-group-process-prefix n))) |
17493 | 1318 (mapcar |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1319 (lambda (group) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1320 (gnus-group-remove-mark group use-marked) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1321 (let ((topicl (assoc (gnus-current-topic) gnus-topic-alist)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1322 (buffer-read-only nil)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1323 (when (and topicl group) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1324 (gnus-delete-line) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1325 (gnus-delete-first group topicl)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1326 (gnus-topic-update-topic))) |
17493 | 1327 groups) |
1328 (gnus-topic-enter-dribble) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1329 (gnus-group-position-point))) |
17493 | 1330 |
1331 (defun gnus-topic-copy-group (n topic) | |
1332 "Copy the current group to a topic." | |
1333 (interactive | |
1334 (list current-prefix-arg | |
1335 (completing-read "Copy to topic: " gnus-topic-alist nil t))) | |
1336 (gnus-topic-move-group n topic t)) | |
1337 | |
1338 (defun gnus-topic-kill-group (&optional n discard) | |
1339 "Kill the next N groups." | |
1340 (interactive "P") | |
1341 (if (gnus-group-topic-p) | |
1342 (let ((topic (gnus-group-topic-name))) | |
1343 (push (cons | |
1344 (gnus-topic-find-topology topic) | |
1345 (assoc topic gnus-topic-alist)) | |
1346 gnus-topic-killed-topics) | |
1347 (gnus-topic-remove-topic nil t) | |
1348 (gnus-topic-find-topology topic nil nil gnus-topic-topology) | |
1349 (gnus-topic-enter-dribble)) | |
1350 (gnus-group-kill-group n discard) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1351 (if (not (gnus-group-topic-p)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1352 (gnus-topic-update-topic) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1353 ;; Move up one line so that we update the right topic. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1354 (forward-line -1) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1355 (gnus-topic-update-topic) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1356 (forward-line 1)))) |
17493 | 1357 |
1358 (defun gnus-topic-yank-group (&optional arg) | |
1359 "Yank the last topic." | |
1360 (interactive "p") | |
1361 (if gnus-topic-killed-topics | |
1362 (let* ((previous | |
1363 (or (gnus-group-topic-name) | |
1364 (gnus-topic-next-topic (gnus-current-topic)))) | |
1365 (data (pop gnus-topic-killed-topics)) | |
1366 (alist (cdr data)) | |
1367 (item (cdar data))) | |
1368 (push alist gnus-topic-alist) | |
1369 (gnus-topic-create-topic | |
1370 (caar item) (gnus-topic-parent-topic previous) previous | |
1371 item) | |
1372 (gnus-topic-enter-dribble) | |
1373 (gnus-topic-goto-topic (caar item))) | |
1374 (let* ((prev (gnus-group-group-name)) | |
1375 (gnus-topic-inhibit-change-level t) | |
1376 (gnus-group-indentation | |
1377 (make-string | |
1378 (* gnus-topic-indent-level | |
1379 (or (save-excursion | |
1380 (gnus-topic-goto-topic (gnus-current-topic)) | |
1381 (gnus-group-topic-level)) | |
1382 0)) | |
1383 ? )) | |
1384 yanked alist) | |
1385 ;; We first yank the groups the normal way... | |
1386 (setq yanked (gnus-group-yank-group arg)) | |
1387 ;; Then we enter the yanked groups into the topics they belong | |
1388 ;; to. | |
1389 (setq alist (assoc (save-excursion | |
1390 (forward-line -1) | |
1391 (gnus-current-topic)) | |
1392 gnus-topic-alist)) | |
1393 (when (stringp yanked) | |
1394 (setq yanked (list yanked))) | |
1395 (if (not prev) | |
1396 (nconc alist yanked) | |
1397 (if (not (cdr alist)) | |
1398 (setcdr alist (nconc yanked (cdr alist))) | |
1399 (while (cdr alist) | |
1400 (when (equal (cadr alist) prev) | |
1401 (setcdr alist (nconc yanked (cdr alist))) | |
1402 (setq alist nil)) | |
1403 (setq alist (cdr alist)))))) | |
1404 (gnus-topic-update-topic))) | |
1405 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1406 (defun gnus-topic-hide-topic (&optional permanent) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1407 "Hide the current topic. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1408 If PERMANENT, make it stay hidden in subsequent sessions as well." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1409 (interactive "P") |
17493 | 1410 (when (gnus-current-topic) |
1411 (gnus-topic-goto-topic (gnus-current-topic)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1412 (if permanent |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48588
diff
changeset
|
1413 (setcar (cddr |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1414 (cadr |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1415 (gnus-topic-find-topology (gnus-current-topic)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1416 'hidden)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1417 (gnus-topic-remove-topic nil nil))) |
17493 | 1418 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1419 (defun gnus-topic-show-topic (&optional permanent) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1420 "Show the hidden topic. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1421 If PERMANENT, make it stay shown in subsequent sessions as well." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1422 (interactive "P") |
17493 | 1423 (when (gnus-group-topic-p) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1424 (if (not permanent) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1425 (gnus-topic-remove-topic t nil) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48588
diff
changeset
|
1426 (let ((topic |
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48588
diff
changeset
|
1427 (gnus-topic-find-topology |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1428 (completing-read "Show topic: " gnus-topic-alist nil t)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1429 (setcar (cddr (cadr topic)) nil) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1430 (setcar (cdr (cadr topic)) 'visible) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1431 (gnus-group-list-groups))))) |
17493 | 1432 |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1433 (defun gnus-topic-mark-topic (topic &optional unmark non-recursive) |
31785 | 1434 "Mark all groups in the TOPIC with the process mark. |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1435 If NON-RECURSIVE (which is the prefix) is t, don't mark its subtopics." |
31785 | 1436 (interactive (list (gnus-group-topic-name) |
1437 nil | |
1438 (and current-prefix-arg t))) | |
17493 | 1439 (if (not topic) |
1440 (call-interactively 'gnus-group-mark-group) | |
1441 (save-excursion | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48588
diff
changeset
|
1442 (let ((groups (gnus-topic-find-groups topic gnus-level-killed t nil |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1443 (not non-recursive)))) |
17493 | 1444 (while groups |
1445 (funcall (if unmark 'gnus-group-remove-mark 'gnus-group-set-mark) | |
1446 (gnus-info-group (nth 2 (pop groups))))))))) | |
1447 | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1448 (defun gnus-topic-unmark-topic (topic &optional dummy non-recursive) |
31785 | 1449 "Remove the process mark from all groups in the TOPIC. |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1450 If NON-RECURSIVE (which is the prefix) is t, don't unmark its subtopics." |
31785 | 1451 (interactive (list (gnus-group-topic-name) |
1452 nil | |
1453 (and current-prefix-arg t))) | |
17493 | 1454 (if (not topic) |
1455 (call-interactively 'gnus-group-unmark-group) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1456 (gnus-topic-mark-topic topic t non-recursive))) |
17493 | 1457 |
1458 (defun gnus-topic-get-new-news-this-topic (&optional n) | |
1459 "Check for new news in the current topic." | |
1460 (interactive "P") | |
1461 (if (not (gnus-group-topic-p)) | |
1462 (gnus-group-get-new-news-this-group n) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1463 (let* ((topic (gnus-group-topic-name)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1464 (data (cadr (gnus-topic-find-topology topic)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1465 (save-excursion |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1466 (gnus-topic-mark-topic topic nil (and n t)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1467 (gnus-group-get-new-news-this-group)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1468 (gnus-topic-remove-topic (eq 'visible (cadr data)))))) |
17493 | 1469 |
1470 (defun gnus-topic-move-matching (regexp topic &optional copyp) | |
1471 "Move all groups that match REGEXP to some topic." | |
1472 (interactive | |
1473 (let (topic) | |
1474 (nreverse | |
1475 (list | |
1476 (setq topic (completing-read "Move to topic: " gnus-topic-alist nil t)) | |
1477 (read-string (format "Move to %s (regexp): " topic)))))) | |
1478 (gnus-group-mark-regexp regexp) | |
1479 (gnus-topic-move-group nil topic copyp)) | |
1480 | |
1481 (defun gnus-topic-copy-matching (regexp topic &optional copyp) | |
1482 "Copy all groups that match REGEXP to some topic." | |
1483 (interactive | |
1484 (let (topic) | |
1485 (nreverse | |
1486 (list | |
1487 (setq topic (completing-read "Copy to topic: " gnus-topic-alist nil t)) | |
1488 (read-string (format "Copy to %s (regexp): " topic)))))) | |
1489 (gnus-topic-move-matching regexp topic t)) | |
1490 | |
1491 (defun gnus-topic-delete (topic) | |
1492 "Delete a topic." | |
1493 (interactive (list (gnus-group-topic-name))) | |
1494 (unless topic | |
1495 (error "No topic to be deleted")) | |
1496 (let ((entry (assoc topic gnus-topic-alist)) | |
1497 (buffer-read-only nil)) | |
1498 (when (cdr entry) | |
1499 (error "Topic not empty")) | |
1500 ;; Delete if visible. | |
1501 (when (gnus-topic-goto-topic topic) | |
1502 (gnus-delete-line)) | |
1503 ;; Remove from alist. | |
1504 (setq gnus-topic-alist (delq entry gnus-topic-alist)) | |
1505 ;; Remove from topology. | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
1506 (gnus-topic-find-topology topic nil nil 'delete) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
1507 (gnus-dribble-touch))) |
17493 | 1508 |
1509 (defun gnus-topic-rename (old-name new-name) | |
1510 "Rename a topic." | |
1511 (interactive | |
1512 (let ((topic (gnus-current-topic))) | |
1513 (list topic | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1514 (read-string (format "Rename %s to: " topic) topic)))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1515 ;; Check whether the new name exists. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1516 (when (gnus-topic-find-topology new-name) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1517 (error "Topic '%s' already exists" new-name)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1518 ;; "nil" is an invalid name, for reasons I'd rather not go |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1519 ;; into here. Trust me. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1520 (when (equal new-name "nil") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1521 (error "Invalid name: %s" nil)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1522 ;; Do the renaming. |
17493 | 1523 (let ((top (gnus-topic-find-topology old-name)) |
1524 (entry (assoc old-name gnus-topic-alist))) | |
1525 (when top | |
1526 (setcar (cadr top) new-name)) | |
1527 (when entry | |
1528 (setcar entry new-name)) | |
1529 (forward-line -1) | |
1530 (gnus-dribble-touch) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1531 (gnus-group-list-groups) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1532 (forward-line 1))) |
17493 | 1533 |
1534 (defun gnus-topic-indent (&optional unindent) | |
1535 "Indent a topic -- make it a sub-topic of the previous topic. | |
1536 If UNINDENT, remove an indentation." | |
1537 (interactive "P") | |
1538 (if unindent | |
1539 (gnus-topic-unindent) | |
1540 (let* ((topic (gnus-current-topic)) | |
1541 (parent (gnus-topic-previous-topic topic)) | |
1542 (buffer-read-only nil)) | |
1543 (unless parent | |
1544 (error "Nothing to indent %s into" topic)) | |
1545 (when topic | |
1546 (gnus-topic-goto-topic topic) | |
1547 (gnus-topic-kill-group) | |
1548 (push (cdar gnus-topic-killed-topics) gnus-topic-alist) | |
1549 (gnus-topic-create-topic | |
46192
be3ff3e3e5b0
* gnus-topic.el (gnus-topic-indent, gnus-topic-unindent): Change
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34858
diff
changeset
|
1550 topic parent nil (cdar (car gnus-topic-killed-topics))) |
17493 | 1551 (pop gnus-topic-killed-topics) |
1552 (or (gnus-topic-goto-topic topic) | |
1553 (gnus-topic-goto-topic parent)))))) | |
1554 | |
1555 (defun gnus-topic-unindent () | |
1556 "Unindent a topic." | |
1557 (interactive) | |
1558 (let* ((topic (gnus-current-topic)) | |
1559 (parent (gnus-topic-parent-topic topic)) | |
1560 (grandparent (gnus-topic-parent-topic parent))) | |
1561 (unless grandparent | |
1562 (error "Nothing to indent %s into" topic)) | |
1563 (when topic | |
1564 (gnus-topic-goto-topic topic) | |
1565 (gnus-topic-kill-group) | |
1566 (push (cdar gnus-topic-killed-topics) gnus-topic-alist) | |
1567 (gnus-topic-create-topic | |
1568 topic grandparent (gnus-topic-next-topic parent) | |
46192
be3ff3e3e5b0
* gnus-topic.el (gnus-topic-indent, gnus-topic-unindent): Change
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34858
diff
changeset
|
1569 (cdar (car gnus-topic-killed-topics))) |
17493 | 1570 (pop gnus-topic-killed-topics) |
1571 (gnus-topic-goto-topic topic)))) | |
1572 | |
1573 (defun gnus-topic-list-active (&optional force) | |
1574 "List all groups that Gnus knows about in a topicsified fashion. | |
1575 If FORCE, always re-read the active file." | |
1576 (interactive "P") | |
1577 (when force | |
1578 (gnus-get-killed-groups)) | |
1579 (gnus-topic-grok-active force) | |
1580 (let ((gnus-topic-topology gnus-topic-active-topology) | |
1581 (gnus-topic-alist gnus-topic-active-alist) | |
1582 gnus-killed-list gnus-zombie-list) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1583 (gnus-group-list-groups gnus-level-killed nil 1))) |
17493 | 1584 |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
1585 (defun gnus-topic-toggle-display-empty-topics () |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
1586 "Show/hide topics that have no unread articles." |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
1587 (interactive) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
1588 (setq gnus-topic-display-empty-topics |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
1589 (not gnus-topic-display-empty-topics)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
1590 (gnus-group-list-groups) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
1591 (message "%s empty topics" |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
1592 (if gnus-topic-display-empty-topics |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
1593 "Showing" "Hiding"))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
1594 |
17493 | 1595 ;;; Topic sorting functions |
1596 | |
1597 (defun gnus-topic-edit-parameters (group) | |
1598 "Edit the group parameters of GROUP. | |
1599 If performed on a topic, edit the topic parameters instead." | |
1600 (interactive (list (gnus-group-group-name))) | |
1601 (if group | |
1602 (gnus-group-edit-group-parameters group) | |
1603 (if (not (gnus-group-topic-p)) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
1604 (error "Nothing to edit on the current line") |
17493 | 1605 (let ((topic (gnus-group-topic-name))) |
1606 (gnus-edit-form | |
1607 (gnus-topic-parameters topic) | |
1608 (format "Editing the topic parameters for `%s'." | |
1609 (or group topic)) | |
1610 `(lambda (form) | |
1611 (gnus-topic-set-parameters ,topic form))))))) | |
1612 | |
1613 (defun gnus-group-sort-topic (func reverse) | |
1614 "Sort groups in the topics according to FUNC and REVERSE." | |
1615 (let ((alist gnus-topic-alist)) | |
1616 (while alist | |
1617 ;; !!!Sometimes nil elements sneak into the alist, | |
1618 ;; for some reason or other. | |
1619 (setcar alist (delq nil (car alist))) | |
1620 (setcar alist (delete "dummy.group" (car alist))) | |
1621 (gnus-topic-sort-topic (pop alist) func reverse)))) | |
1622 | |
1623 (defun gnus-topic-sort-topic (topic func reverse) | |
1624 ;; Each topic only lists the name of the group, while | |
1625 ;; the sort predicates expect group infos as inputs. | |
1626 ;; So we first transform the group names into infos, | |
1627 ;; then sort, and then transform back into group names. | |
1628 (setcdr | |
1629 topic | |
1630 (mapcar | |
1631 (lambda (info) (gnus-info-group info)) | |
1632 (sort | |
1633 (mapcar | |
1634 (lambda (group) (gnus-get-info group)) | |
1635 (cdr topic)) | |
1636 func))) | |
1637 ;; Do the reversal, if necessary. | |
1638 (when reverse | |
1639 (setcdr topic (nreverse (cdr topic))))) | |
1640 | |
1641 (defun gnus-topic-sort-groups (func &optional reverse) | |
1642 "Sort the current topic according to FUNC. | |
1643 If REVERSE, reverse the sorting order." | |
1644 (interactive (list gnus-group-sort-function current-prefix-arg)) | |
1645 (let ((topic (assoc (gnus-current-topic) gnus-topic-alist))) | |
1646 (gnus-topic-sort-topic | |
1647 topic (gnus-make-sort-function func) reverse) | |
1648 (gnus-group-list-groups))) | |
1649 | |
1650 (defun gnus-topic-sort-groups-by-alphabet (&optional reverse) | |
1651 "Sort the current topic alphabetically by group name. | |
1652 If REVERSE, sort in reverse order." | |
1653 (interactive "P") | |
1654 (gnus-topic-sort-groups 'gnus-group-sort-by-alphabet reverse)) | |
1655 | |
1656 (defun gnus-topic-sort-groups-by-unread (&optional reverse) | |
1657 "Sort the current topic by number of unread articles. | |
1658 If REVERSE, sort in reverse order." | |
1659 (interactive "P") | |
1660 (gnus-topic-sort-groups 'gnus-group-sort-by-unread reverse)) | |
1661 | |
1662 (defun gnus-topic-sort-groups-by-level (&optional reverse) | |
1663 "Sort the current topic by group level. | |
1664 If REVERSE, sort in reverse order." | |
1665 (interactive "P") | |
1666 (gnus-topic-sort-groups 'gnus-group-sort-by-level reverse)) | |
1667 | |
1668 (defun gnus-topic-sort-groups-by-score (&optional reverse) | |
1669 "Sort the current topic by group score. | |
1670 If REVERSE, sort in reverse order." | |
1671 (interactive "P") | |
1672 (gnus-topic-sort-groups 'gnus-group-sort-by-score reverse)) | |
1673 | |
1674 (defun gnus-topic-sort-groups-by-rank (&optional reverse) | |
1675 "Sort the current topic by group rank. | |
1676 If REVERSE, sort in reverse order." | |
1677 (interactive "P") | |
1678 (gnus-topic-sort-groups 'gnus-group-sort-by-rank reverse)) | |
1679 | |
1680 (defun gnus-topic-sort-groups-by-method (&optional reverse) | |
1681 "Sort the current topic alphabetically by backend name. | |
1682 If REVERSE, sort in reverse order." | |
1683 (interactive "P") | |
1684 (gnus-topic-sort-groups 'gnus-group-sort-by-method reverse)) | |
1685 | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1686 (defun gnus-topic-sort-groups-by-server (&optional reverse) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1687 "Sort the current topic alphabetically by server name. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1688 If REVERSE, sort in reverse order." |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1689 (interactive "P") |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1690 (gnus-topic-sort-groups 'gnus-group-sort-by-server reverse)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1691 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1692 (defun gnus-topic-sort-topics-1 (top reverse) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1693 (if (cdr top) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1694 (let ((subtop |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1695 (mapcar (gnus-byte-compile |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1696 `(lambda (top) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1697 (gnus-topic-sort-topics-1 top ,reverse))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1698 (sort (cdr top) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1699 (lambda (t1 t2) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1700 (string-lessp (caar t1) (caar t2))))))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1701 (setcdr top (if reverse (reverse subtop) subtop)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1702 top) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1703 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1704 (defun gnus-topic-sort-topics (&optional topic reverse) |
48588 | 1705 "Sort topics in TOPIC alphabetically by topic name. |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1706 If REVERSE, reverse the sorting order." |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48588
diff
changeset
|
1707 (interactive |
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48588
diff
changeset
|
1708 (list (completing-read "Sort topics in : " gnus-topic-alist nil t |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1709 (gnus-current-topic)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1710 current-prefix-arg)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1711 (let ((topic-topology (or (and topic (cdr (gnus-topic-find-topology topic))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1712 gnus-topic-topology))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1713 (gnus-topic-sort-topics-1 topic-topology reverse) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1714 (gnus-topic-enter-dribble) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1715 (gnus-group-list-groups) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1716 (gnus-topic-goto-topic topic))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1717 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1718 (defun gnus-topic-move (current to) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1719 "Move the CURRENT topic to TO." |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48588
diff
changeset
|
1720 (interactive |
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48588
diff
changeset
|
1721 (list |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1722 (gnus-group-topic-name) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1723 (completing-read "Move to topic: " gnus-topic-alist nil t))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1724 (unless (and current to) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1725 (error "Can't find topic")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1726 (let ((current-top (cdr (gnus-topic-find-topology current))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1727 (to-top (cdr (gnus-topic-find-topology to)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1728 (unless current-top |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1729 (error "Can't find topic `%s'" current)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1730 (unless to-top |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1731 (error "Can't find topic `%s'" to)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1732 (if (gnus-topic-find-topology to current-top 0);; Don't care the level |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1733 (error "Can't move `%s' to its sub-level" current)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1734 (gnus-topic-find-topology current nil nil 'delete) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1735 (while (cdr to-top) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1736 (setq to-top (cdr to-top))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1737 (setcdr to-top (list current-top)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1738 (gnus-topic-enter-dribble) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1739 (gnus-group-list-groups) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1740 (gnus-topic-goto-topic current))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1741 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1742 (defun gnus-subscribe-topics (newsgroup) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1743 (catch 'end |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1744 (let (match gnus-group-change-level-function) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1745 (dolist (topic (gnus-topic-list)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1746 (when (and (setq match (cdr (assq 'subscribe |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1747 (gnus-topic-parameters topic)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1748 (string-match match newsgroup)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1749 ;; Just subscribe the group. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1750 (gnus-subscribe-alphabetically newsgroup) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1751 ;; Add the group to the topic. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1752 (nconc (assoc topic gnus-topic-alist) (list newsgroup)) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1753 ;; if this topic specifies a default level, use it |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1754 (let ((subscribe-level (cdr (assq 'subscribe-level |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1755 (gnus-topic-parameters topic))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1756 (when subscribe-level |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1757 (gnus-group-change-level newsgroup subscribe-level |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1758 gnus-level-default-subscribed))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1759 (throw 'end t))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
52401
diff
changeset
|
1760 nil))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48588
diff
changeset
|
1761 |
17493 | 1762 (provide 'gnus-topic) |
1763 | |
52401 | 1764 ;;; arch-tag: bf176856-f30c-40f0-ae77-e41529a1134c |
17493 | 1765 ;;; gnus-topic.el ends here |