comparison lisp/gnus/gnus-win.el @ 56927:55fd4f77387a after-merge-gnus-5_10

Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523 Merge from emacs--gnus--5.10, gnus--rel--5.10 Patches applied: * miles@gnu.org--gnu-2004/emacs--gnus--5.10--base-0 tag of miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-464 * miles@gnu.org--gnu-2004/emacs--gnus--5.10--patch-1 Import from CVS branch gnus-5_10-branch * miles@gnu.org--gnu-2004/emacs--gnus--5.10--patch-2 Merge from lorentey@elte.hu--2004/emacs--multi-tty--0, emacs--cvs-trunk--0 * miles@gnu.org--gnu-2004/emacs--gnus--5.10--patch-3 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--gnus--5.10--patch-4 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-18 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-19 Remove autoconf-generated files from archive * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-20 Update from CVS
author Miles Bader <miles@gnu.org>
date Sat, 04 Sep 2004 13:13:48 +0000
parents 00a30fe7897a
children df80d19d7a2e cce1c0ee76ee
comparison
equal deleted inserted replaced
56926:f8e248e9a717 56927:55fd4f77387a
1 ;;; gnus-win.el --- window configuration functions for Gnus 1 ;;; gnus-win.el --- window configuration functions for Gnus
2 ;; Copyright (C) 1996, 97, 98, 1999, 2000, 02, 2004 2 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
3 ;; Free Software Foundation, Inc. 3 ;; Free Software Foundation, Inc.
4 4
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> 5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
6 ;; Keywords: news 6 ;; Keywords: news
7 7
27 ;;; Code: 27 ;;; Code:
28 28
29 (eval-when-compile (require 'cl)) 29 (eval-when-compile (require 'cl))
30 30
31 (require 'gnus) 31 (require 'gnus)
32 (require 'gnus-util)
32 33
33 (defgroup gnus-windows nil 34 (defgroup gnus-windows nil
34 "Window configuration." 35 "Window configuration."
35 :group 'gnus) 36 :group 'gnus)
36 37
55 (defcustom gnus-always-force-window-configuration nil 56 (defcustom gnus-always-force-window-configuration nil
56 "*If non-nil, always force the Gnus window configurations." 57 "*If non-nil, always force the Gnus window configurations."
57 :group 'gnus-windows 58 :group 'gnus-windows
58 :type 'boolean) 59 :type 'boolean)
59 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
60 (defvar gnus-buffer-configuration 68 (defvar gnus-buffer-configuration
61 '((group 69 '((group
62 (vertical 1.0 70 (vertical 1.0
63 (group 1.0 point) 71 (group 1.0 point)
64 (if gnus-carpal '(group-carpal 4)))) 72 (if gnus-carpal '(group-carpal 4))))
66 (vertical 1.0 74 (vertical 1.0
67 (summary 1.0 point) 75 (summary 1.0 point)
68 (if gnus-carpal '(summary-carpal 4)))) 76 (if gnus-carpal '(summary-carpal 4))))
69 (article 77 (article
70 (cond 78 (cond
71 ((and gnus-use-picons
72 (eq gnus-picons-display-where 'picons))
73 '(frame 1.0
74 (vertical 1.0
75 (summary 0.25 point)
76 (if gnus-carpal '(summary-carpal 4))
77 (article 1.0))
78 (vertical ((height . 5) (width . 15)
79 (user-position . t)
80 (left . -1) (top . 1))
81 (picons 1.0))))
82 (gnus-use-trees 79 (gnus-use-trees
83 '(vertical 1.0 80 '(vertical 1.0
84 (summary 0.25 point) 81 (summary 0.25 point)
85 (tree 0.25) 82 (tree 0.25)
86 (article 1.0))) 83 (article 1.0)))
124 (post 121 (post
125 (vertical 1.0 122 (vertical 1.0
126 (post 1.0 point))) 123 (post 1.0 point)))
127 (reply 124 (reply
128 (vertical 1.0 125 (vertical 1.0
129 (article-copy 0.5) 126 (article 0.5)
130 (message 1.0 point))) 127 (message 1.0 point)))
131 (forward 128 (forward
132 (vertical 1.0 129 (vertical 1.0
133 (message 1.0 point))) 130 (message 1.0 point)))
134 (reply-yank 131 (reply-yank
163 (vertical 1.0 160 (vertical 1.0
164 (category 1.0))) 161 (category 1.0)))
165 (compose-bounce 162 (compose-bounce
166 (vertical 1.0 163 (vertical 1.0
167 (article 0.5) 164 (article 0.5)
168 (message 1.0 point)))) 165 (message 1.0 point)))
166 (display-term
167 (vertical 1.0
168 ("*display*" 1.0))))
169 "Window configuration for all possible Gnus buffers. 169 "Window configuration for all possible Gnus buffers.
170 See the Gnus manual for an explanation of the syntax used.") 170 See the Gnus manual for an explanation of the syntax used.")
171 171
172 (defvar gnus-window-to-buffer 172 (defvar gnus-window-to-buffer
173 '((group . gnus-group-buffer) 173 '((group . gnus-group-buffer)
185 (edit-score . gnus-score-edit-buffer) 185 (edit-score . gnus-score-edit-buffer)
186 (message . gnus-message-buffer) 186 (message . gnus-message-buffer)
187 (mail . gnus-message-buffer) 187 (mail . gnus-message-buffer)
188 (post-news . gnus-message-buffer) 188 (post-news . gnus-message-buffer)
189 (faq . gnus-faq-buffer) 189 (faq . gnus-faq-buffer)
190 (picons . gnus-picons-buffer-name)
191 (tree . gnus-tree-buffer) 190 (tree . gnus-tree-buffer)
192 (score-trace . "*Score Trace*") 191 (score-trace . "*Score Trace*")
193 (split-trace . "*Split Trace*") 192 (split-trace . "*Split Trace*")
194 (info . gnus-info-buffer) 193 (info . gnus-info-buffer)
195 (category . gnus-category-buffer) 194 (category . gnus-category-buffer)
196 (article-copy . gnus-article-copy) 195 (article-copy . gnus-article-copy)
197 (draft . gnus-draft-buffer)) 196 (draft . gnus-draft-buffer))
198 "Mapping from short symbols to buffer names or buffer variables.") 197 "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)
199 203
200 ;;; Internal variables. 204 ;;; Internal variables.
201 205
202 (defvar gnus-current-window-configuration nil 206 (defvar gnus-current-window-configuration nil
203 "The most recently set window configuration.") 207 "The most recently set window configuration.")
299 (push 1.0 split) 303 (push 1.0 split)
300 (push 'vertical split)) 304 (push 'vertical split))
301 ;; The SPLIT might be something that is to be evaled to 305 ;; The SPLIT might be something that is to be evaled to
302 ;; return a new SPLIT. 306 ;; return a new SPLIT.
303 (while (and (not (assq (car split) gnus-window-to-buffer)) 307 (while (and (not (assq (car split) gnus-window-to-buffer))
304 (gnus-functionp (car split))) 308 (functionp (car split)))
305 (setq split (eval split))) 309 (setq split (eval split)))
306 (let* ((type (car split)) 310 (let* ((type (car split))
307 (subs (cddr split)) 311 (subs (cddr split))
308 (len (if (eq type 'horizontal) (window-width) (window-height))) 312 (len (if (eq type 'horizontal) (window-width) (window-height)))
309 (total 0) 313 (total 0)
362 (when (> (length subs) 0) 366 (when (> (length subs) 0)
363 ;; First we have to compute the sizes of all new windows. 367 ;; First we have to compute the sizes of all new windows.
364 (while subs 368 (while subs
365 (setq sub (append (pop subs) nil)) 369 (setq sub (append (pop subs) nil))
366 (while (and (not (assq (car sub) gnus-window-to-buffer)) 370 (while (and (not (assq (car sub) gnus-window-to-buffer))
367 (gnus-functionp (car sub))) 371 (functionp (car sub)))
368 (setq sub (eval sub))) 372 (setq sub (eval sub)))
369 (when sub 373 (when sub
370 (push sub comp-subs) 374 (push sub comp-subs)
371 (setq size (cadar comp-subs)) 375 (setq size (cadar comp-subs))
372 (cond ((equal size 1.0) 376 (cond ((equal size 1.0)
445 ;; We want to remove all other windows. 449 ;; We want to remove all other windows.
446 (if (not gnus-frame-split-p) 450 (if (not gnus-frame-split-p)
447 ;; This is not a `frame' split, so we ignore the 451 ;; This is not a `frame' split, so we ignore the
448 ;; other frames. 452 ;; other frames.
449 (delete-other-windows) 453 (delete-other-windows)
450 ;; This is a `frame' split, so we delete all windows 454 ;; This is a `frame' split, so we delete all windows
451 ;; on all frames. 455 ;; on all frames.
452 (gnus-delete-windows-in-gnusey-frames)) 456 (gnus-delete-windows-in-gnusey-frames))
453 ;; Just remove some windows. 457 ;; Just remove some windows.
454 (gnus-remove-some-windows) 458 (gnus-remove-some-windows)
455 (if (featurep 'xemacs) 459 (if (featurep 'xemacs)
460 (let (gnus-window-frame-focus) 464 (let (gnus-window-frame-focus)
461 (if (featurep 'xemacs) 465 (if (featurep 'xemacs)
462 (switch-to-buffer nntp-server-buffer) 466 (switch-to-buffer nntp-server-buffer)
463 (set-buffer nntp-server-buffer)) 467 (set-buffer nntp-server-buffer))
464 (gnus-configure-frame split) 468 (gnus-configure-frame split)
469 (run-hooks 'gnus-configure-windows-hook)
465 (when gnus-window-frame-focus 470 (when gnus-window-frame-focus
466 (select-frame (window-frame gnus-window-frame-focus)))))))) 471 (select-frame (window-frame gnus-window-frame-focus))))))))
467 472
468 (defun gnus-delete-windows-in-gnusey-frames () 473 (defun gnus-delete-windows-in-gnusey-frames ()
469 "Do a `delete-other-windows' in all frames that have Gnus windows." 474 "Do a `delete-other-windows' in all frames that have Gnus windows."
500 (push 1.0 split) 505 (push 1.0 split)
501 (push 'vertical split)) 506 (push 'vertical split))
502 ;; The SPLIT might be something that is to be evaled to 507 ;; The SPLIT might be something that is to be evaled to
503 ;; return a new SPLIT. 508 ;; return a new SPLIT.
504 (while (and (not (assq (car split) gnus-window-to-buffer)) 509 (while (and (not (assq (car split) gnus-window-to-buffer))
505 (gnus-functionp (car split))) 510 (functionp (car split)))
506 (setq split (eval split))) 511 (setq split (eval split)))
507 512
508 (setq type (elt split 0)) 513 (setq type (elt split 0))
509 (cond 514 (cond
510 ;; Nothing here. 515 ;; Nothing here.
514 (setq buffer (cond ((stringp type) type) 519 (setq buffer (cond ((stringp type) type)
515 (t (cdr (assq type gnus-window-to-buffer))))) 520 (t (cdr (assq type gnus-window-to-buffer)))))
516 (unless buffer 521 (unless buffer
517 (error "Invalid buffer type: %s" type)) 522 (error "Invalid buffer type: %s" type))
518 (if (and (setq buf (get-buffer (gnus-window-to-buffer-helper buffer))) 523 (if (and (setq buf (get-buffer (gnus-window-to-buffer-helper buffer)))
519 (setq win (get-buffer-window buf 0))) 524 (setq win (gnus-get-buffer-window buf t)))
520 (if (memq 'point split) 525 (if (memq 'point split)
521 (setq all-visible win)) 526 (setq all-visible win))
522 (setq all-visible nil))) 527 (setq all-visible nil)))
523 (t 528 (t
524 (when (eq type 'frame) 529 (when (eq type 'frame)
546 (when lowest-buf 551 (when lowest-buf
547 (pop-to-buffer lowest-buf) 552 (pop-to-buffer lowest-buf)
548 (if (featurep 'xemacs) 553 (if (featurep 'xemacs)
549 (switch-to-buffer nntp-server-buffer) 554 (switch-to-buffer nntp-server-buffer)
550 (set-buffer nntp-server-buffer))) 555 (set-buffer nntp-server-buffer)))
551 (mapcar (lambda (b) (delete-windows-on b t)) bufs)))) 556 (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))))
552 579
553 (provide 'gnus-win) 580 (provide 'gnus-win)
554 581
555 ;;; arch-tag: ccd5a394-2ddf-4397-b8f8-6d80d3e46e2b 582 ;;; arch-tag: ccd5a394-2ddf-4397-b8f8-6d80d3e46e2b
556 ;;; gnus-win.el ends here 583 ;;; gnus-win.el ends here