Sync up with gnus-6_2_3 to gnus-6_4_0
[elisp/gnus.git-] / lisp / gnus-topic.el
index 9a989b0..249367d 100644 (file)
@@ -2,7 +2,7 @@
 ;; Copyright (C) 1995,96,97,98 Free Software Foundation, Inc.
 
 ;; Author: Ilja Weis <kult@uni-paderborn.de>
-;;     Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
+;;     Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
 
 ;; This file is part of GNU Emacs.
   "Minor mode for Gnus group buffers.")
 
 (defcustom gnus-topic-mode-hook nil
-  "*Hook run in topic mode buffers."
+  "Hook run in topic mode buffers."
   :type 'hook
   :group 'gnus-topic)
 
 (defcustom gnus-topic-line-format "%i[ %(%{%n%}%) -- %A ]%v\n"
-  "*Format of topic lines.
+  "Format of topic lines.
 It works along the same lines as a normal formatting string,
 with some simple extensions.
 
@@ -355,8 +355,8 @@ with some simple extensions.
 ;;; Generating group buffers
 
 (defun gnus-group-prepare-topics (level &optional all lowest regexp list-topic topic-level)
-  "List all newsgroups with unread articles of level LEVEL or lower, and
-use the `gnus-group-topics' to sort the groups.
+  "List all newsgroups with unread articles of level LEVEL or lower.
+Use the `gnus-group-topics' to sort the groups.
 If ALL is non-nil, list groups that have no unread articles.
 If LOWEST is non-nil, list all newsgroups of level LOWEST or higher."
   (set-buffer gnus-group-buffer)
@@ -734,59 +734,60 @@ articles in the topic and its subtopics."
   "Run when changing levels to enter/remove groups from topics."
   (save-excursion
     (set-buffer gnus-group-buffer)
-    (unless gnus-topic-inhibit-change-level
-      (gnus-group-goto-group (or (car (nth 2 previous)) group))
-      (when (and gnus-topic-mode
-                gnus-topic-alist
-                (not gnus-topic-inhibit-change-level))
-       ;; Remove the group from the topics.
-       (if (and (< oldlevel gnus-level-zombie)
-                (>= level gnus-level-zombie))
-           (let ((alist gnus-topic-alist))
-             (while (gnus-group-goto-group group)
-               (gnus-delete-line))
-             (while alist
-               (when (member group (car alist))
-                 (setcdr (car alist) (delete group (cdar alist))))
-               (pop alist)))
-         ;; If the group is subscribed we enter it into the topics.
-         (when (and (< level gnus-level-zombie)
-                    (>= oldlevel gnus-level-zombie))
-           (let* ((prev (gnus-group-group-name))
-                  (gnus-topic-inhibit-change-level t)
-                  (gnus-group-indentation
-                   (make-string
-                    (* gnus-topic-indent-level
-                       (or (save-excursion
-                             (gnus-topic-goto-topic (gnus-current-topic))
-                             (gnus-group-topic-level))
-                           0))
-                    ? ))
-                  (yanked (list group))
-                  alist talist end)
-             ;; Then we enter the yanked groups into the topics they belong
-             ;; to.
-             (when (setq alist (assoc (save-excursion
-                                        (forward-line -1)
-                                        (or
-                                         (gnus-current-topic)
-                                         (caar gnus-topic-topology)))
-                                      gnus-topic-alist))
-               (setq talist alist)
-               (when (stringp yanked)
-                 (setq yanked (list yanked)))
-               (if (not prev)
-                   (nconc alist yanked)
-                 (if (not (cdr alist))
-                     (setcdr alist (nconc yanked (cdr alist)))
-                   (while (and (not end) (cdr alist))
-                     (when (equal (cadr alist) prev)
+    (let ((buffer-read-only nil))
+      (unless gnus-topic-inhibit-change-level
+       (gnus-group-goto-group (or (car (nth 2 previous)) group))
+       (when (and gnus-topic-mode
+                  gnus-topic-alist
+                  (not gnus-topic-inhibit-change-level))
+         ;; Remove the group from the topics.
+         (if (and (< oldlevel gnus-level-zombie)
+                  (>= level gnus-level-zombie))
+             (let ((alist gnus-topic-alist))
+               (while (gnus-group-goto-group group)
+                 (gnus-delete-line))
+               (while alist
+                 (when (member group (car alist))
+                   (setcdr (car alist) (delete group (cdar alist))))
+                 (pop alist)))
+           ;; If the group is subscribed we enter it into the topics.
+           (when (and (< level gnus-level-zombie)
+                      (>= oldlevel gnus-level-zombie))
+             (let* ((prev (gnus-group-group-name))
+                    (gnus-topic-inhibit-change-level t)
+                    (gnus-group-indentation
+                     (make-string
+                      (* gnus-topic-indent-level
+                         (or (save-excursion
+                               (gnus-topic-goto-topic (gnus-current-topic))
+                               (gnus-group-topic-level))
+                             0))
+                      ? ))
+                    (yanked (list group))
+                    alist talist end)
+               ;; Then we enter the yanked groups into the topics they belong
+               ;; to.
+               (when (setq alist (assoc (save-excursion
+                                          (forward-line -1)
+                                          (or
+                                           (gnus-current-topic)
+                                           (caar gnus-topic-topology)))
+                                        gnus-topic-alist))
+                 (setq talist alist)
+                 (when (stringp yanked)
+                   (setq yanked (list yanked)))
+                 (if (not prev)
+                     (nconc alist yanked)
+                   (if (not (cdr alist))
                        (setcdr alist (nconc yanked (cdr alist)))
-                       (setq end t))
-                     (setq alist (cdr alist)))
-                   (unless end
-                     (nconc talist yanked))))))
-           (gnus-topic-update-topic)))))))
+                     (while (and (not end) (cdr alist))
+                       (when (equal (cadr alist) prev)
+                         (setcdr alist (nconc yanked (cdr alist)))
+                         (setq end t))
+                       (setq alist (cdr alist)))
+                     (unless end
+                       (nconc talist yanked))))))
+             (gnus-topic-update-topic))))))))
 
 (defun gnus-topic-goto-next-group (group props)
   "Go to group or the next group after group."