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