Revision: miles@gnu.org--gnu-2004/gnus--devo--0--patch-21
[gnus] / lisp / gnus-start.el
index 75fa5ea..d324023 100644 (file)
@@ -1,5 +1,5 @@
 ;;; gnus-start.el --- startup functions for Gnus
-;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
 ;;        Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
@@ -496,19 +496,23 @@ Can be used to turn version control on or off."
 
 (defun gnus-subscribe-hierarchical-interactive (groups)
   (let ((groups (sort groups 'string<))
-       prefixes prefix start ans group starts)
+       prefixes prefix start ans group starts real-group)
     (while groups
       (setq prefixes (list "^"))
       (while (and groups prefixes)
-       (while (not (string-match (car prefixes) (car groups)))
+       (while (not (string-match (car prefixes)
+                                 (gnus-group-real-name (car groups))))
          (setq prefixes (cdr prefixes)))
        (setq prefix (car prefixes))
        (setq start (1- (length prefix)))
-       (if (and (string-match "[^\\.]\\." (car groups) start)
+       (if (and (string-match "[^\\.]\\." (gnus-group-real-name (car groups))
+                              start)
                 (cdr groups)
                 (setq prefix
-                      (concat "^" (substring (car groups) 0 (match-end 0))))
-                (string-match prefix (cadr groups)))
+                      (concat "^" (substring
+                                   (gnus-group-real-name (car groups))
+                                   0 (match-end 0))))
+                (string-match prefix (gnus-group-real-name (cadr groups))))
            (progn
              (push prefix prefixes)
              (message "Descend hierarchy %s? ([y]nsq): "
@@ -520,16 +524,18 @@ Can be used to turn version control on or off."
                         (substring prefix 1 (1- (length prefix)))))
              (cond ((= ans ?n)
                     (while (and groups
-                                (string-match prefix
-                                              (setq group (car groups))))
+                                (setq group (car groups)
+                                      real-group (gnus-group-real-name group))
+                                (string-match prefix real-group))
                       (push group gnus-killed-list)
                       (gnus-sethash group group gnus-killed-hashtb)
                       (setq groups (cdr groups)))
                     (setq starts (cdr starts)))
                    ((= ans ?s)
                     (while (and groups
-                                (string-match prefix
-                                              (setq group (car groups))))
+                                (setq group (car groups)
+                                      real-group (gnus-group-real-name group))
+                                (string-match prefix real-group))
                       (gnus-sethash group group gnus-killed-hashtb)
                       (gnus-subscribe-alphabetically (car groups))
                       (setq groups (cdr groups)))
@@ -870,7 +876,7 @@ prompt the user for the name of an NNTP server to use."
          (when (and (file-exists-p gnus-current-startup-file)
                     (file-exists-p dribble-file)
                     (setq modes (file-modes gnus-current-startup-file)))
-           (set-file-modes dribble-file modes))
+           (gnus-set-file-modes dribble-file modes))
          (goto-char (point-min))
          (when (search-forward "Gnus was exited on purpose" nil t)
            (setq purpose t))
@@ -1637,12 +1643,12 @@ newsgroup."
         (methods-cache nil)
         (type-cache nil)
         scanned-methods info group active method retrieve-groups cmethod
-        method-type)
+        method-type ignore)
     (gnus-message 6 "Checking new news...")
 
     (while newsrc
       (setq active (gnus-active (setq group (gnus-info-group
-                                                 (setq info (pop newsrc))))))
+                                            (setq info (pop newsrc))))))
 
       ;; Check newsgroups.  If the user doesn't want to check them, or
       ;; they can't be checked (for instance, if the news server can't
@@ -1665,28 +1671,31 @@ newsgroup."
       (when (and method
                 (not (setq method-type (cdr (assoc method type-cache)))))
        (setq method-type
-                  (cond
-                   ((gnus-secondary-method-p method)
-                    'secondary)
-                   ((inline (gnus-server-equal gnus-select-method method))
-                    'primary)
-                   (t
-                    'foreign)))
+             (cond
+              ((gnus-secondary-method-p method)
+               'secondary)
+              ((inline (gnus-server-equal gnus-select-method method))
+               'primary)
+              (t
+               'foreign)))
        (push (cons method method-type) type-cache))
 
+      (setq ignore nil)
       (cond ((and method (eq method-type 'foreign))
             ;; These groups are foreign.  Check the level.
-            (when (and (<= (gnus-info-level info) foreign-level)
-                       (setq active (gnus-activate-group group 'scan)))
-              ;; Let the Gnus agent save the active file.
-              (when (and gnus-agent active (gnus-online method))
-                (gnus-agent-save-group-info
-                 method (gnus-group-real-name group) active))
-              (unless (inline (gnus-virtual-group-p group))
-                (inline (gnus-close-group group)))
-              (when (fboundp (intern (concat (symbol-name (car method))
-                                             "-request-update-info")))
-                (inline (gnus-request-update-info info method)))))
+            (if (<= (gnus-info-level info) foreign-level)
+                (when (and (<= (gnus-info-level info) foreign-level)
+                           (setq active (gnus-activate-group group 'scan)))
+                  ;; Let the Gnus agent save the active file.
+                  (when (and gnus-agent active (gnus-online method))
+                    (gnus-agent-save-group-info
+                     method (gnus-group-real-name group) active))
+                  (unless (inline (gnus-virtual-group-p group))
+                    (inline (gnus-close-group group)))
+                  (when (fboundp (intern (concat (symbol-name (car method))
+                                                 "-request-update-info")))
+                    (inline (gnus-request-update-info info method))))
+              (setq ignore t)))
            ;; These groups are native or secondary.
            ((> (gnus-info-level info) level)
             ;; We don't want these groups.
@@ -1725,6 +1734,10 @@ newsgroup."
        ((eq active 'ignore)
        ;; Don't do anything.
        )
+       ((and active ignore)
+       ;; The level of the foreign group is higher than the specified
+       ;; value.
+       )
        (active
        (inline (gnus-get-unread-articles-in-group info active t)))
        (t
@@ -1745,8 +1758,8 @@ newsgroup."
          (when (gnus-check-backend-function 'request-scan (car method))
            (gnus-request-scan nil method))
          (gnus-read-active-file-2
-               (mapcar (lambda (group) (gnus-group-real-name group)) groups)
-               method)
+          (mapcar (lambda (group) (gnus-group-real-name group)) groups)
+          method)
          (dolist (group groups)
            (cond
             ((setq active (gnus-active (gnus-info-group
@@ -2752,7 +2765,7 @@ If FORCE is non-nil, the .newsrc file is read."
 
                       ;; Replace the existing startup file with the temp file.
                       (rename-file working-file startup-file t)
-                      (set-file-modes startup-file setmodes)))
+                      (gnus-set-file-modes startup-file setmodes)))
                 (condition-case nil
                     (delete-file working-file)
                   (file-error nil)))))
@@ -2897,7 +2910,7 @@ If FORCE is non-nil, the .newsrc file is read."
       (let ((coding-system-for-write gnus-ding-file-coding-system))
        (gnus-write-buffer slave-name))
       (when modes
-       (set-file-modes slave-name modes)))))
+       (gnus-set-file-modes slave-name modes)))))
 
 (defun gnus-master-read-slave-newsrc ()
   (let ((slave-files
@@ -3080,6 +3093,7 @@ Would otherwise be an alias for `display-time-event-handler'." nil))))
 
 (provide 'gnus-start)
 
+;;; arch-tag: f4584a22-b7b7-4853-abfc-a637329af5d2
 ;;; gnus-start.el ends here