Recursive mark and unmark.
authorShengHuo ZHU <zsh@cs.rochester.edu>
Fri, 15 Sep 2000 17:09:29 +0000 (17:09 +0000)
committerShengHuo ZHU <zsh@cs.rochester.edu>
Fri, 15 Sep 2000 17:09:29 +0000 (17:09 +0000)
lisp/ChangeLog
lisp/gnus-topic.el

index 805d966..2c572a4 100644 (file)
@@ -1,3 +1,9 @@
+2000-09-15 14:03:00  ShengHuo ZHU  <zsh@cs.rochester.edu>
+
+       * gnus-topic.el (gnus-topic-find-groups): Add recursive parameter.
+       (gnus-topic-mark-topic): Ditto.
+       (gnus-topic-unmark-topic): Ditto.
+
 2000-09-15 09:01:40  ShengHuo ZHU  <zsh@cs.rochester.edu>
 
        * gnus-art.el (gnus-treat-display-xface): By default, Emacs 21
index 2a320d4..8eaec50 100644 (file)
@@ -192,8 +192,9 @@ If TOPIC, start with that topic."
     (beginning-of-line)
     (get-text-property (point) 'gnus-active)))
 
-(defun gnus-topic-find-groups (topic &optional level all lowest)
-  "Return entries for all visible groups in TOPIC."
+(defun gnus-topic-find-groups (topic &optional level all lowest recursive)
+  "Return entries for all visible groups in TOPIC.
+If RECURSIVE is t, return groups in its subtopics too."
   (let ((groups (cdr (assoc topic gnus-topic-alist)))
         info clevel unread group params visible-groups entry active)
     (setq lowest (or lowest 1))
@@ -231,7 +232,18 @@ If TOPIC, start with that topic."
           (cdr (assq 'visible params)))
        ;; Add this group to the list of visible groups.
        (push (or entry group) visible-groups)))
-    (nreverse visible-groups)))
+    (setq visible-groups (nreverse visible-groups))
+    (when recursive 
+      (if (eq recursive t)
+         (setq recursive (cdr (gnus-topic-find-topology topic))))
+      (mapcar (lambda (topic-topology)
+               (setq visible-groups 
+                     (nconc visible-groups 
+                            (gnus-topic-find-groups
+                             (caar topic-topology) 
+                             level all lowest topic-topology))))
+             (cdr recursive)))
+    visible-groups))
 
 (defun gnus-topic-previous-topic (topic)
   "Return the previous topic on the same level as TOPIC."
@@ -1292,23 +1304,30 @@ If PERMANENT, make it stay shown in subsequent sessions as well."
        (setcar (cdr (cadr topic)) 'visible)
        (gnus-group-list-groups)))))
 
-(defun gnus-topic-mark-topic (topic &optional unmark)
-  "Mark all groups in the topic with the process mark."
-  (interactive (list (gnus-group-topic-name)))
+(defun gnus-topic-mark-topic (topic &optional unmark recursive)
+  "Mark all groups in the TOPIC with the process mark.
+If RECURSIVE is t, mark its subtopics too."
+  (interactive (list (gnus-group-topic-name)
+                    nil
+                    (and current-prefix-arg t)))
   (if (not topic)
       (call-interactively 'gnus-group-mark-group)
     (save-excursion
-      (let ((groups (gnus-topic-find-groups topic gnus-level-killed t)))
+      (let ((groups (gnus-topic-find-groups topic gnus-level-killed t nil 
+                                           recursive)))
        (while groups
          (funcall (if unmark 'gnus-group-remove-mark 'gnus-group-set-mark)
                   (gnus-info-group (nth 2 (pop groups)))))))))
 
-(defun gnus-topic-unmark-topic (topic &optional unmark)
-  "Remove the process mark from all groups in the topic."
-  (interactive (list (gnus-group-topic-name)))
+(defun gnus-topic-unmark-topic (topic &optional dummy recursive)
+  "Remove the process mark from all groups in the TOPIC.
+If RECURSIVE is t, unmark its subtopics too."
+  (interactive (list (gnus-group-topic-name)
+                    nil
+                    (and current-prefix-arg t)))
   (if (not topic)
       (call-interactively 'gnus-group-unmark-group)
-    (gnus-topic-mark-topic topic t)))
+    (gnus-topic-mark-topic topic t recursive)))
 
 (defun gnus-topic-get-new-news-this-topic (&optional n)
   "Check for new news in the current topic."