*** empty log message ***
[gnus] / lisp / gnus-start.el
index 0e427c1..ade47f5 100644 (file)
@@ -48,7 +48,7 @@ instead."
 
 (defcustom gnus-site-init-file
   (ignore-errors
-    (concat (file-name-directory 
+    (concat (file-name-directory
             (directory-file-name installation-directory))
            "site-lisp/gnus-init"))
   "The site-wide Gnus elisp startup file.
@@ -320,7 +320,7 @@ does not affect old (already subscribed) newsgroups."
                 (const :tag "none" nil)))
 
 (defcustom gnus-modtime-botch nil
-  "*Non-nil means .newsrc should be deleted prior to save.  
+  "*Non-nil means .newsrc should be deleted prior to save.
 Its use is due to the bogus appearance that .newsrc was modified on
 disc."
   :group 'gnus-newsrc
@@ -337,12 +337,17 @@ This hook is called after Gnus is connected to the NNTP server."
   :group 'gnus-start
   :type 'hook)
 
+(defcustom gnus-started-hook nil
+  "A hook called as the last thing after startup."
+  :group 'gnus-start
+  :type 'hook)
+
 (defcustom gnus-get-new-news-hook nil
   "A hook run just before Gnus checks for new news."
   :group 'gnus-group-new
   :type 'hook)
 
-(defcustom gnus-after-getting-new-news-hook 
+(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."
@@ -389,7 +394,7 @@ Can be used to turn version control on or off."
 ;; Suggested by Brian Edmonds <edmonds@cs.ubc.ca>.
 (defvar gnus-init-inhibit nil)
 (defun gnus-read-init-file (&optional inhibit-next)
-  ;; Don't load .gnus if -q option was used.
+  ;; Don't load .gnus if the -q option was used.
   (when init-file-user
     (if gnus-init-inhibit
        (setq gnus-init-inhibit nil)
@@ -630,7 +635,10 @@ prompt the user for the name of an NNTP server to use."
             (eq major-mode 'gnus-group-mode)))
       (progn
        (switch-to-buffer gnus-group-buffer)
-       (gnus-group-get-new-news))
+       (gnus-group-get-new-news
+        (and (numberp arg)
+             (> arg 0)
+             (max (car gnus-group-list-mode) arg))))
 
     (gnus-splash)
     (gnus-clear-system)
@@ -675,7 +683,8 @@ prompt the user for the name of an NNTP server to use."
          (gnus-group-list-groups level)
          (gnus-group-first-unread-group)
          (gnus-configure-windows 'group)
-         (gnus-group-set-mode-line))))))
+         (gnus-group-set-mode-line)
+         (run-hooks 'gnus-started-hook))))))
 
 ;;;###autoload
 (defun gnus-unload ()
@@ -806,7 +815,7 @@ If RAWFILE is non-nil, the .newsrc file will also be read.
 If LEVEL is non-nil, the news will be set up at level LEVEL."
   (let ((init (not (and gnus-newsrc-alist gnus-active-hashtb (not rawfile)))))
 
-    (when init 
+    (when init
       ;; Clear some variables to re-initialize news information.
       (setq gnus-newsrc-alist nil
            gnus-active-hashtb nil)
@@ -840,8 +849,8 @@ If LEVEL is non-nil, the news will be set up at level LEVEL."
       (gnus-cache-open))
 
     ;; Possibly eval the dribble file.
-    (and init 
-        (or gnus-use-dribble-file gnus-slave) 
+    (and init
+        (or gnus-use-dribble-file gnus-slave)
         (gnus-dribble-eval-file))
 
     ;; Slave Gnusii should then clear the dribble buffer.
@@ -865,7 +874,7 @@ If LEVEL is non-nil, the news will be set up at level LEVEL."
       (gnus-find-new-newsgroups))
 
     ;; We might read in new NoCeM messages here.
-    (when (and gnus-use-nocem 
+    (when (and gnus-use-nocem
               (not level)
               (not dont-connect))
       (gnus-nocem-scan-groups))
@@ -1147,7 +1156,7 @@ the server for new groups."
       ;; Finally we enter (if needed) the list where it is supposed to
       ;; go, and change the subscription level.  If it is to be killed,
       ;; we enter it into the killed or zombie list.
-      (cond 
+      (cond
        ((>= level gnus-level-zombie)
        ;; Remove from the hash table.
        (gnus-sethash group nil gnus-newsrc-hashtb)
@@ -1274,7 +1283,7 @@ newsgroup."
     "Alter the ACTIVE info for GROUP to reflect the articles in the cache."
     (when gnus-cache-active-hashtb
       (let ((cache-active (gnus-gethash group gnus-cache-active-hashtb)))
-       (and cache-active 
+       (and cache-active
             (< (car cache-active) (car active))
             (setcar active (car cache-active)))
        (and cache-active
@@ -1284,7 +1293,7 @@ newsgroup."
 (defun gnus-get-unread-articles-in-group (info active &optional update)
   (when active
     ;; Allow the backend to update the info in the group.
-    (when (and update 
+    (when (and update
               (gnus-request-update-info
                info (gnus-find-method-for-group (gnus-info-group info))))
       (gnus-activate-group (gnus-info-group info) nil t))
@@ -1292,7 +1301,7 @@ newsgroup."
           (num 0))
       ;; If a cache is present, we may have to alter the active info.
       (when (and gnus-use-cache info)
-       (inline (gnus-cache-possibly-alter-active 
+       (inline (gnus-cache-possibly-alter-active
                 (gnus-info-group info) active)))
       ;; Modify the list of read articles according to what articles
       ;; are available; then tally the unread articles and add the
@@ -1543,7 +1552,7 @@ newsgroup."
 ;; Get the active file(s) from the backend(s).
 (defun gnus-read-active-file (&optional force)
   (gnus-group-set-mode-line)
-  (let ((methods 
+  (let ((methods
         (append
          (if (gnus-check-server gnus-select-method)
              ;; The native server is available.
@@ -1581,7 +1590,7 @@ newsgroup."
                    groups info)
                (while (setq info (pop newsrc))
                  (when (gnus-server-equal
-                        (gnus-find-method-for-group 
+                        (gnus-find-method-for-group
                          (gnus-info-group info) info)
                         gmethod)
                    (push (gnus-group-real-name (gnus-info-group info))
@@ -1619,7 +1628,7 @@ newsgroup."
   ;; (concat (regexp-quote "^to\\.") "\\($\\|" (regexp-quote "\\|") "\\)")
   (string-match "\\^to\\\\\\.\\($\\|\\\\|\\)"
                gnus-ignored-newsgroups))
-  
+
 ;; Read an active file and place the results in `gnus-active-hashtb'.
 (defun gnus-active-to-gnus-format (&optional method hashtb ignore-errors)
   (unless method
@@ -1781,7 +1790,7 @@ If FORCE is non-nil, the .newsrc file is read."
          (gnus-newsrc-to-gnus-format)
          (kill-buffer (current-buffer))
          (gnus-message 5 "Reading %s...done" newsrc-file)))
-      
+
       ;; Convert old to new.
       (gnus-convert-old-newsrc))))
 
@@ -1819,7 +1828,10 @@ If FORCE is non-nil, the .newsrc file is read."
       (condition-case nil
          (load ding-file t t t)
        (error
-        (gnus-error 1 "Error in %s" ding-file)))
+        (ding)
+        (unless (gnus-yes-or-no-p
+                 (format "Error in %s; continue? " ding-file))
+          (error "Error in %s" ding-file))))
       (when gnus-newsrc-assoc
        (setq gnus-newsrc-alist gnus-newsrc-assoc)))
     (gnus-make-hashtable-from-newsrc-alist)
@@ -1862,7 +1874,7 @@ If FORCE is non-nil, the .newsrc file is read."
          (unless (nthcdr 3 info)
            (nconc info (list nil)))
          (gnus-info-set-marks
-          info (list (cons 'tick (gnus-compress-sequence 
+          info (list (cons 'tick (gnus-compress-sequence
                                   (sort (cdr m) '<) t))))))
       (setq newsrc killed)
       (while newsrc
@@ -1942,7 +1954,7 @@ If FORCE is non-nil, the .newsrc file is read."
                           (point)))))
        (forward-line -1))
        (symbol
-       ;; Group names can be just numbers.  
+       ;; Group names can be just numbers.
        (when (numberp symbol)
          (setq symbol (intern (int-to-string symbol) gnus-active-hashtb)))
        (unless (boundp symbol)
@@ -2338,7 +2350,7 @@ If FORCE is non-nil, the .newsrc file is read."
 ;;;
 
 (defun gnus-read-all-descriptions-files ()
-  (let ((methods (cons gnus-select-method 
+  (let ((methods (cons gnus-select-method
                       (nconc
                        (when (gnus-archive-server-wanted-p)
                          (list "archive"))
@@ -2428,7 +2440,7 @@ If FORCE is non-nil, the .newsrc file is read."
 (defun gnus-set-default-directory ()
   "Set the default directory in the current buffer to `gnus-default-directory'.
 If this variable is nil, don't do anything."
-  (setq default-directory 
+  (setq default-directory
        (if (and gnus-default-directory
                 (file-exists-p gnus-default-directory))
            (file-name-as-directory (expand-file-name gnus-default-directory))