* gnus.el (gnus-revision-number): Increment to 01.
[elisp/gnus.git-] / lisp / gnus-start.el
index b952624..15b5603 100644 (file)
@@ -854,6 +854,7 @@ prompt the user for the name of an NNTP server to use."
   "Setup news information.
 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."
+  (require 'nnmail)
   (let ((init (not (and gnus-newsrc-alist gnus-active-hashtb (not rawfile))))
        ;; Binding this variable will inhibit multiple fetchings
        ;; of the same mail source.
@@ -2253,12 +2254,6 @@ If FORCE is non-nil, the .newsrc file is read."
 
       (setq gnus-newsrc-options-n out))))
 
-;; The following four lines will be deleted in the future.
-(require 'poe)
-(defun-maybe save-buffer-as-coding-system (coding-system &optional args)
-  (let ((coding-system-for-write coding-system))
-    (save-buffer args)))
-
 (defun gnus-save-newsrc-file (&optional force)
   "Save .newsrc file."
   ;; Note: We cannot save .newsrc file if all newsgroups are removed
@@ -2301,6 +2296,14 @@ If FORCE is non-nil, the .newsrc file is read."
        (gnus-dribble-delete-file)
        (gnus-group-set-mode-line)))))
 
+;; Call the function above at C-x C-c.
+(defadvice save-buffers-kill-emacs (before save-gnus-newsrc-file-maybe activate)
+  "Save .newsrc and .newsrc.eld when Emacs is killed."
+  (when (get-buffer gnus-group-buffer)
+    (gnus-run-hooks 'gnus-exit-gnus-hook)
+    (gnus-offer-save-summaries)
+    (gnus-save-newsrc-file)))
+
 (defun gnus-gnus-to-quick-newsrc-format ()
   "Insert Gnus variables such as gnus-newsrc-alist in lisp format."
   (let ((print-quoted t)