*** empty log message ***
[gnus] / lisp / gnus-topic.el
index 2d64ac1..cf4f601 100644 (file)
 
 ;;; Code:
 
-(require 'gnus-load)
+(require 'gnus)
 (require 'gnus-group)
 (require 'gnus-start)
-(require 'gnus)
 
 (defvar gnus-topic-mode nil
   "Minor mode for Gnus group buffers.")
@@ -438,12 +437,18 @@ articles in the topic and its subtopics."
       (while (and (zerop (forward-line 1))
                  (> (or (gnus-group-topic-level) (1+ level)) level)))
       (delete-region beg (point))
-      (setcar (cdadr (gnus-topic-find-topology topic))
-             (if insert 'visible 'invisible))
-      (when hide
-       (setcdr (cdadr (gnus-topic-find-topology topic))
-               (list hide)))
-      (unless total-remove
+      ;; Do the change in this rather odd manner because it has been
+      ;; reported that some topics share parts of some lists, for some
+      ;; reason.  I have been unable to determine why this is the
+      ;; case, but this hack seems to take care of things.
+      (let ((data (cadr (gnus-topic-find-topology topic))))
+       (setcdr data
+               (list (if insert 'visible 'invisible)
+                     (if hide 'hide nil)
+                     (cadddr data))))
+      (if total-remove
+         (setq gnus-topic-alist
+               (delq (assoc topic gnus-topic-alist) gnus-topic-alist))
        (gnus-topic-insert-topic topic in-level)))))
 
 (defun gnus-topic-insert-topic (topic &optional level)
@@ -915,7 +920,8 @@ articles in the topic and its subtopics."
       (remove-hook 'gnus-group-change-level-function 
                   'gnus-topic-change-level)
       (remove-hook 'gnus-check-bogus-groups-hook 'gnus-topic-clean-alist)
-      (setq gnus-group-prepare-function 'gnus-group-prepare-flat))
+      (setq gnus-group-prepare-function 'gnus-group-prepare-flat)
+      (setq gnus-group-sort-alist-function 'gnus-group-sort-flat))
     (when redisplay
       (gnus-group-list-groups))))
     
@@ -1008,17 +1014,18 @@ If COPYP, copy the groups instead."
       (gnus-topic-goto-topic start-topic))
     (gnus-group-list-groups)))
 
-(defun gnus-topic-remove-group ()
+(defun gnus-topic-remove-group (&optional arg)
   "Remove the current group from the topic."
-  (interactive)
-  (let ((topicl (assoc (gnus-current-topic) gnus-topic-alist))
-       (group (gnus-group-group-name))
-       (buffer-read-only nil))
-    (when (and topicl group)
-      (gnus-delete-line)
-      (gnus-delete-first group topicl))
-    (gnus-topic-update-topic)
-    (gnus-group-position-point)))
+  (interactive "P")
+  (gnus-group-iterate arg 
+    (lambda (group)
+      (let ((topicl (assoc (gnus-current-topic) gnus-topic-alist))
+           (buffer-read-only nil))
+       (when (and topicl group)
+         (gnus-delete-line)
+         (gnus-delete-first group topicl))
+       (gnus-topic-update-topic)
+       (gnus-group-position-point)))))
 
 (defun gnus-topic-copy-group (n topic)
   "Copy the current group to a topic."
@@ -1034,7 +1041,8 @@ If COPYP, copy the groups instead."
       (let ((topic (gnus-group-topic-name)))
        (gnus-topic-remove-topic nil t)
        (push (gnus-topic-find-topology topic nil nil gnus-topic-topology)
-             gnus-topic-killed-topics))
+             gnus-topic-killed-topics)
+       (gnus-topic-enter-dribble))
     (gnus-group-kill-group n discard)
     (gnus-topic-update-topic)))
   
@@ -1049,6 +1057,7 @@ If COPYP, copy the groups instead."
        (gnus-topic-create-topic
         (caar item) (gnus-topic-parent-topic previous) previous
         item)
+       (gnus-topic-enter-dribble)
        (gnus-topic-goto-topic (caar item)))
     (let* ((prev (gnus-group-group-name))
           (gnus-topic-inhibit-change-level t)