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