*** empty log message ***
[gnus] / lisp / nnvirtual.el
index f31a31e..7a97ce7 100644 (file)
@@ -25,7 +25,7 @@
 ;;; Commentary:
 
 ;; The other access methods (nntp, nnspool, etc) are general news
-;; access methods. This module relies on Gnus and can not be used
+;; access methods.  This module relies on Gnus and can not be used
 ;; separately.
 
 ;;; Code:
@@ -34,6 +34,9 @@
 (require 'nnheader)
 (require 'gnus)
 (require 'nnoo)
+(require 'gnus-util)
+(require 'gnus-start)
+(require 'gnus-sum)
 (eval-when-compile (require 'cl))
 
 (nnoo-declare nnvirtual)
@@ -48,12 +51,14 @@ virtual group.")
 (defvoo nnvirtual-component-regexp nil
   "*Regexp to match component groups.")
 
+(defvoo nnvirtual-component-groups nil
+  "Component group in this nnvirtual group.")
+
 \f
 
 (defconst nnvirtual-version "nnvirtual 1.0")
 
 (defvoo nnvirtual-current-group nil)
-(defvoo nnvirtual-component-groups nil)
 (defvoo nnvirtual-mapping nil)
 
 (defvoo nnvirtual-status-string "")
@@ -189,14 +194,15 @@ virtual group.")
   (if nnvirtual-component-groups
       t
     (setq nnvirtual-mapping nil)
-    ;; Go through the newsrc alist and find all component groups.
-    (let ((newsrc (cdr gnus-newsrc-alist))
-         group)
-      (while (setq group (car (pop newsrc)))
-       (when (string-match nnvirtual-component-regexp group) ; Match
-         ;; Add this group to the list of component groups.
-         (setq nnvirtual-component-groups
-               (cons group (delete group nnvirtual-component-groups))))))
+    (when nnvirtual-component-regexp
+      ;; Go through the newsrc alist and find all component groups.
+      (let ((newsrc (cdr gnus-newsrc-alist))
+           group)
+       (while (setq group (car (pop newsrc)))
+         (when (string-match nnvirtual-component-regexp group) ; Match
+           ;; Add this group to the list of component groups.
+           (setq nnvirtual-component-groups
+                 (cons group (delete group nnvirtual-component-groups)))))))
     (if (not nnvirtual-component-groups)
        (nnheader-report 'nnvirtual "No component groups: %s" server)
       t)))
@@ -228,13 +234,15 @@ virtual group.")
         (cgroup (cadr nart))
         ;; The component group might be a virtual group.
         (nmark (gnus-request-update-mark cgroup (caddr nart) mark)))
-    (when (and (= mark nmark)
+    (when (and nart
+              (= mark nmark)
               (gnus-group-auto-expirable-p cgroup))
       (setq mark gnus-expirable-mark)))
   mark)
     
 (deffoo nnvirtual-close-group (group &optional server)
-  (when (nnvirtual-possibly-change-server server)
+  (when (and (nnvirtual-possibly-change-server server)
+            (not (gnus-ephemeral-group-p (nnvirtual-current-group))))
     ;; Copy (un)read articles.
     (nnvirtual-update-reads)
     ;; We copy the marks from this group to the component
@@ -372,7 +380,7 @@ virtual group.")
 (defun nnvirtual-create-mapping ()
   "Create an article mapping for the current group."
   (let* ((div nil)
-        m marks list article unreads marks active
+        m unreads marks active 
         (map (sort
               (apply 
                'nconc
@@ -401,7 +409,7 @@ virtual group.")
     (setq nnvirtual-mapping map)
     ;; Set the virtual article numbers.
     (while (setq m (pop map))
-      (setcar m (setq article (incf i))))))
+      (setcar m (incf i)))))
 
 (provide 'nnvirtual)