;;; 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)))
(mail . gnus-message-buffer)
(post-news . gnus-message-buffer)
(faq . gnus-faq-buffer)
- (picons . "*Picons*")
+ (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)
"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."
(defvar gnus-frame-list nil)
+(defun gnus-window-to-buffer-helper (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."
(unless window
;; This is a buffer to be selected.
((not (memq type '(frame horizontal vertical)))
(let ((buffer (cond ((stringp type) type)
- (t (cdr (assq type gnus-window-to-buffer)))))
- buf)
+ (t (cdr (assq type gnus-window-to-buffer))))))
(unless buffer
(error "Illegal buffer type: %s" type))
- (unless (setq buf (get-buffer (if (symbolp buffer)
- (symbol-value buffer) buffer)))
- (setq buf (get-buffer-create (if (symbolp buffer)
- (symbol-value buffer) buffer))))
- (switch-to-buffer buf)
+ (switch-to-buffer (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.
(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)
- (if (symbolp (cdr elem))
- (when (and (boundp (cdr elem))
- (symbol-value (cdr elem)))
- (get-buffer (symbol-value (cdr elem))))
- (when (cdr elem)
- (get-buffer (cdr elem)))))
+ (let ((buf (gnus-window-to-buffer-helper (cdr elem))))
+ (if (not (null buf))
+ (get-buffer buf))))
gnus-window-to-buffer)))
(mapcar
(lambda (frame)
(t (cdr (assq type gnus-window-to-buffer)))))
(unless buffer
(error "Illegal buffer type: %s" type))
- (when (setq buf (get-buffer (if (symbolp buffer)
- (symbol-value buffer)
- buffer)))
- (setq win (get-buffer-window buf t)))
- (if win
- (when (memq 'point split)
+ (if (and (setq buf (get-buffer (gnus-window-to-buffer-helper buffer)))
+ (setq win (get-buffer-window buf t)))
+ (if (memq 'point split)
(setq all-visible win))
(setq all-visible nil)))
(t
(save-excursion
;; Remove windows on all known Gnus buffers.
(while buffers
- (setq buf (cdar buffers))
- (when (symbolp buf)
- (setq buf (and (boundp buf) (symbol-value buf))))
- (and buf
+ (and (setq buf (gnus-window-to-buffer-helper (cdar buffers)))
(get-buffer-window buf)
(progn
(push buf bufs)