1 |
;;; gnus-win.el --- window configuration functions for Gnus |
;;; gnus-win.el --- window configuration functions for Gnus |
2 |
;; Copyright (C) 1996, 97, 98, 1999, 2000, 02, 2004 |
;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 |
3 |
;; Free Software Foundation, Inc. |
;; Free Software Foundation, Inc. |
4 |
|
|
5 |
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> |
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> |
29 |
(eval-when-compile (require 'cl)) |
(eval-when-compile (require 'cl)) |
30 |
|
|
31 |
(require 'gnus) |
(require 'gnus) |
32 |
|
(require 'gnus-util) |
33 |
|
|
34 |
(defgroup gnus-windows nil |
(defgroup gnus-windows nil |
35 |
"Window configuration." |
"Window configuration." |
58 |
:group 'gnus-windows |
:group 'gnus-windows |
59 |
:type 'boolean) |
:type 'boolean) |
60 |
|
|
61 |
|
(defcustom gnus-use-frames-on-any-display nil |
62 |
|
"*If non-nil, frames on all displays will be considered useable by Gnus. |
63 |
|
When nil, only frames on the same display as the selected frame will be |
64 |
|
used to display Gnus windows." |
65 |
|
:group 'gnus-windows |
66 |
|
:type 'boolean) |
67 |
|
|
68 |
(defvar gnus-buffer-configuration |
(defvar gnus-buffer-configuration |
69 |
'((group |
'((group |
70 |
(vertical 1.0 |
(vertical 1.0 |
76 |
(if gnus-carpal '(summary-carpal 4)))) |
(if gnus-carpal '(summary-carpal 4)))) |
77 |
(article |
(article |
78 |
(cond |
(cond |
|
((and gnus-use-picons |
|
|
(eq gnus-picons-display-where 'picons)) |
|
|
'(frame 1.0 |
|
|
(vertical 1.0 |
|
|
(summary 0.25 point) |
|
|
(if gnus-carpal '(summary-carpal 4)) |
|
|
(article 1.0)) |
|
|
(vertical ((height . 5) (width . 15) |
|
|
(user-position . t) |
|
|
(left . -1) (top . 1)) |
|
|
(picons 1.0)))) |
|
79 |
(gnus-use-trees |
(gnus-use-trees |
80 |
'(vertical 1.0 |
'(vertical 1.0 |
81 |
(summary 0.25 point) |
(summary 0.25 point) |
123 |
(post 1.0 point))) |
(post 1.0 point))) |
124 |
(reply |
(reply |
125 |
(vertical 1.0 |
(vertical 1.0 |
126 |
(article-copy 0.5) |
(article 0.5) |
127 |
(message 1.0 point))) |
(message 1.0 point))) |
128 |
(forward |
(forward |
129 |
(vertical 1.0 |
(vertical 1.0 |
162 |
(compose-bounce |
(compose-bounce |
163 |
(vertical 1.0 |
(vertical 1.0 |
164 |
(article 0.5) |
(article 0.5) |
165 |
(message 1.0 point)))) |
(message 1.0 point))) |
166 |
|
(display-term |
167 |
|
(vertical 1.0 |
168 |
|
("*display*" 1.0)))) |
169 |
"Window configuration for all possible Gnus buffers. |
"Window configuration for all possible Gnus buffers. |
170 |
See the Gnus manual for an explanation of the syntax used.") |
See the Gnus manual for an explanation of the syntax used.") |
171 |
|
|
187 |
(mail . gnus-message-buffer) |
(mail . gnus-message-buffer) |
188 |
(post-news . gnus-message-buffer) |
(post-news . gnus-message-buffer) |
189 |
(faq . gnus-faq-buffer) |
(faq . gnus-faq-buffer) |
|
(picons . gnus-picons-buffer-name) |
|
190 |
(tree . gnus-tree-buffer) |
(tree . gnus-tree-buffer) |
191 |
(score-trace . "*Score Trace*") |
(score-trace . "*Score Trace*") |
192 |
(split-trace . "*Split Trace*") |
(split-trace . "*Split Trace*") |
196 |
(draft . gnus-draft-buffer)) |
(draft . gnus-draft-buffer)) |
197 |
"Mapping from short symbols to buffer names or buffer variables.") |
"Mapping from short symbols to buffer names or buffer variables.") |
198 |
|
|
199 |
|
(defcustom gnus-configure-windows-hook nil |
200 |
|
"*A hook called when configuring windows." |
201 |
|
:group 'gnus-windows |
202 |
|
:type 'hook) |
203 |
|
|
204 |
;;; Internal variables. |
;;; Internal variables. |
205 |
|
|
206 |
(defvar gnus-current-window-configuration nil |
(defvar gnus-current-window-configuration nil |
305 |
;; The SPLIT might be something that is to be evaled to |
;; The SPLIT might be something that is to be evaled to |
306 |
;; return a new SPLIT. |
;; return a new SPLIT. |
307 |
(while (and (not (assq (car split) gnus-window-to-buffer)) |
(while (and (not (assq (car split) gnus-window-to-buffer)) |
308 |
(gnus-functionp (car split))) |
(functionp (car split))) |
309 |
(setq split (eval split))) |
(setq split (eval split))) |
310 |
(let* ((type (car split)) |
(let* ((type (car split)) |
311 |
(subs (cddr split)) |
(subs (cddr split)) |
368 |
(while subs |
(while subs |
369 |
(setq sub (append (pop subs) nil)) |
(setq sub (append (pop subs) nil)) |
370 |
(while (and (not (assq (car sub) gnus-window-to-buffer)) |
(while (and (not (assq (car sub) gnus-window-to-buffer)) |
371 |
(gnus-functionp (car sub))) |
(functionp (car sub))) |
372 |
(setq sub (eval sub))) |
(setq sub (eval sub))) |
373 |
(when sub |
(when sub |
374 |
(push sub comp-subs) |
(push sub comp-subs) |
451 |
;; This is not a `frame' split, so we ignore the |
;; This is not a `frame' split, so we ignore the |
452 |
;; other frames. |
;; other frames. |
453 |
(delete-other-windows) |
(delete-other-windows) |
454 |
;; This is a `frame' split, so we delete all windows |
;; This is a `frame' split, so we delete all windows |
455 |
;; on all frames. |
;; on all frames. |
456 |
(gnus-delete-windows-in-gnusey-frames)) |
(gnus-delete-windows-in-gnusey-frames)) |
457 |
;; Just remove some windows. |
;; Just remove some windows. |
466 |
(switch-to-buffer nntp-server-buffer) |
(switch-to-buffer nntp-server-buffer) |
467 |
(set-buffer nntp-server-buffer)) |
(set-buffer nntp-server-buffer)) |
468 |
(gnus-configure-frame split) |
(gnus-configure-frame split) |
469 |
|
(run-hooks 'gnus-configure-windows-hook) |
470 |
(when gnus-window-frame-focus |
(when gnus-window-frame-focus |
471 |
(select-frame (window-frame gnus-window-frame-focus)))))))) |
(select-frame (window-frame gnus-window-frame-focus)))))))) |
472 |
|
|
507 |
;; The SPLIT might be something that is to be evaled to |
;; The SPLIT might be something that is to be evaled to |
508 |
;; return a new SPLIT. |
;; return a new SPLIT. |
509 |
(while (and (not (assq (car split) gnus-window-to-buffer)) |
(while (and (not (assq (car split) gnus-window-to-buffer)) |
510 |
(gnus-functionp (car split))) |
(functionp (car split))) |
511 |
(setq split (eval split))) |
(setq split (eval split))) |
512 |
|
|
513 |
(setq type (elt split 0)) |
(setq type (elt split 0)) |
521 |
(unless buffer |
(unless buffer |
522 |
(error "Invalid buffer type: %s" type)) |
(error "Invalid buffer type: %s" type)) |
523 |
(if (and (setq buf (get-buffer (gnus-window-to-buffer-helper buffer))) |
(if (and (setq buf (get-buffer (gnus-window-to-buffer-helper buffer))) |
524 |
(setq win (get-buffer-window buf 0))) |
(setq win (gnus-get-buffer-window buf t))) |
525 |
(if (memq 'point split) |
(if (memq 'point split) |
526 |
(setq all-visible win)) |
(setq all-visible win)) |
527 |
(setq all-visible nil))) |
(setq all-visible nil))) |
553 |
(if (featurep 'xemacs) |
(if (featurep 'xemacs) |
554 |
(switch-to-buffer nntp-server-buffer) |
(switch-to-buffer nntp-server-buffer) |
555 |
(set-buffer nntp-server-buffer))) |
(set-buffer nntp-server-buffer))) |
556 |
(mapcar (lambda (b) (delete-windows-on b t)) bufs)))) |
(mapcar (lambda (b) (delete-windows-on b t)) |
557 |
|
(delq lowest-buf bufs))))) |
558 |
|
|
559 |
|
(eval-and-compile |
560 |
|
(cond |
561 |
|
((fboundp 'frames-on-display-list) |
562 |
|
(defalias 'gnus-frames-on-display-list 'frames-on-display-list)) |
563 |
|
((and (featurep 'xemacs) (fboundp 'frame-device)) |
564 |
|
(defun gnus-frames-on-display-list () |
565 |
|
(apply 'filtered-frame-list 'identity (list (frame-device nil))))) |
566 |
|
(t |
567 |
|
(defalias 'gnus-frames-on-display-list 'frame-list)))) |
568 |
|
|
569 |
|
(defun gnus-get-buffer-window (buffer &optional frame) |
570 |
|
(cond ((and (null gnus-use-frames-on-any-display) |
571 |
|
(memq frame '(t 0 visible))) |
572 |
|
(car |
573 |
|
(let ((frames (gnus-frames-on-display-list))) |
574 |
|
(gnus-remove-if (lambda (win) (not (memq (window-frame win) |
575 |
|
frames))) |
576 |
|
(get-buffer-window-list buffer nil frame))))) |
577 |
|
(t |
578 |
|
(get-buffer-window buffer frame)))) |
579 |
|
|
580 |
(provide 'gnus-win) |
(provide 'gnus-win) |
581 |
|
|