Importing Pterodactyl Gnus v0.96.
[elisp/gnus.git-] / lisp / gnus-start.el
index 37a9b0b..ef27428 100644 (file)
@@ -369,7 +369,7 @@ This hook is called as the first thing when Gnus is started."
 (defcustom gnus-after-getting-new-news-hook
   (when (gnus-boundp 'display-time-timer)
     '(display-time-event-handler))
-  "*A hook run after Gnus checks for new news."
+  "*A hook run after Gnus checks for new news when Gnus is already running."
   :group 'gnus-group-new
   :type 'hook)
 
@@ -1761,7 +1761,7 @@ newsgroup."
       (insert ?\\))
 
     ;; Let the Gnus agent save the active file.
-    (when (and gnus-agent real-active)
+    (when (and gnus-agent real-active gnus-plugged)
       (gnus-agent-save-active method))
 
     ;; If these are groups from a foreign select method, we insert the
@@ -1828,39 +1828,41 @@ newsgroup."
                     (gnus-group-prefixed-name "" method))))
 
     ;; Let the Gnus agent save the active file.
-    (when (and gnus-agent real-active)
-      (gnus-agent-save-groups method))
+    (if (and gnus-agent real-active gnus-plugged (gnus-agent-method-p method))
+       (progn
+         (gnus-agent-save-groups method)
+         (gnus-active-to-gnus-format method hashtb nil real-active))
 
-    (goto-char (point-min))
-    ;; We split this into to separate loops, one with the prefix
-    ;; and one without to speed the reading up somewhat.
-    (if prefix
-       (let (min max opoint group)
+      (goto-char (point-min))
+      ;; We split this into to separate loops, one with the prefix
+      ;; and one without to speed the reading up somewhat.
+      (if prefix
+         (let (min max opoint group)
+           (while (not (eobp))
+             (condition-case ()
+                 (progn
+                   (read cur) (read cur)
+                   (setq min (read cur)
+                         max (read cur)
+                         opoint (point))
+                   (skip-chars-forward " \t")
+                   (insert prefix)
+                   (goto-char opoint)
+                   (set (let ((obarray hashtb)) (read cur))
+                        (cons min max)))
+               (error (and group (symbolp group) (set group nil))))
+             (forward-line 1)))
+       (let (min max group)
          (while (not (eobp))
            (condition-case ()
-               (progn
+               (when (eq (char-after) ?2)
                  (read cur) (read cur)
                  (setq min (read cur)
-                       max (read cur)
-                       opoint (point))
-                 (skip-chars-forward " \t")
-                 (insert prefix)
-                 (goto-char opoint)
-                 (set (let ((obarray hashtb)) (read cur))
+                       max (read cur))
+                 (set (setq group (let ((obarray hashtb)) (read cur)))
                       (cons min max)))
              (error (and group (symbolp group) (set group nil))))
-           (forward-line 1)))
-      (let (min max group)
-       (while (not (eobp))
-         (condition-case ()
-             (when (eq (char-after) ?2)
-               (read cur) (read cur)
-               (setq min (read cur)
-                     max (read cur))
-               (set (setq group (let ((obarray hashtb)) (read cur)))
-                    (cons min max)))
-           (error (and group (symbolp group) (set group nil))))
-         (forward-line 1))))))
+           (forward-line 1)))))))
 
 (defun gnus-read-newsrc-file (&optional force)
   "Read startup file.