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