Fix my last change.
[gnus] / lisp / gnus-win.el
index ca2a2d4..6a9ce29 100644 (file)
@@ -1,5 +1,6 @@
 ;;; gnus-win.el --- window configuration functions for Gnus
-;; Copyright (C) 1996,97,98,99 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 1997, 1998, 1999, 2000
+;;        Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
@@ -286,7 +287,7 @@ See the Gnus manual for an explanation of the syntax used.")
 (defun gnus-configure-frame (split &optional window)
   "Split WINDOW according to SPLIT."
   (unless window
-    (setq window (get-buffer-window (current-buffer))))
+    (setq window (or (get-buffer-window (current-buffer)) (selected-window))))
   (select-window window)
   ;; This might be an old-stylee buffer config.
   (when (vectorp split)
@@ -319,8 +320,10 @@ See the Gnus manual for an explanation of the syntax used.")
                          (t (cdr (assq type gnus-window-to-buffer))))))
        (unless buffer
          (error "Invalid buffer type: %s" type))
-       (switch-to-buffer (gnus-get-buffer-create
-                          (gnus-window-to-buffer-helper buffer)))
+       (let ((buf (gnus-get-buffer-create
+                   (gnus-window-to-buffer-helper buffer))))
+         (if (eq buf (window-buffer (selected-window))) (set-buffer buf)
+           (switch-to-buffer buf)))
        (when (memq 'frame-focus split)
          (setq gnus-window-frame-focus window))
        ;; We return the window if it has the `point' spec.
@@ -421,7 +424,7 @@ See the Gnus manual for an explanation of the syntax used.")
       (setq gnus-frame-split-p nil)
 
       (unless split
-       (error "No such setting: %s" setting))
+       (error "No such setting in `gnus-buffer-configuration': %s" setting))
 
       (if (and (setq all-visible (gnus-all-windows-visible-p split))
               (not force))
@@ -447,9 +450,9 @@ See the Gnus manual for an explanation of the syntax used.")
                (switch-to-buffer nntp-server-buffer))
            (select-frame frame)))
 
-       (switch-to-buffer nntp-server-buffer)
        (let (gnus-window-frame-focus)
-         (gnus-configure-frame split (get-buffer-window (current-buffer)))
+         (switch-to-buffer nntp-server-buffer)
+         (gnus-configure-frame split)
          (when gnus-window-frame-focus
            (select-frame (window-frame gnus-window-frame-focus))))))))