This commit was generated by cvs2svn to compensate for changes in r5874,
[elisp/gnus.git-] / lisp / gnus-win.el
index 6c29c5b..c41fbae 100644 (file)
@@ -1,7 +1,7 @@
 ;;; gnus-win.el --- window configuration functions for Gnus
 ;; Copyright (C) 1996,97,98 Free Software Foundation, Inc.
 
-;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
+;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: news
 
 ;; This file is part of GNU Emacs.
      (vertical 1.0
               (summary 0.5 point)
               ("*Score Words*" 1.0)))
+    (split-trace
+     (vertical 1.0
+              (summary 0.5 point)
+              ("*Split Trace*" 1.0)))
     (category
      (vertical 1.0
               (category 1.0)))
@@ -185,6 +189,7 @@ See the Gnus manual for an explanation of the syntax used.")
     (picons . gnus-picons-buffer-name)
     (tree . gnus-tree-buffer)
     (score-trace . "*Score Trace*")
+    (split-trace . "*Split Trace*")
     (info . gnus-info-buffer)
     (category . gnus-category-buffer)
     (article-copy . gnus-article-copy)
@@ -197,6 +202,7 @@ See the Gnus manual for an explanation of the syntax used.")
   "The most recently set window configuration.")
 
 (defvar gnus-created-frames nil)
+(defvar gnus-window-frame-focus nil)
 
 (defun gnus-kill-gnus-frames ()
   "Kill all frames Gnus has created."
@@ -268,11 +274,14 @@ See the Gnus manual for an explanation of the syntax used.")
 (defvar gnus-frame-list nil)
 
 (defun gnus-window-to-buffer-helper (obj)
-  (if (symbolp obj)
-      (if (boundp obj)
-         (symbol-value obj)
-       (funcall obj))
-    obj))
+  (cond ((not (symbolp obj))
+        obj)
+       ((boundp obj)
+        (symbol-value obj))
+       ((fboundp obj)
+        (funcall obj))
+       (t
+        nil)))
 
 (defun gnus-configure-frame (split &optional window)
   "Split WINDOW according to SPLIT."
@@ -310,8 +319,10 @@ See the Gnus manual for an explanation of the syntax used.")
                          (t (cdr (assq type gnus-window-to-buffer))))))
        (unless buffer
          (error "Illegal buffer type: %s" type))
-       (switch-to-buffer (get-buffer-create
+       (switch-to-buffer (gnus-get-buffer-create
                           (gnus-window-to-buffer-helper buffer)))
+       (when (memq 'frame-focus split)
+         (setq gnus-window-frame-focus window))
        ;; We return the window if it has the `point' spec.
        (and (memq 'point split) window)))
      ;; This is a frame split.
@@ -435,15 +446,14 @@ See the Gnus manual for an explanation of the syntax used.")
          (select-frame frame)))
 
       (switch-to-buffer nntp-server-buffer)
-      (gnus-configure-frame split (get-buffer-window (current-buffer))))))
+      (let (gnus-window-frame-focus)
+       (gnus-configure-frame split (get-buffer-window (current-buffer)))
+       (when gnus-window-frame-focus
+         (select-frame (window-frame gnus-window-frame-focus)))))))
 
 (defun gnus-delete-windows-in-gnusey-frames ()
   "Do a `delete-other-windows' in all frames that have Gnus windows."
-  (let ((buffers
-        (mapcar
-         (lambda (elem)
-           (get-buffer (gnus-window-to-buffer-helper (cdr elem))))
-         gnus-window-to-buffer)))
+  (let ((buffers (gnus-buffers)))
     (mapcar
      (lambda (frame)
        (unless (eq (cdr (assq 'minibuffer
@@ -507,39 +517,22 @@ should have point."
   (nth 1 (window-edges window)))
 
 (defun gnus-remove-some-windows ()
-  (let ((buffers gnus-window-to-buffer)
+  (let ((buffers (gnus-buffers))
        buf bufs lowest-buf lowest)
     (save-excursion
       ;; Remove windows on all known Gnus buffers.
-      (while buffers
-       (and (setq buf (gnus-window-to-buffer-helper (cdar buffers)))
-            (get-buffer-window buf)
-            (progn
-              (push buf bufs)
-              (pop-to-buffer buf)
-              (when (or (not lowest)
-                        (< (gnus-window-top-edge) lowest))
-                (setq lowest (gnus-window-top-edge))
-                (setq lowest-buf buf))))
-       (setq buffers (cdr buffers)))
-      ;; Remove windows on *all* summary buffers.
-      (walk-windows
-       (lambda (win)
-        (let ((buf (window-buffer win)))
-          (when (string-match  "^\\*\\(Dead \\)?Summary" (buffer-name buf))
-            (push buf bufs)
-            (pop-to-buffer buf)
-            (when (or (not lowest)
-                      (< (gnus-window-top-edge) lowest))
-              (setq lowest-buf buf)
-              (setq lowest (gnus-window-top-edge)))))))
+      (while (setq buf (pop buffers))
+       (when (get-buffer-window buf)
+         (push buf bufs)
+         (pop-to-buffer buf)
+         (when (or (not lowest)
+                   (< (gnus-window-top-edge) lowest))
+           (setq lowest (gnus-window-top-edge)
+                 lowest-buf buf))))
       (when lowest-buf
        (pop-to-buffer lowest-buf)
        (switch-to-buffer nntp-server-buffer))
-      (while bufs
-       (when (not (eq (car bufs) lowest-buf))
-         (delete-windows-on (car bufs)))
-       (setq bufs (cdr bufs))))))
+      (mapcar (lambda (b) (delete-windows-on b t)) bufs))))
 
 (provide 'gnus-win)