annotate lisp/frame.el @ 486:80cdb2387043

Initial revision
author Jim Blandy <jimb@redhat.com>
date Mon, 13 Jan 1992 22:04:23 +0000
parents a24ab90a6983
children b99d4eb7ed93
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1 ;;;; Multi-screen management that is independent of window systems.
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2 ;;;; Copyright (C) 1990 Free Software Foundation, Inc.
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4 ;;; This file is part of GNU Emacs.
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5 ;;;
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6 ;;; GNU Emacs is free software; you can redistribute it and/or modify
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
7 ;;; it under the terms of the GNU General Public License as published by
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
8 ;;; the Free Software Foundation; either version 1, or (at your option)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
9 ;;; any later version.
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
10 ;;;
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
11 ;;; GNU Emacs is distributed in the hope that it will be useful,
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
12 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
14 ;;; GNU General Public License for more details.
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
15 ;;;
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
16 ;;; You should have received a copy of the GNU General Public License
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
17 ;;; along with GNU Emacs; see the file COPYING. If not, write to
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
18 ;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
19
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
20 (provide 'screen)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
21
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
22 (defvar screen-creation-function nil
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
23 "Window-system dependent function to call to create a new screen.
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
24 The window system startup file should set this to its screen creation
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
25 function, which should take an alist of parameters as its argument.")
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
26
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
27 ;;; The default value for this must ask for a minibuffer. There must
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
28 ;;; always exist a screen with a minibuffer, and after we delete the
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
29 ;;; terminal screen, this will be the only screen.
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
30 (defvar initial-screen-alist '((minibuffer . nil))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
31 "Alist of values used when creating the initial emacs text screen.
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
32 These may be set in your init file, like this:
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
33 (setq initial-screen-alist '((top . 1) (left . 1) (width . 80) (height . 55)))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
34 These supercede the values given in screen-default-alist.")
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
35
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
36 (defvar minibuffer-screen-alist nil
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
37 "Alist of values to apply to a minibuffer screen.
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
38 These may be set in your init file, like this:
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
39 (setq minibuffer-screen-alist
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
40 '((top . 1) (left . 1) (width . 80) (height . 1)))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
41 These supercede the values given in default-screen-alist.")
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
42
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
43 (defvar pop-up-screen-alist nil
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
44 "Alist of values used when creating pop-up screens.
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
45 Pop-up screens are used for completions, help, and the like.
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
46 This variable can be set in your init file, like this:
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
47 (setq pop-up-screen-alist '((width . 80) (height . 20)))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
48 These supercede the values given in default-screen-alist.")
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
49
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
50 (setq pop-up-screen-function
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
51 (function (lambda ()
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
52 (new-screen pop-up-screen-alist))))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
53
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
54
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
55 ;;;; Arrangement of screens at startup
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
56
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
57 ;;; 1) Load the window system startup file from the lisp library and read the
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
58 ;;; high-priority arguments (-q and the like). The window system startup
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
59 ;;; file should create any screens specified in the window system defaults.
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
60 ;;;
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
61 ;;; 2) If no screens have been opened, we open an initial text screen.
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
62 ;;;
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
63 ;;; 3) Once the init file is done, we apply any newly set parameters
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
64 ;;; in initial-screen-alist to the screen.
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
65
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
66 (add-hook 'pre-init-hook 'screen-initialize)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
67 (add-hook 'window-setup-hook 'screen-notice-user-settings)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
68
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
69 ;;; If we create the initial screen, this is it.
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
70 (defvar screen-initial-screen nil)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
71
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
72 ;;; startup.el calls this function before loading the user's init
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
73 ;;; file - if there is no screen with a minibuffer open now, create
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
74 ;;; one to display messages while loading the init file.
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
75 (defun screen-initialize ()
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
76
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
77 ;; Are we actually running under a window system at all?
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
78 (if (and window-system (not noninteractive))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
79 (let ((screens (screen-list)))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
80
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
81 ;; Look for a screen that has a minibuffer.
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
82 (while (and screens
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
83 (or (eq (car screens) terminal-screen)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
84 (not (cdr (assq 'minibuffer
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
85 (screen-parameters
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
86 (car screens)))))))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
87 (setq screens (cdr screens)))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
88
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
89 ;; If there was none, then we need to create the opening screen.
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
90 (or screens
428
a24ab90a6983 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 404
diff changeset
91 (setq default-minibuffer-screen
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
92 (setq screen-initial-screen
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
93 (new-screen initial-screen-alist))))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
94
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
95 ;; At this point, we know that we have a screen open, so we
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
96 ;; can delete the terminal screen.
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
97 (delete-screen terminal-screen)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
98 (setq terminal-screen nil))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
99
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
100 ;; No, we're not running a window system. Arrange to cause errors.
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
101 (setq screen-creation-function
404
f6c751f07c4a *** empty log message ***
Michael I. Bushnell <mib@gnu.org>
parents: 394
diff changeset
102 (function
f6c751f07c4a *** empty log message ***
Michael I. Bushnell <mib@gnu.org>
parents: 394
diff changeset
103 (lambda (parameters)
f6c751f07c4a *** empty log message ***
Michael I. Bushnell <mib@gnu.org>
parents: 394
diff changeset
104 (error
f6c751f07c4a *** empty log message ***
Michael I. Bushnell <mib@gnu.org>
parents: 394
diff changeset
105 "Can't create multiple screens without a window system."))))))
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
106
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
107 ;;; startup.el calls this function after loading the user's init file.
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
108 ;;; If we created a minibuffer before knowing if we had permission, we
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
109 ;;; need to see if it should go away or change. Create a text screen
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
110 ;;; here.
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
111 (defun screen-notice-user-settings ()
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
112 (if screen-initial-screen
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
113 (progn
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
114
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
115 ;; If the user wants a minibuffer-only screen, we'll have to
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
116 ;; make a new one; you can't remove or add a root window to/from
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
117 ;; an existing screen.
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
118 (if (eq (cdr (or (assq 'minibuffer initial-screen-alist)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
119 '(minibuffer . t)))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
120 'only)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
121 (progn
428
a24ab90a6983 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 404
diff changeset
122 (setq default-minibuffer-screen
a24ab90a6983 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 404
diff changeset
123 (new-screen
a24ab90a6983 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 404
diff changeset
124 (append initial-screen-alist
a24ab90a6983 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 404
diff changeset
125 (screen-parameters screen-initial-screen))))
394
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
126 (delete-screen screen-initial-screen))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
127 (modify-screen-parameters screen-initial-screen
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
128 initial-screen-alist))))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
129
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
130 ;; Make sure the initial screen can be GC'd if it is ever deleted.
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
131 (makunbound 'screen-initial-screen))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
132
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
133
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
134 ;;;; Creation of additional screens
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
135
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
136 ;;; Return some screen other than the current screen,
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
137 ;;; creating one if neccessary. Note that the minibuffer screen, if
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
138 ;;; separate, is not considered (see next-screen).
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
139 (defun get-screen ()
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
140 (let ((s (if (equal (next-screen (selected-screen)) (selected-screen))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
141 (new-screen)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
142 (next-screen (selected-screen)))))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
143 s))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
144
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
145 (defun next-multiscreen-window ()
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
146 "Select the next window, regardless of which screen it is on."
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
147 (interactive)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
148 (select-window (next-window (selected-window)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
149 (> (minibuffer-depth) 0)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
150 t)))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
151
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
152 (defun previous-multiscreen-window ()
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
153 "Select the previous window, regardless of which screen it is on."
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
154 (interactive)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
155 (select-window (previous-window (selected-window)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
156 (> (minibuffer-depth) 0)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
157 t)))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
158
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
159 (defun new-screen (&optional parameters)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
160 "Create a new screen, displaying the current buffer."
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
161 (interactive)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
162 (funcall screen-creation-function parameters))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
163
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
164
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
165 ;;;; Iconification
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
166
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
167 ;;; A possible enhancement for the below: if you iconify a surrogate
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
168 ;;; minibuffer screen, iconify all of its minibuffer's users too;
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
169 ;;; de-iconify them as a group. This will need to wait until screens
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
170 ;;; have mapping and unmapping hooks.
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
171
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
172 (defun iconify ()
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
173 "Iconify or deiconify the selected screen."
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
174 (interactive)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
175 (let ((screen (selected-screen)))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
176 (if (eq (screen-visible-p screen) t)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
177 (iconify-screen screen)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
178 (deiconify-screen screen))))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
179
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
180
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
181 ;;;; Convenience functions for dynamically changing screen parameters
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
182
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
183 (defun set-screen-height (h)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
184 (interactive "NHeight: ")
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
185 (let* ((screen (selected-screen))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
186 (width (cdr (assoc 'width (screen-parameters (selected-screen))))))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
187 (set-screen-size (selected-screen) width h)))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
188
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
189 (defun set-screen-width (w)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
190 (interactive "NWidth: ")
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
191 (let* ((screen (selected-screen))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
192 (height (cdr (assoc 'height (screen-parameters (selected-screen))))))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
193 (set-screen-size (selected-screen) w height)))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
194
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
195 (defun set-default-font (font-name)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
196 (interactive "sFont name: ")
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
197 (modify-screen-parameters (selected-screen)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
198 (list (cons 'font font-name))))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
199
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
200 (defun set-screen-background (color-name)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
201 (interactive "sColor: ")
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
202 (modify-screen-parameters (selected-screen)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
203 (list (cons 'background-color color-name))))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
204
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
205 (defun set-screen-foreground (color-name)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
206 (interactive "sColor: ")
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
207 (modify-screen-parameters (selected-screen)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
208 (list (cons 'foreground-color color-name))))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
209
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
210 (defun set-cursor-color (color-name)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
211 (interactive "sColor: ")
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
212 (modify-screen-parameters (selected-screen)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
213 (list (cons 'cursor-color color-name))))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
214
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
215 (defun set-pointer-color (color-name)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
216 (interactive "sColor: ")
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
217 (modify-screen-parameters (selected-screen)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
218 (list (cons 'mouse-color color-name))))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
219
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
220 (defun set-auto-raise (toggle)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
221 (interactive "xt or nil? ")
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
222 (modify-screen-parameters (selected-screen)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
223 (list (cons 'auto-raise toggle))))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
224
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
225 (defun set-auto-lower (toggle)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
226 (interactive "xt or nil? ")
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
227 (modify-screen-parameters (selected-screen)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
228 (list (cons 'auto-lower toggle))))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
229
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
230 (defun set-vertical-bar (toggle)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
231 (interactive "xt or nil? ")
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
232 (modify-screen-parameters (selected-screen)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
233 (list (cons 'vertical-scroll-bar toggle))))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
234
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
235 (defun set-horizontal-bar (toggle)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
236 (interactive "xt or nil? ")
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
237 (modify-screen-parameters (selected-screen)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
238 (list (cons 'horizontal-scroll-bar toggle))))
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
239
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
240 ;;;; Key bindings
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
241 (define-prefix-command 'ctl-x-3-map)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
242 (define-key ctl-x-map "3" 'ctl-x-3-map)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
243
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
244 (define-key global-map "\C-z" 'iconify)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
245 (define-key ctl-x-3-map "2" 'new-screen)
5bd386d1a1cc Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
246 (define-key ctl-x-3-map "0" 'delete-screen)