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