Importing Oort Gnus v0.06.
[elisp/gnus.git-] / lisp / gnus-start.el
index 01d5351..fce7384 100644 (file)
@@ -1,5 +1,5 @@
 ;;; gnus-start.el --- startup functions for Gnus
-;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
+;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
 ;;        Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
@@ -303,7 +303,7 @@ hierarchy in its entirety."
   :type 'boolean)
 
 (defcustom gnus-auto-subscribed-groups
-  "^nnml\\|^nnfolder\\|^nnmbox\\|^nnmh\\|^nnbabyl"
+  "^nnml\\|^nnfolder\\|^nnmbox\\|^nnmh\\|^nnbabyl\\|^nnmaildir"
   "*All new groups that match this regexp will be subscribed automatically.
 Note that this variable only deals with new groups.  It has no effect
 whatsoever on old groups.
@@ -409,11 +409,8 @@ Can be used to turn version control on or off."
 
 ;;; Internal variables
 
-(defvar gnus-startup-file-coding-system 'binary
-  "*Coding system for startup file.")
-
 (defvar gnus-ding-file-coding-system mm-universal-coding-system
-  "*Coding system for ding file.")
+  "Coding system for ding file.")
 
 (defvar gnus-newsrc-file-version nil)
 (defvar gnus-override-subscribe-method nil)
@@ -441,25 +438,15 @@ Can be used to turn version control on or off."
     (if gnus-init-inhibit
        (setq gnus-init-inhibit nil)
       (setq gnus-init-inhibit inhibit-next)
-      (let ((files (list gnus-site-init-file gnus-init-file))
-           file)
-       (while files
-         (and (setq file (pop files))
-              (or (and (file-exists-p file)
-                       ;; Don't try to load a directory.
-                       (not (file-directory-p file)))
-                  (file-exists-p (concat file ".el"))
-                  (file-exists-p (concat file ".elc")))
-              (if (or debug-on-error debug-on-quit)
-                  (let ((coding-system-for-read
-                         gnus-startup-file-coding-system))
-                    (load file nil t))
-                (condition-case var
-                    (let ((coding-system-for-read
-                           gnus-startup-file-coding-system))
-                      (load file nil t))
-                  (error
-                   (error "Error in %s: %s" file var))))))))))
+      (dolist (file (list gnus-site-init-file gnus-init-file))
+       (when (and file
+                  (locate-library file))
+         (if (or debug-on-error debug-on-quit)
+             (load file nil t)
+           (condition-case var
+               (load file nil t)
+             (error
+              (error "Error in %s: %s" file (cadr var))))))))))
 
 ;; For subscribing new newsgroup
 
@@ -624,7 +611,7 @@ the first newsgroup."
 (defun gnus-clear-system ()
   "Clear all variables and buffers."
   ;; Clear Gnus variables.
-  (let ((variables gnus-variable-list))
+  (let ((variables (delete 'gnus-format-specs gnus-variable-list)))
     (while variables
       (set (car variables) nil)
       (setq variables (cdr variables))))
@@ -705,6 +692,8 @@ prompt the user for the name of an NNTP server to use."
     (nnheader-init-server-buffer)
     (setq gnus-slave slave)
     (gnus-read-init-file)
+    (if gnus-agent
+       (gnus-agentize))
 
     (when gnus-simple-splash
       (setq gnus-simple-splash nil)
@@ -1563,6 +1552,7 @@ newsgroup."
 ;; Go though `gnus-newsrc-alist' and compare with `gnus-active-hashtb'
 ;; and compute how many unread articles there are in each group.
 (defun gnus-get-unread-articles (&optional level)
+  (setq gnus-server-method-cache nil)
   (let* ((newsrc (cdr gnus-newsrc-alist))
         (level (or level gnus-activate-level (1+ gnus-level-subscribed)))
         (foreign-level
@@ -1603,7 +1593,7 @@ newsgroup."
          (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 gnus-plugged active)
+           (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))
@@ -1910,7 +1900,7 @@ newsgroup."
        (insert ?\\)))
 
     ;; Let the Gnus agent save the active file.
-    (when (and gnus-agent real-active gnus-plugged)
+    (when (and gnus-agent real-active (gnus-online method))
       (gnus-agent-save-active method))
 
     ;; If these are groups from a foreign select method, we insert the
@@ -1930,7 +1920,7 @@ newsgroup."
     (goto-char (point-min))
     (let (group max min)
       (while (not (eobp))
-       (condition-case err
+       (condition-case ()
            (progn
              (narrow-to-region (point) (gnus-point-at-eol))
              ;; group gets set to a symbol interned in the hash table
@@ -1986,7 +1976,7 @@ newsgroup."
     ;; Let the Gnus agent save the active file.
     (if (and gnus-agent
             real-active
-            gnus-plugged
+            (gnus-online method)
             (gnus-agent-method-p method))
        (progn
          (gnus-agent-save-groups method)
@@ -2027,7 +2017,7 @@ newsgroup."
   "Read startup file.
 If FORCE is non-nil, the .newsrc file is read."
   ;; Reset variables that might be defined in the .newsrc.eld file.
-  (let ((variables gnus-variable-list))
+  (let ((variables (delete 'gnus-format-specs gnus-variable-list)))
     (while variables
       (set (car variables) nil)
       (setq variables (cdr variables))))
@@ -2112,8 +2102,8 @@ If FORCE is non-nil, the .newsrc file is read."
             (and gnus-newsrc-file-version
                  (gnus-continuum-version gnus-newsrc-file-version))))
        (when (or (not version)
-                 (< version 5.090002))
-         (setq gnus-format-specs nil)))
+                 (< version 5.090009))
+         (setq gnus-format-specs gnus-default-format-specs)))
       (when gnus-newsrc-assoc
        (setq gnus-newsrc-alist gnus-newsrc-assoc)))
     (gnus-make-hashtable-from-newsrc-alist)
@@ -2592,7 +2582,7 @@ If FORCE is non-nil, the .newsrc file is read."
   (save-excursion
     (set-buffer gnus-dribble-buffer)
     (let ((slave-name
-          (make-temp-name (concat gnus-current-startup-file "-slave-")))
+          (mm-make-temp-file (concat gnus-current-startup-file "-slave-")))
          (modes (ignore-errors
                   (file-modes (concat gnus-current-startup-file ".eld")))))
       (let ((coding-system-for-write gnus-ding-file-coding-system))
@@ -2721,7 +2711,8 @@ If FORCE is non-nil, the .newsrc file is read."
                     (name (symbol-name group))
                     (charset
                      (or (gnus-group-name-charset method name)
-                         (gnus-parameter-charset name))))
+                         (gnus-parameter-charset name)
+                         gnus-default-charset)))
                (when (and str charset (featurep 'mule))
                  (setq str (mm-decode-coding-string str charset)))
                (set group str)))