Mercurial > emacs
annotate lisp/frame.el @ 3832:ea6739f778a5
(rmail-output): Check file can be read before trying to read part of it.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 19 Jun 1993 01:23:59 +0000 |
parents | d965878f294f |
children | dcf86f82f2c8 |
rev | line source |
---|---|
777 | 1 ;;; frame.el --- multi-frame management independent of window systems. |
658
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
584
diff
changeset
|
2 |
2069 | 3 ;;;; Copyright (C) 1993 Free Software Foundation, Inc. |
846
20674ae6bf52
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
827
diff
changeset
|
4 |
793
6fb68a1460a6
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
777
diff
changeset
|
5 ;; Maintainer: FSF |
811
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
806
diff
changeset
|
6 ;; Keywords: internal |
793
6fb68a1460a6
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
777
diff
changeset
|
7 |
394 | 8 ;;; This file is part of GNU Emacs. |
9 ;;; | |
10 ;;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;;; it under the terms of the GNU General Public License as published by | |
806 | 12 ;;; the Free Software Foundation; either version 2, or (at your option) |
394 | 13 ;;; any later version. |
14 ;;; | |
15 ;;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;;; GNU General Public License for more details. | |
19 ;;; | |
20 ;;; You should have received a copy of the GNU General Public License | |
21 ;;; along with GNU Emacs; see the file COPYING. If not, write to | |
22 ;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
23 | |
793
6fb68a1460a6
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
777
diff
changeset
|
24 ;;; Code: |
6fb68a1460a6
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
777
diff
changeset
|
25 |
777 | 26 (defvar frame-creation-function nil |
27 "Window-system dependent function to call to create a new frame. | |
28 The window system startup file should set this to its frame creation | |
394 | 29 function, which should take an alist of parameters as its argument.") |
30 | |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
31 ;;; The initial value given here for this must ask for a minibuffer. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
32 ;;; There must always exist a frame with a minibuffer, and after we |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
33 ;;; delete the terminal frame, this will be the only frame. |
958 | 34 (defvar initial-frame-alist '((minibuffer . t)) |
1974
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
35 "Alist of frame parameters for creating the initial X window frame. |
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
36 You can set this in your `.emacs' file; for example, |
777 | 37 (setq initial-frame-alist '((top . 1) (left . 1) (width . 80) (height . 55))) |
1974
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
38 If the value calls for a frame without a minibuffer, and you do not create a |
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
39 minibuffer frame on your own, one is created according to |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
40 `minibuffer-frame-alist'. |
1974
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
41 Parameters specified here supersede the values given in |
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
42 `default-frame-alist'.") |
394 | 43 |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
44 (defvar minibuffer-frame-alist '((width . 80) (height . 2)) |
1974
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
45 "Alist of frame parameters for initially creating a minibuffer frame. |
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
46 You can set this in your `.emacs' file; for example, |
777 | 47 (setq minibuffer-frame-alist |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
48 '((top . 1) (left . 1) (width . 80) (height . 2))) |
1974
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
49 Parameters specified here supersede the values given in |
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
50 `default-frame-alist'.") |
394 | 51 |
777 | 52 (defvar pop-up-frame-alist nil |
1974
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
53 "Alist of frame parameters used when creating pop-up frames. |
777 | 54 Pop-up frames are used for completions, help, and the like. |
394 | 55 This variable can be set in your init file, like this: |
777 | 56 (setq pop-up-frame-alist '((width . 80) (height . 20))) |
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
3554
diff
changeset
|
57 These supersede the values given in `default-frame-alist'.") |
394 | 58 |
777 | 59 (setq pop-up-frame-function |
394 | 60 (function (lambda () |
777 | 61 (new-frame pop-up-frame-alist)))) |
394 | 62 |
63 | |
777 | 64 ;;;; Arrangement of frames at startup |
394 | 65 |
66 ;;; 1) Load the window system startup file from the lisp library and read the | |
67 ;;; high-priority arguments (-q and the like). The window system startup | |
777 | 68 ;;; file should create any frames specified in the window system defaults. |
394 | 69 ;;; |
777 | 70 ;;; 2) If no frames have been opened, we open an initial text frame. |
394 | 71 ;;; |
72 ;;; 3) Once the init file is done, we apply any newly set parameters | |
777 | 73 ;;; in initial-frame-alist to the frame. |
394 | 74 |
2763
a93e407bf41c
Don't put frame-initialize and frame-notice-user-settings on hooks.
Richard M. Stallman <rms@gnu.org>
parents:
2571
diff
changeset
|
75 ;; These are now called explicitly at the proper times, |
a93e407bf41c
Don't put frame-initialize and frame-notice-user-settings on hooks.
Richard M. Stallman <rms@gnu.org>
parents:
2571
diff
changeset
|
76 ;; since that is easier to understand. |
a93e407bf41c
Don't put frame-initialize and frame-notice-user-settings on hooks.
Richard M. Stallman <rms@gnu.org>
parents:
2571
diff
changeset
|
77 ;; Actually using hooks within Emacs is bad for future maintenance. --rms. |
a93e407bf41c
Don't put frame-initialize and frame-notice-user-settings on hooks.
Richard M. Stallman <rms@gnu.org>
parents:
2571
diff
changeset
|
78 ;; (add-hook 'before-init-hook 'frame-initialize) |
a93e407bf41c
Don't put frame-initialize and frame-notice-user-settings on hooks.
Richard M. Stallman <rms@gnu.org>
parents:
2571
diff
changeset
|
79 ;; (add-hook 'window-setup-hook 'frame-notice-user-settings) |
394 | 80 |
777 | 81 ;;; If we create the initial frame, this is it. |
82 (defvar frame-initial-frame nil) | |
394 | 83 |
84 ;;; startup.el calls this function before loading the user's init | |
777 | 85 ;;; file - if there is no frame with a minibuffer open now, create |
394 | 86 ;;; one to display messages while loading the init file. |
777 | 87 (defun frame-initialize () |
394 | 88 |
89 ;; Are we actually running under a window system at all? | |
90 (if (and window-system (not noninteractive)) | |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
91 (progn |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
92 ;; If there is no frame with a minibuffer besides the terminal |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
93 ;; frame, then we need to create the opening frame. Make sure |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
94 ;; it has a minibuffer, but let initial-frame-alist omit the |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
95 ;; minibuffer spec. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
96 (or (delq terminal-frame (minibuffer-frame-list)) |
3050
8e2472cd4409
(frame-initialize): Handle `reverse' as parameter.
Richard M. Stallman <rms@gnu.org>
parents:
2870
diff
changeset
|
97 (progn |
8e2472cd4409
(frame-initialize): Handle `reverse' as parameter.
Richard M. Stallman <rms@gnu.org>
parents:
2870
diff
changeset
|
98 (setq default-minibuffer-frame |
8e2472cd4409
(frame-initialize): Handle `reverse' as parameter.
Richard M. Stallman <rms@gnu.org>
parents:
2870
diff
changeset
|
99 (setq frame-initial-frame |
8e2472cd4409
(frame-initialize): Handle `reverse' as parameter.
Richard M. Stallman <rms@gnu.org>
parents:
2870
diff
changeset
|
100 (new-frame initial-frame-alist))) |
3433
2f5a9b79edf7
(frame-initialize): Delete geometry parms from initial-frame-alist.
Richard M. Stallman <rms@gnu.org>
parents:
3183
diff
changeset
|
101 ;; Delete any specifications for window geometry parameters |
2f5a9b79edf7
(frame-initialize): Delete geometry parms from initial-frame-alist.
Richard M. Stallman <rms@gnu.org>
parents:
3183
diff
changeset
|
102 ;; so that we won't reapply them in frame-notice-user-settings. |
2f5a9b79edf7
(frame-initialize): Delete geometry parms from initial-frame-alist.
Richard M. Stallman <rms@gnu.org>
parents:
3183
diff
changeset
|
103 ;; It would be wrong to reapply them then, |
2f5a9b79edf7
(frame-initialize): Delete geometry parms from initial-frame-alist.
Richard M. Stallman <rms@gnu.org>
parents:
3183
diff
changeset
|
104 ;; because that would override explicit user resizing. |
3616
05cf1ccf2ada
* frame.el (frame-initialize): When deleting geometry
Jim Blandy <jimb@redhat.com>
parents:
3591
diff
changeset
|
105 ;; Remember that they may occur more than once. |
05cf1ccf2ada
* frame.el (frame-initialize): When deleting geometry
Jim Blandy <jimb@redhat.com>
parents:
3591
diff
changeset
|
106 (let ((tail initial-frame-alist)) |
05cf1ccf2ada
* frame.el (frame-initialize): When deleting geometry
Jim Blandy <jimb@redhat.com>
parents:
3591
diff
changeset
|
107 (while (consp tail) |
05cf1ccf2ada
* frame.el (frame-initialize): When deleting geometry
Jim Blandy <jimb@redhat.com>
parents:
3591
diff
changeset
|
108 (if (and (consp (car tail)) |
05cf1ccf2ada
* frame.el (frame-initialize): When deleting geometry
Jim Blandy <jimb@redhat.com>
parents:
3591
diff
changeset
|
109 (memq (car (car tail)) '(height width top left))) |
05cf1ccf2ada
* frame.el (frame-initialize): When deleting geometry
Jim Blandy <jimb@redhat.com>
parents:
3591
diff
changeset
|
110 (setq initial-frame-alist |
3647
cf5972f69f8a
* frame.el (frame-initialize): Remember to actually traverse
Jim Blandy <jimb@redhat.com>
parents:
3617
diff
changeset
|
111 (delq tail initial-frame-alist))) |
cf5972f69f8a
* frame.el (frame-initialize): Remember to actually traverse
Jim Blandy <jimb@redhat.com>
parents:
3617
diff
changeset
|
112 (setq tail (cdr tail)))) |
3050
8e2472cd4409
(frame-initialize): Handle `reverse' as parameter.
Richard M. Stallman <rms@gnu.org>
parents:
2870
diff
changeset
|
113 ;; Handle `reverse' as a parameter. |
8e2472cd4409
(frame-initialize): Handle `reverse' as parameter.
Richard M. Stallman <rms@gnu.org>
parents:
2870
diff
changeset
|
114 (if (cdr (or (assq 'reverse initial-frame-alist) |
3183
c7ae5e66a98c
(frame-initialize): Handle reverseVideo resource.
Richard M. Stallman <rms@gnu.org>
parents:
3050
diff
changeset
|
115 (assq 'reverse default-frame-alist) |
c7ae5e66a98c
(frame-initialize): Handle reverseVideo resource.
Richard M. Stallman <rms@gnu.org>
parents:
3050
diff
changeset
|
116 (cons nil |
3554
de3a70b61bbe
(frame-initialize): Reversevideo -> ReverseVideo.
Richard M. Stallman <rms@gnu.org>
parents:
3445
diff
changeset
|
117 (x-get-resource "reverseVideo" "ReverseVideo")))) |
3050
8e2472cd4409
(frame-initialize): Handle `reverse' as parameter.
Richard M. Stallman <rms@gnu.org>
parents:
2870
diff
changeset
|
118 (let ((params (frame-parameters frame-initial-frame))) |
8e2472cd4409
(frame-initialize): Handle `reverse' as parameter.
Richard M. Stallman <rms@gnu.org>
parents:
2870
diff
changeset
|
119 (modify-frame-parameters |
8e2472cd4409
(frame-initialize): Handle `reverse' as parameter.
Richard M. Stallman <rms@gnu.org>
parents:
2870
diff
changeset
|
120 frame-initial-frame |
3445
49b72d583354
(frame-initialize): Set cursor-color last.
Richard M. Stallman <rms@gnu.org>
parents:
3433
diff
changeset
|
121 ;; Must set cursor-color after background color. |
49b72d583354
(frame-initialize): Set cursor-color last.
Richard M. Stallman <rms@gnu.org>
parents:
3433
diff
changeset
|
122 ;; So put it first. |
3617 | 123 (list (cons 'cursor-color |
124 (cdr (assq 'background-color params))) | |
125 (cons 'foreground-color | |
126 (cdr (assq 'background-color params))) | |
127 (cons 'background-color | |
128 (cdr (assq 'foreground-color params))) | |
129 (cons 'mouse-color | |
130 (cdr (assq 'background-color params))) | |
131 (cons 'border-color | |
132 (cdr (assq 'background-color params))))))))) | |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
133 |
777 | 134 ;; At this point, we know that we have a frame open, so we |
135 ;; can delete the terminal frame. | |
136 (delete-frame terminal-frame) | |
137 (setq terminal-frame nil)) | |
394 | 138 |
139 ;; No, we're not running a window system. Arrange to cause errors. | |
777 | 140 (setq frame-creation-function |
404
f6c751f07c4a
*** empty log message ***
Michael I. Bushnell <mib@gnu.org>
parents:
394
diff
changeset
|
141 (function |
f6c751f07c4a
*** empty log message ***
Michael I. Bushnell <mib@gnu.org>
parents:
394
diff
changeset
|
142 (lambda (parameters) |
f6c751f07c4a
*** empty log message ***
Michael I. Bushnell <mib@gnu.org>
parents:
394
diff
changeset
|
143 (error |
1881
436edc3e74f6
(frame-initialize): Fix error syntax.
Richard M. Stallman <rms@gnu.org>
parents:
1863
diff
changeset
|
144 "Can't create multiple frames without a window system")))))) |
394 | 145 |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
146 ;;; startup.el calls this function after loading the user's init |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
147 ;;; file. Now default-frame-alist and initial-frame-alist contain |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
148 ;;; information to which we must react; do what needs to be done. |
777 | 149 (defun frame-notice-user-settings () |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
150 |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
151 ;; Creating and deleting frames may shift the selected frame around, |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
152 ;; and thus the current buffer. Protect against that. We don't |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
153 ;; want to use save-excursion here, because that may also try to set |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
154 ;; the buffer of the selected window, which fails when the selected |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
155 ;; window is the minibuffer. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
156 (let ((old-buffer (current-buffer))) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
157 |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
158 ;; If the initial frame is still around, apply initial-frame-alist |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
159 ;; and default-frame-alist to it. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
160 (if (frame-live-p frame-initial-frame) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
161 |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
162 ;; The initial frame we create above always has a minibuffer. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
163 ;; If the user wants to remove it, or make it a minibuffer-only |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
164 ;; frame, then we'll have to delete the current frame and make a |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
165 ;; new one; you can't remove or add a root window to/from an |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
166 ;; existing frame. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
167 ;; |
1113 | 168 ;; NOTE: default-frame-alist was nil when we created the |
169 ;; existing frame. We need to explicitly include | |
170 ;; default-frame-alist in the parameters of the screen we | |
171 ;; create here, so that its new value, gleaned from the user's | |
172 ;; .emacs file, will be applied to the existing screen. | |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
173 (if (not (eq (cdr (or (assq 'minibuffer initial-frame-alist) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
174 (assq 'minibuffer default-frame-alist) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
175 '(minibuffer . t))) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
176 t)) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
177 ;; Create the new frame. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
178 (let ((new |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
179 (new-frame |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
180 (append initial-frame-alist |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
181 default-frame-alist |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
182 (frame-parameters frame-initial-frame))))) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
183 |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
184 ;; The initial frame, which we are about to delete, may be |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
185 ;; the only frame with a minibuffer. If it is, create a |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
186 ;; new one. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
187 (or (delq frame-initial-frame (minibuffer-frame-list)) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
188 (new-frame (append minibuffer-frame-alist |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
189 '((minibuffer . only))))) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
190 |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
191 ;; If the initial frame is serving as a surrogate |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
192 ;; minibuffer frame for any frames, we need to wean them |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
193 ;; onto a new frame. The default-minibuffer-frame |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
194 ;; variable must be handled similarly. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
195 (let ((users-of-initial |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
196 (filtered-frame-list |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
197 (function (lambda (frame) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
198 (and (not (eq frame frame-initial-frame)) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
199 (eq (window-frame |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
200 (minibuffer-window frame)) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
201 frame-initial-frame))))))) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
202 (if (or users-of-initial |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
203 (eq default-minibuffer-frame frame-initial-frame)) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
204 |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
205 ;; Choose an appropriate frame. Prefer frames which |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
206 ;; are only minibuffers. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
207 (let* ((new-surrogate |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
208 (car |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
209 (or (filtered-frame-list |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
210 (function |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
211 (lambda (frame) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
212 (eq (cdr (assq 'minibuffer |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
213 (frame-parameters frame))) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
214 'only)))) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
215 (minibuffer-frame-list)))) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
216 (new-minibuffer (minibuffer-window new-surrogate))) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
217 |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
218 (if (eq default-minibuffer-frame frame-initial-frame) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
219 (setq default-minibuffer-frame new-surrogate)) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
220 |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
221 ;; Wean the frames using frame-initial-frame as |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
222 ;; their minibuffer frame. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
223 (mapcar |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
224 (function |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
225 (lambda (frame) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
226 (modify-frame-parameters |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
227 frame (list (cons 'minibuffer new-minibuffer))))) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
228 users-of-initial)))) |
1113 | 229 |
230 ;; Redirect events enqueued at this frame to the new frame. | |
231 ;; Is this a good idea? | |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
232 (redirect-frame-focus frame-initial-frame new) |
1113 | 233 |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
234 ;; Finally, get rid of the old frame. |
777 | 235 (delete-frame frame-initial-frame)) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
236 |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
237 ;; Otherwise, we don't need all that rigamarole; just apply |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
238 ;; the new parameters. |
777 | 239 (modify-frame-parameters frame-initial-frame |
1113 | 240 (append initial-frame-alist |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
241 default-frame-alist)))) |
394 | 242 |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
243 ;; Restore the original buffer. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
244 (set-buffer old-buffer) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
245 |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
246 ;; Make sure the initial frame can be GC'd if it is ever deleted. |
2870
cd270fa53052
* frame.el (frame-notice-user-settings): Don't make
Jim Blandy <jimb@redhat.com>
parents:
2846
diff
changeset
|
247 ;; Make sure frame-notice-user-settings does nothing if called twice. |
cd270fa53052
* frame.el (frame-notice-user-settings): Don't make
Jim Blandy <jimb@redhat.com>
parents:
2846
diff
changeset
|
248 (setq frame-initial-frame nil))) |
394 | 249 |
250 | |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
251 ;;;; Creation of additional frames, and other frame miscellanea |
394 | 252 |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
253 ;;; Return some frame other than the current frame, creating one if |
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
3554
diff
changeset
|
254 ;;; necessary. Note that the minibuffer frame, if separate, is not |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
255 ;;; considered (see next-frame). |
827 | 256 (defun get-other-frame () |
777 | 257 (let ((s (if (equal (next-frame (selected-frame)) (selected-frame)) |
258 (new-frame) | |
259 (next-frame (selected-frame))))) | |
394 | 260 s)) |
261 | |
777 | 262 (defun next-multiframe-window () |
263 "Select the next window, regardless of which frame it is on." | |
394 | 264 (interactive) |
265 (select-window (next-window (selected-window) | |
266 (> (minibuffer-depth) 0) | |
267 t))) | |
268 | |
777 | 269 (defun previous-multiframe-window () |
270 "Select the previous window, regardless of which frame it is on." | |
394 | 271 (interactive) |
272 (select-window (previous-window (selected-window) | |
273 (> (minibuffer-depth) 0) | |
274 t))) | |
275 | |
2246
1f0d48f7e583
(make-frame): Renamed from new-frame.
Richard M. Stallman <rms@gnu.org>
parents:
2202
diff
changeset
|
276 ;; Alias, kept temporarily. |
2571
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2246
diff
changeset
|
277 (defalias 'new-frame 'make-frame) |
2246
1f0d48f7e583
(make-frame): Renamed from new-frame.
Richard M. Stallman <rms@gnu.org>
parents:
2202
diff
changeset
|
278 (defun make-frame (&optional parameters) |
777 | 279 "Create a new frame, displaying the current buffer. |
539 | 280 |
542 | 281 Optional argument PARAMETERS is an alist of parameters for the new |
777 | 282 frame. Specifically, PARAMETERS is a list of pairs, each having one |
542 | 283 of the following forms: |
284 | |
1974
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
285 \(name . STRING) - The frame should be named STRING. |
542 | 286 |
1974
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
287 \(height . NUMBER) - The frame should be NUMBER text lines high. If |
542 | 288 this parameter is present, the width parameter must also be |
289 given. | |
290 | |
1974
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
291 \(width . NUMBER) - The frame should be NUMBER characters in width. |
542 | 292 If this parameter is present, the height parameter must also |
293 be given. | |
294 | |
1974
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
295 \(minibuffer . t) - the frame should have a minibuffer |
1977
ca6059bb1d6f
* frame.el (new-frame): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
1974
diff
changeset
|
296 \(minibuffer . nil) - the frame should have no minibuffer |
1974
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
297 \(minibuffer . only) - the frame should contain only a minibuffer |
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
298 \(minibuffer . WINDOW) - the frame should use WINDOW as its minibuffer window. |
542 | 299 |
1974
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
300 The documentation for the function `x-create-frame' describes |
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
301 additional frame parameters that Emacs recognizes for X window frames." |
394 | 302 (interactive) |
777 | 303 (funcall frame-creation-function parameters)) |
394 | 304 |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
305 (defun filtered-frame-list (predicate) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
306 "Return a list of all live frames which satisfy PREDICATE." |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
307 (let ((frames (frame-list)) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
308 good-frames) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
309 (while (consp frames) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
310 (if (funcall predicate (car frames)) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
311 (setq good-frames (cons (car frames) good-frames))) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
312 (setq frames (cdr frames))) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
313 good-frames)) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
314 |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
315 (defun minibuffer-frame-list () |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
316 "Return a list of all frames with their own minibuffers." |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
317 (filtered-frame-list |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
318 (function (lambda (frame) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
319 (eq frame (window-frame (minibuffer-window frame))))))) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
320 |
394 | 321 |
777 | 322 ;;;; Frame configurations |
756 | 323 |
777 | 324 (defun current-frame-configuration () |
325 "Return a list describing the positions and states of all frames. | |
2202
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
326 Its car is `frame-configuration'. |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
327 Each element of the cdr is a list of the form (FRAME ALIST WINDOW-CONFIG), |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
328 where |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
329 FRAME is a frame object, |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
330 ALIST is an association list specifying some of FRAME's parameters, and |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
331 WINDOW-CONFIG is a window configuration object for FRAME." |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
332 (cons 'frame-configuration |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
333 (mapcar (function |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
334 (lambda (frame) |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
335 (list frame |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
336 (frame-parameters frame) |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
337 (current-window-configuration frame)))) |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
338 (frame-list)))) |
756 | 339 |
777 | 340 (defun set-frame-configuration (configuration) |
341 "Restore the frames to the state described by CONFIGURATION. | |
342 Each frame listed in CONFIGURATION has its position, size, window | |
756 | 343 configuration, and other parameters set as specified in CONFIGURATION." |
2202
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
344 (or (frame-configuration-p configuration) |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
345 (signal 'wrong-type-argument |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
346 (list 'frame-configuration-p configuration))) |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
347 (let ((config-alist (cdr configuration)) |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
348 frames-to-delete) |
756 | 349 (mapcar (function |
777 | 350 (lambda (frame) |
2202
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
351 (let ((parameters (assq frame config-alist))) |
756 | 352 (if parameters |
353 (progn | |
3764
d965878f294f
* frame.el (set-frame-configuration): Don't try to set a frame's
Jim Blandy <jimb@redhat.com>
parents:
3647
diff
changeset
|
354 (modify-frame-parameters |
d965878f294f
* frame.el (set-frame-configuration): Don't try to set a frame's
Jim Blandy <jimb@redhat.com>
parents:
3647
diff
changeset
|
355 frame |
d965878f294f
* frame.el (set-frame-configuration): Don't try to set a frame's
Jim Blandy <jimb@redhat.com>
parents:
3647
diff
changeset
|
356 ;; Since we can't set a frame's minibuffer status, |
d965878f294f
* frame.el (set-frame-configuration): Don't try to set a frame's
Jim Blandy <jimb@redhat.com>
parents:
3647
diff
changeset
|
357 ;; we might as well omit the parameter altogether. |
d965878f294f
* frame.el (set-frame-configuration): Don't try to set a frame's
Jim Blandy <jimb@redhat.com>
parents:
3647
diff
changeset
|
358 (let* ((parms (nth 1 parameters)) |
d965878f294f
* frame.el (set-frame-configuration): Don't try to set a frame's
Jim Blandy <jimb@redhat.com>
parents:
3647
diff
changeset
|
359 (mini (assq 'minibuffer parms))) |
d965878f294f
* frame.el (set-frame-configuration): Don't try to set a frame's
Jim Blandy <jimb@redhat.com>
parents:
3647
diff
changeset
|
360 (if mini (setq parms (delq mini parms))) |
d965878f294f
* frame.el (set-frame-configuration): Don't try to set a frame's
Jim Blandy <jimb@redhat.com>
parents:
3647
diff
changeset
|
361 parms)) |
756 | 362 (set-window-configuration (nth 2 parameters))) |
777 | 363 (setq frames-to-delete (cons frame frames-to-delete)))))) |
364 (frame-list)) | |
365 (mapcar 'delete-frame frames-to-delete))) | |
394 | 366 |
2202
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
367 (defun frame-configuration-p (object) |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
368 "Return non-nil if OBJECT seems to be a frame configuration. |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
369 Any list whose car is `frame-configuration' is assumed to be a frame |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
370 configuration." |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
371 (and (consp object) |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
372 (eq (car object) 'frame-configuration))) |
081afcef5e85
Make frame configurations start with a distinctive symbol.
Jim Blandy <jimb@redhat.com>
parents:
2069
diff
changeset
|
373 |
394 | 374 |
777 | 375 ;;;; Convenience functions for accessing and interactively changing |
376 ;;;; frame parameters. | |
394 | 377 |
826 | 378 (defun frame-height (&optional frame) |
777 | 379 "Return number of lines available for display on FRAME. |
380 If FRAME is omitted, describe the currently selected frame." | |
826 | 381 (cdr (assq 'height (frame-parameters frame)))) |
777 | 382 |
383 (defun frame-width (&optional frame) | |
384 "Return number of columns available for display on FRAME. | |
385 If FRAME is omitted, describe the currently selected frame." | |
826 | 386 (cdr (assq 'width (frame-parameters frame)))) |
777 | 387 |
394 | 388 (defun set-default-font (font-name) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
389 "Set the font of the selected frame to FONT. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
390 When called interactively, prompt for the name of the font to use." |
394 | 391 (interactive "sFont name: ") |
777 | 392 (modify-frame-parameters (selected-frame) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
393 (list (cons 'font font-name)))) |
394 | 394 |
1881
436edc3e74f6
(frame-initialize): Fix error syntax.
Richard M. Stallman <rms@gnu.org>
parents:
1863
diff
changeset
|
395 (defun set-background-color (color-name) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
396 "Set the background color of the selected frame to COLOR. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
397 When called interactively, prompt for the name of the color to use." |
394 | 398 (interactive "sColor: ") |
777 | 399 (modify-frame-parameters (selected-frame) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
400 (list (cons 'background-color color-name)))) |
394 | 401 |
1881
436edc3e74f6
(frame-initialize): Fix error syntax.
Richard M. Stallman <rms@gnu.org>
parents:
1863
diff
changeset
|
402 (defun set-foreground-color (color-name) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
403 "Set the foreground color of the selected frame to COLOR. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
404 When called interactively, prompt for the name of the color to use." |
394 | 405 (interactive "sColor: ") |
777 | 406 (modify-frame-parameters (selected-frame) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
407 (list (cons 'foreground-color color-name)))) |
394 | 408 |
409 (defun set-cursor-color (color-name) | |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
410 "Set the text cursor color of the selected frame to COLOR. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
411 When called interactively, prompt for the name of the color to use." |
394 | 412 (interactive "sColor: ") |
777 | 413 (modify-frame-parameters (selected-frame) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
414 (list (cons 'cursor-color color-name)))) |
394 | 415 |
1974
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
416 (defun set-mouse-color (color-name) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
417 "Set the color of the mouse pointer of the selected frame to COLOR. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
418 When called interactively, prompt for the name of the color to use." |
394 | 419 (interactive "sColor: ") |
777 | 420 (modify-frame-parameters (selected-frame) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
421 (list (cons 'mouse-color color-name)))) |
394 | 422 |
1974
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
423 (defun set-border-color (color-name) |
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
424 "Set the color of the border of the selected frame to COLOR. |
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
425 When called interactively, prompt for the name of the color to use." |
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
426 (interactive "sColor: ") |
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
427 (modify-frame-parameters (selected-frame) |
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
428 (list (cons 'border-color color-name)))) |
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
429 |
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
430 (defun auto-raise-mode (arg) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
431 "Toggle whether or not the selected frame should auto-raise. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
432 With arg, turn auto-raise mode on if and only if arg is positive." |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
433 (interactive "P") |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
434 (if (null arg) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
435 (setq arg |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
436 (if (cdr (assq 'auto-raise (frame-parameters (selected-frame)))) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
437 -1 1))) |
777 | 438 (modify-frame-parameters (selected-frame) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
439 (list (cons 'auto-raise (> arg 0))))) |
394 | 440 |
1974
94e4f619080b
These changes were actually made by Richard; I stole his RCS lock.
Jim Blandy <jimb@redhat.com>
parents:
1881
diff
changeset
|
441 (defun auto-lower-mode (arg) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
442 "Toggle whether or not the selected frame should auto-lower. |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
443 With arg, turn auto-lower mode on if and only if arg is positive." |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
444 (interactive "P") |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
445 (if (null arg) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
446 (setq arg |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
447 (if (cdr (assq 'auto-lower (frame-parameters (selected-frame)))) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
448 -1 1))) |
777 | 449 (modify-frame-parameters (selected-frame) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
450 (list (cons 'auto-lower (> arg 0))))) |
394 | 451 |
2846
c36e7ad524d3
(toggle-scroll-bar): Renamed from toggle-vertical-scroll...
Richard M. Stallman <rms@gnu.org>
parents:
2763
diff
changeset
|
452 (defun toggle-scroll-bar (arg) |
1977
ca6059bb1d6f
* frame.el (new-frame): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
1974
diff
changeset
|
453 "Toggle whether or not the selected frame has vertical scroll bars. |
ca6059bb1d6f
* frame.el (new-frame): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
1974
diff
changeset
|
454 With arg, turn vertical scroll bars on if and only if arg is positive." |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
455 (interactive "P") |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
456 (if (null arg) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
457 (setq arg |
1977
ca6059bb1d6f
* frame.el (new-frame): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
1974
diff
changeset
|
458 (if (cdr (assq 'vertical-scroll-bars |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
459 (frame-parameters (selected-frame)))) |
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
460 -1 1))) |
777 | 461 (modify-frame-parameters (selected-frame) |
1977
ca6059bb1d6f
* frame.el (new-frame): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
1974
diff
changeset
|
462 (list (cons 'vertical-scroll-bars (> arg 0))))) |
394 | 463 |
1881
436edc3e74f6
(frame-initialize): Fix error syntax.
Richard M. Stallman <rms@gnu.org>
parents:
1863
diff
changeset
|
464 (defun toggle-horizontal-scroll-bar (arg) |
1977
ca6059bb1d6f
* frame.el (new-frame): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
1974
diff
changeset
|
465 "Toggle whether or not the selected frame has horizontal scroll bars. |
ca6059bb1d6f
* frame.el (new-frame): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
1974
diff
changeset
|
466 With arg, turn horizontal scroll bars on if and only if arg is positive. |
ca6059bb1d6f
* frame.el (new-frame): Doc fix.
Jim Blandy <jimb@redhat.com>
parents:
1974
diff
changeset
|
467 Horizontal scroll bars aren't implemented yet." |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
468 (interactive "P") |
1881
436edc3e74f6
(frame-initialize): Fix error syntax.
Richard M. Stallman <rms@gnu.org>
parents:
1863
diff
changeset
|
469 (error "Horizontal scroll bars aren't implemented yet")) |
1863
6f55c76b5789
* frame.el: Clean up initialization code.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
470 |
394 | 471 |
777 | 472 ;;;; Aliases for backward compatibility with Emacs 18. |
2571
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2246
diff
changeset
|
473 (defalias 'screen-height 'frame-height) |
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2246
diff
changeset
|
474 (defalias 'screen-width 'frame-width) |
958 | 475 |
476 (defun set-screen-width (cols &optional pretend) | |
477 "Obsolete function to change the size of the screen to COLS columns.\n\ | |
478 Optional second arg non-nil means that redisplay should use COLS columns\n\ | |
479 but that the idea of the actual width of the frame should not be changed.\n\ | |
480 This function is provided only for compatibility with Emacs 18; new code\n\ | |
1475 | 481 should use `set-frame-width instead'." |
958 | 482 (set-frame-width (selected-frame) cols pretend)) |
483 | |
484 (defun set-screen-height (lines &optional pretend) | |
485 "Obsolete function to change the height of the screen to LINES lines.\n\ | |
486 Optional second arg non-nil means that redisplay should use LINES lines\n\ | |
487 but that the idea of the actual height of the screen should not be changed.\n\ | |
488 This function is provided only for compatibility with Emacs 18; new code\n\ | |
1475 | 489 should use `set-frame-width' instead." |
958 | 490 (set-frame-height (selected-frame) lines pretend)) |
491 | |
492 (make-obsolete 'screen-height 'frame-height) | |
493 (make-obsolete 'screen-width 'frame-width) | |
494 (make-obsolete 'set-screen-width 'set-frame-width) | |
495 (make-obsolete 'set-screen-height 'set-frame-height) | |
777 | 496 |
497 | |
394 | 498 ;;;; Key bindings |
727 | 499 (defvar ctl-x-5-map (make-sparse-keymap) |
777 | 500 "Keymap for frame commands.") |
2571
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2246
diff
changeset
|
501 (defalias 'ctl-x-5-prefix ctl-x-5-map) |
727 | 502 (define-key ctl-x-map "5" 'ctl-x-5-prefix) |
394 | 503 |
777 | 504 (define-key ctl-x-5-map "2" 'new-frame) |
505 (define-key ctl-x-5-map "0" 'delete-frame) | |
584 | 506 |
777 | 507 (provide 'frame) |
658
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
584
diff
changeset
|
508 |
777 | 509 ;;; frame.el ends here |