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