Mercurial > emacs
annotate doc/lispref/frames.texi @ 99846:01f6f69b8a10
Update section title.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sun, 23 Nov 2008 06:59:09 +0000 |
parents | 742bad2b3aeb |
children | 87e287e416fe |
rev | line source |
---|---|
84068 | 1 @c -*-texinfo-*- |
2 @c This is part of the GNU Emacs Lisp Reference Manual. | |
3 @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2001, | |
87649 | 4 @c 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
84068 | 5 @c See the file elisp.texi for copying conditions. |
84116
0ba80d073e27
(setfilename): Go up one more level to ../../info.
Glenn Morris <rgm@gnu.org>
parents:
84068
diff
changeset
|
6 @setfilename ../../info/frames |
84068 | 7 @node Frames, Positions, Windows, Top |
8 @chapter Frames | |
9 @cindex frame | |
10 | |
99763
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
11 In Emacs editing, a @dfn{frame} is a screen object that contains one |
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
12 or more Emacs windows, see @ref{Windows}. It's the kind of object that |
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
13 is called a ``window'' in the terminology of graphical environments; but |
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
14 we can't call it a ``window'' here, because Emacs uses that word in a |
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
15 different way. In Emacs Lisp, a @dfn{frame object} is a Lisp object |
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
16 that represents a frame on the screen. |
84068 | 17 |
18 A frame initially contains a single main window and/or a minibuffer | |
19 window; you can subdivide the main window vertically or horizontally | |
99763
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
20 into smaller windows. @xref{Splitting Windows}. |
84068 | 21 |
22 @cindex terminal frame | |
23 When Emacs runs on a text-only terminal, it starts with one | |
98681
8be1f0e1f72d
(Frames): Mention multiple tty frames.
Eli Zaretskii <eliz@gnu.org>
parents:
97043
diff
changeset
|
24 @dfn{terminal frame}. If you create additional frames on the same |
8be1f0e1f72d
(Frames): Mention multiple tty frames.
Eli Zaretskii <eliz@gnu.org>
parents:
97043
diff
changeset
|
25 terminal, Emacs displays one and only one at any given time---on that |
8be1f0e1f72d
(Frames): Mention multiple tty frames.
Eli Zaretskii <eliz@gnu.org>
parents:
97043
diff
changeset
|
26 terminal screen, of course. You can create additional frames, either |
8be1f0e1f72d
(Frames): Mention multiple tty frames.
Eli Zaretskii <eliz@gnu.org>
parents:
97043
diff
changeset
|
27 text-only or GUI, on other terminals from the same Emacs session. |
8be1f0e1f72d
(Frames): Mention multiple tty frames.
Eli Zaretskii <eliz@gnu.org>
parents:
97043
diff
changeset
|
28 (This comes in handy when you connect to the same session from several |
8be1f0e1f72d
(Frames): Mention multiple tty frames.
Eli Zaretskii <eliz@gnu.org>
parents:
97043
diff
changeset
|
29 remote locations.) @c FIXME: Add an xref to multi-tty doc. |
84068 | 30 |
31 @cindex window frame | |
32 When Emacs communicates directly with a supported window system, such | |
33 as X, it does not have a terminal frame; instead, it starts with | |
34 a single @dfn{window frame}, but you can create more, and Emacs can | |
35 display several such frames at once as is usual for window systems. | |
36 | |
37 @defun framep object | |
38 This predicate returns a non-@code{nil} value if @var{object} is a | |
39 frame, and @code{nil} otherwise. For a frame, the value indicates which | |
40 kind of display the frame uses: | |
41 | |
42 @table @code | |
43 @item x | |
44 The frame is displayed in an X window. | |
45 @item t | |
46 A terminal frame on a character display. | |
47 @item w32 | |
48 The frame is displayed on MS-Windows 9X/NT. | |
49 @item pc | |
50 The frame is displayed on an MS-DOS terminal. | |
51 @end table | |
52 @end defun | |
53 | |
54 @menu | |
55 * Creating Frames:: Creating additional frames. | |
56 * Multiple Displays:: Creating frames on other displays. | |
57 * Frame Parameters:: Controlling frame size, position, font, etc. | |
58 * Frame Titles:: Automatic updating of frame titles. | |
59 * Deleting Frames:: Frames last until explicitly deleted. | |
60 * Finding All Frames:: How to examine all existing frames. | |
61 * Frames and Windows:: A frame contains windows; | |
62 display of text always works through windows. | |
63 * Minibuffers and Frames:: How a frame finds the minibuffer to use. | |
64 * Input Focus:: Specifying the selected frame. | |
65 * Visibility of Frames:: Frames may be visible or invisible, or icons. | |
66 * Raising and Lowering:: Raising a frame makes it hide other windows; | |
67 lowering it makes the others hide it. | |
68 * Frame Configurations:: Saving the state of all frames. | |
69 * Mouse Tracking:: Getting events that say when the mouse moves. | |
70 * Mouse Position:: Asking where the mouse is, or moving it. | |
71 * Pop-Up Menus:: Displaying a menu for the user to select from. | |
72 * Dialog Boxes:: Displaying a box to ask yes or no. | |
73 * Pointer Shape:: Specifying the shape of the mouse pointer. | |
74 * Window System Selections:: Transferring text to and from other X clients. | |
75 * Drag and Drop:: Internals of Drag-and-Drop implementation. | |
76 * Color Names:: Getting the definitions of color names. | |
77 * Text Terminal Colors:: Defining colors for text-only terminals. | |
78 * Resources:: Getting resource values from the server. | |
79 * Display Feature Testing:: Determining the features of a terminal. | |
80 @end menu | |
81 | |
82 @xref{Display}, for information about the related topic of | |
83 controlling Emacs redisplay. | |
84 | |
85 @node Creating Frames | |
86 @section Creating Frames | |
87 | |
88 To create a new frame, call the function @code{make-frame}. | |
89 | |
90 @defun make-frame &optional alist | |
91 This function creates and returns a new frame, displaying the current | |
92 buffer. If you are using a supported window system, it makes a window | |
93 frame; otherwise, it makes a terminal frame. | |
94 | |
95 The argument is an alist specifying frame parameters. Any parameters | |
96 not mentioned in @var{alist} default according to the value of the | |
97 variable @code{default-frame-alist}; parameters not specified even there | |
98 default from the standard X resources or whatever is used instead on | |
99 your system. | |
100 | |
98737
40fea3019362
(Creating Frames): Document frame-inherited-parameters.
Eli Zaretskii <eliz@gnu.org>
parents:
98681
diff
changeset
|
101 After the frame is created, this function applies to it the |
40fea3019362
(Creating Frames): Document frame-inherited-parameters.
Eli Zaretskii <eliz@gnu.org>
parents:
98681
diff
changeset
|
102 parameters, if any, listed in the value of |
40fea3019362
(Creating Frames): Document frame-inherited-parameters.
Eli Zaretskii <eliz@gnu.org>
parents:
98681
diff
changeset
|
103 @code{frame-inherited-parameters} (see below) and not present in the |
40fea3019362
(Creating Frames): Document frame-inherited-parameters.
Eli Zaretskii <eliz@gnu.org>
parents:
98681
diff
changeset
|
104 argument, taking the values from the frame that was selected when |
40fea3019362
(Creating Frames): Document frame-inherited-parameters.
Eli Zaretskii <eliz@gnu.org>
parents:
98681
diff
changeset
|
105 @code{make-frame} was called. |
40fea3019362
(Creating Frames): Document frame-inherited-parameters.
Eli Zaretskii <eliz@gnu.org>
parents:
98681
diff
changeset
|
106 |
84068 | 107 The set of possible parameters depends in principle on what kind of |
108 window system Emacs uses to display its frames. @xref{Window Frame | |
109 Parameters}, for documentation of individual parameters you can specify. | |
110 | |
111 This function itself does not make the new frame the selected frame. | |
112 @xref{Input Focus}. The previously selected frame remains selected. | |
113 However, the window system may select the new frame for its own reasons, | |
114 for instance if the frame appears under the mouse pointer and your | |
115 setup is for focus to follow the pointer. | |
116 @end defun | |
117 | |
118 @defvar before-make-frame-hook | |
119 A normal hook run by @code{make-frame} before it actually creates the | |
120 frame. | |
121 @end defvar | |
122 | |
123 @defvar after-make-frame-functions | |
124 An abnormal hook run by @code{make-frame} after it creates the frame. | |
125 Each function in @code{after-make-frame-functions} receives one argument, the | |
126 frame just created. | |
127 @end defvar | |
128 | |
98737
40fea3019362
(Creating Frames): Document frame-inherited-parameters.
Eli Zaretskii <eliz@gnu.org>
parents:
98681
diff
changeset
|
129 @defvar frame-inherited-parameters |
40fea3019362
(Creating Frames): Document frame-inherited-parameters.
Eli Zaretskii <eliz@gnu.org>
parents:
98681
diff
changeset
|
130 This variable specifies the list of frame parameters that a newly |
40fea3019362
(Creating Frames): Document frame-inherited-parameters.
Eli Zaretskii <eliz@gnu.org>
parents:
98681
diff
changeset
|
131 created frame inherits from the currently selected frame. For each |
40fea3019362
(Creating Frames): Document frame-inherited-parameters.
Eli Zaretskii <eliz@gnu.org>
parents:
98681
diff
changeset
|
132 parameter (a symbol) that is an element in the list and is not present |
40fea3019362
(Creating Frames): Document frame-inherited-parameters.
Eli Zaretskii <eliz@gnu.org>
parents:
98681
diff
changeset
|
133 in the argument to @code{make-frame}, the function sets the value of |
40fea3019362
(Creating Frames): Document frame-inherited-parameters.
Eli Zaretskii <eliz@gnu.org>
parents:
98681
diff
changeset
|
134 that parameter in the created frame to its value in the selected |
40fea3019362
(Creating Frames): Document frame-inherited-parameters.
Eli Zaretskii <eliz@gnu.org>
parents:
98681
diff
changeset
|
135 frame. |
40fea3019362
(Creating Frames): Document frame-inherited-parameters.
Eli Zaretskii <eliz@gnu.org>
parents:
98681
diff
changeset
|
136 @end defvar |
40fea3019362
(Creating Frames): Document frame-inherited-parameters.
Eli Zaretskii <eliz@gnu.org>
parents:
98681
diff
changeset
|
137 |
84068 | 138 @node Multiple Displays |
139 @section Multiple Displays | |
140 @cindex multiple X displays | |
141 @cindex displays, multiple | |
142 | |
143 A single Emacs can talk to more than one X display. | |
144 Initially, Emacs uses just one display---the one chosen with the | |
145 @code{DISPLAY} environment variable or with the @samp{--display} option | |
146 (@pxref{Initial Options,,, emacs, The GNU Emacs Manual}). To connect to | |
147 another display, use the command @code{make-frame-on-display} or specify | |
148 the @code{display} frame parameter when you create the frame. | |
149 | |
150 Emacs treats each X server as a separate terminal, giving each one its | |
151 own selected frame and its own minibuffer windows. However, only one of | |
152 those frames is ``@emph{the} selected frame'' at any given moment, see | |
153 @ref{Input Focus}. | |
154 | |
155 A few Lisp variables are @dfn{terminal-local}; that is, they have a | |
156 separate binding for each terminal. The binding in effect at any time | |
157 is the one for the terminal that the currently selected frame belongs | |
158 to. These variables include @code{default-minibuffer-frame}, | |
159 @code{defining-kbd-macro}, @code{last-kbd-macro}, and | |
160 @code{system-key-alist}. They are always terminal-local, and can never | |
85688 | 161 be buffer-local (@pxref{Buffer-Local Variables}). |
84068 | 162 |
163 A single X server can handle more than one screen. A display name | |
164 @samp{@var{host}:@var{server}.@var{screen}} has three parts; the last | |
165 part specifies the screen number for a given server. When you use two | |
166 screens belonging to one server, Emacs knows by the similarity in their | |
167 names that they share a single keyboard, and it treats them as a single | |
168 terminal. | |
169 | |
170 Note that some graphical terminals can output to more than a one | |
171 monitor (or other output device) at the same time. On these | |
172 ``multi-monitor'' setups, a single @var{display} value controls the | |
173 output to all the physical monitors. In this situation, there is | |
174 currently no platform-independent way for Emacs to distinguish between | |
175 the different physical monitors. | |
176 | |
177 @deffn Command make-frame-on-display display &optional parameters | |
178 This creates and returns a new frame on display @var{display}, taking | |
179 the other frame parameters from @var{parameters}. Aside from the | |
180 @var{display} argument, it is like @code{make-frame} (@pxref{Creating | |
181 Frames}). | |
182 @end deffn | |
183 | |
184 @defun x-display-list | |
185 This returns a list that indicates which X displays Emacs has a | |
186 connection to. The elements of the list are strings, and each one is | |
187 a display name. | |
188 @end defun | |
189 | |
190 @defun x-open-connection display &optional xrm-string must-succeed | |
191 This function opens a connection to the X display @var{display}. It | |
192 does not create a frame on that display, but it permits you to check | |
193 that communication can be established with that display. | |
194 | |
195 The optional argument @var{xrm-string}, if not @code{nil}, is a | |
196 string of resource names and values, in the same format used in the | |
197 @file{.Xresources} file. The values you specify override the resource | |
198 values recorded in the X server itself; they apply to all Emacs frames | |
199 created on this display. Here's an example of what this string might | |
200 look like: | |
201 | |
202 @example | |
203 "*BorderWidth: 3\n*InternalBorder: 2\n" | |
204 @end example | |
205 | |
206 @xref{X Resources,, X Resources, emacs, The GNU Emacs Manual}. | |
207 | |
208 If @var{must-succeed} is non-@code{nil}, failure to open the connection | |
209 terminates Emacs. Otherwise, it is an ordinary Lisp error. | |
210 @end defun | |
211 | |
212 @defun x-close-connection display | |
213 This function closes the connection to display @var{display}. Before | |
214 you can do this, you must first delete all the frames that were open on | |
215 that display (@pxref{Deleting Frames}). | |
216 @end defun | |
217 | |
218 @node Frame Parameters | |
219 @section Frame Parameters | |
220 @cindex frame parameters | |
221 | |
222 A frame has many parameters that control its appearance and behavior. | |
223 Just what parameters a frame has depends on what display mechanism it | |
224 uses. | |
225 | |
226 Frame parameters exist mostly for the sake of window systems. A | |
227 terminal frame has a few parameters, mostly for compatibility's sake; | |
228 only the @code{height}, @code{width}, @code{name}, @code{title}, | |
229 @code{menu-bar-lines}, @code{buffer-list} and @code{buffer-predicate} | |
230 parameters do something special. If the terminal supports colors, the | |
231 parameters @code{foreground-color}, @code{background-color}, | |
232 @code{background-mode} and @code{display-type} are also meaningful. | |
99685
1b4415b23803
(Color Parameters): Document alpha parameter.
Chong Yidong <cyd@stupidchicken.com>
parents:
99490
diff
changeset
|
233 If the terminal supports frame transparency, the parameter |
1b4415b23803
(Color Parameters): Document alpha parameter.
Chong Yidong <cyd@stupidchicken.com>
parents:
99490
diff
changeset
|
234 @code{alpha} is also meaningful. |
84068 | 235 |
98681
8be1f0e1f72d
(Frames): Mention multiple tty frames.
Eli Zaretskii <eliz@gnu.org>
parents:
97043
diff
changeset
|
236 You can use frame parameters to define frame-local bindings for |
8be1f0e1f72d
(Frames): Mention multiple tty frames.
Eli Zaretskii <eliz@gnu.org>
parents:
97043
diff
changeset
|
237 variables. @xref{Frame-Local Variables}. |
8be1f0e1f72d
(Frames): Mention multiple tty frames.
Eli Zaretskii <eliz@gnu.org>
parents:
97043
diff
changeset
|
238 |
84068 | 239 @menu |
240 * Parameter Access:: How to change a frame's parameters. | |
241 * Initial Parameters:: Specifying frame parameters when you make a frame. | |
242 * Window Frame Parameters:: List of frame parameters for window systems. | |
243 * Size and Position:: Changing the size and position of a frame. | |
244 * Geometry:: Parsing geometry specifications. | |
245 @end menu | |
246 | |
247 @node Parameter Access | |
248 @subsection Access to Frame Parameters | |
249 | |
250 These functions let you read and change the parameter values of a | |
251 frame. | |
252 | |
253 @defun frame-parameter frame parameter | |
254 This function returns the value of the parameter @var{parameter} (a | |
255 symbol) of @var{frame}. If @var{frame} is @code{nil}, it returns the | |
256 selected frame's parameter. If @var{frame} has no setting for | |
257 @var{parameter}, this function returns @code{nil}. | |
258 @end defun | |
259 | |
260 @defun frame-parameters &optional frame | |
261 The function @code{frame-parameters} returns an alist listing all the | |
262 parameters of @var{frame} and their values. If @var{frame} is | |
263 @code{nil} or omitted, this returns the selected frame's parameters | |
264 @end defun | |
265 | |
266 @defun modify-frame-parameters frame alist | |
267 This function alters the parameters of frame @var{frame} based on the | |
268 elements of @var{alist}. Each element of @var{alist} has the form | |
269 @code{(@var{parm} . @var{value})}, where @var{parm} is a symbol naming a | |
270 parameter. If you don't mention a parameter in @var{alist}, its value | |
271 doesn't change. If @var{frame} is @code{nil}, it defaults to the selected | |
272 frame. | |
98681
8be1f0e1f72d
(Frames): Mention multiple tty frames.
Eli Zaretskii <eliz@gnu.org>
parents:
97043
diff
changeset
|
273 |
8be1f0e1f72d
(Frames): Mention multiple tty frames.
Eli Zaretskii <eliz@gnu.org>
parents:
97043
diff
changeset
|
274 You can use this function to define frame-local bindings for |
8be1f0e1f72d
(Frames): Mention multiple tty frames.
Eli Zaretskii <eliz@gnu.org>
parents:
97043
diff
changeset
|
275 variables, see @ref{Frame-Local Variables}. |
84068 | 276 @end defun |
277 | |
98737
40fea3019362
(Creating Frames): Document frame-inherited-parameters.
Eli Zaretskii <eliz@gnu.org>
parents:
98681
diff
changeset
|
278 @defun set-frame-parameter frame parm value |
98755
9fdc192b2742
(Creating Frames): Fix typo in last change.
Eli Zaretskii <eliz@gnu.org>
parents:
98737
diff
changeset
|
279 This function sets the frame parameter @var{parm} to the specified |
98737
40fea3019362
(Creating Frames): Document frame-inherited-parameters.
Eli Zaretskii <eliz@gnu.org>
parents:
98681
diff
changeset
|
280 @var{value}. If @var{frame} is @code{nil}, it defaults to the |
40fea3019362
(Creating Frames): Document frame-inherited-parameters.
Eli Zaretskii <eliz@gnu.org>
parents:
98681
diff
changeset
|
281 selected frame. |
40fea3019362
(Creating Frames): Document frame-inherited-parameters.
Eli Zaretskii <eliz@gnu.org>
parents:
98681
diff
changeset
|
282 @end defun |
40fea3019362
(Creating Frames): Document frame-inherited-parameters.
Eli Zaretskii <eliz@gnu.org>
parents:
98681
diff
changeset
|
283 |
84068 | 284 @defun modify-all-frames-parameters alist |
285 This function alters the frame parameters of all existing frames | |
286 according to @var{alist}, then modifies @code{default-frame-alist} | |
287 (and, if necessary, @code{initial-frame-alist}) to apply the same | |
288 parameter values to frames that will be created henceforth. | |
289 @end defun | |
290 | |
291 @node Initial Parameters | |
292 @subsection Initial Frame Parameters | |
293 | |
294 You can specify the parameters for the initial startup frame | |
295 by setting @code{initial-frame-alist} in your init file (@pxref{Init File}). | |
296 | |
297 @defvar initial-frame-alist | |
298 This variable's value is an alist of parameter values used when creating | |
299 the initial window frame. You can set this variable to specify the | |
300 appearance of the initial frame without altering subsequent frames. | |
301 Each element has the form: | |
302 | |
303 @example | |
304 (@var{parameter} . @var{value}) | |
305 @end example | |
306 | |
307 Emacs creates the initial frame before it reads your init | |
308 file. After reading that file, Emacs checks @code{initial-frame-alist}, | |
309 and applies the parameter settings in the altered value to the already | |
310 created initial frame. | |
311 | |
312 If these settings affect the frame geometry and appearance, you'll see | |
313 the frame appear with the wrong ones and then change to the specified | |
314 ones. If that bothers you, you can specify the same geometry and | |
315 appearance with X resources; those do take effect before the frame is | |
316 created. @xref{X Resources,, X Resources, emacs, The GNU Emacs Manual}. | |
317 | |
318 X resource settings typically apply to all frames. If you want to | |
319 specify some X resources solely for the sake of the initial frame, and | |
320 you don't want them to apply to subsequent frames, here's how to achieve | |
321 this. Specify parameters in @code{default-frame-alist} to override the | |
322 X resources for subsequent frames; then, to prevent these from affecting | |
323 the initial frame, specify the same parameters in | |
324 @code{initial-frame-alist} with values that match the X resources. | |
325 @end defvar | |
326 | |
327 If these parameters specify a separate minibuffer-only frame with | |
328 @code{(minibuffer . nil)}, and you have not created one, Emacs creates | |
329 one for you. | |
330 | |
331 @defvar minibuffer-frame-alist | |
332 This variable's value is an alist of parameter values used when creating | |
333 an initial minibuffer-only frame---if such a frame is needed, according | |
334 to the parameters for the main initial frame. | |
335 @end defvar | |
336 | |
337 @defvar default-frame-alist | |
338 This is an alist specifying default values of frame parameters for all | |
339 Emacs frames---the first frame, and subsequent frames. When using the X | |
340 Window System, you can get the same results by means of X resources | |
341 in many cases. | |
342 | |
343 Setting this variable does not affect existing frames. | |
344 @end defvar | |
345 | |
99763
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
346 Functions that display a buffer in a separate frame can override the |
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
347 default parameters by supplying their own parameters. @xref{Definition |
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
348 of special-display-frame-alist}. |
84068 | 349 |
350 If you use options that specify window appearance when you invoke Emacs, | |
351 they take effect by adding elements to @code{default-frame-alist}. One | |
352 exception is @samp{-geometry}, which adds the specified position to | |
353 @code{initial-frame-alist} instead. @xref{Emacs Invocation,, Command | |
354 Line Arguments for Emacs Invocation, emacs, The GNU Emacs Manual}. | |
355 | |
356 @node Window Frame Parameters | |
357 @subsection Window Frame Parameters | |
358 | |
359 Just what parameters a frame has depends on what display mechanism | |
360 it uses. This section describes the parameters that have special | |
361 meanings on some or all kinds of terminals. Of these, @code{name}, | |
362 @code{title}, @code{height}, @code{width}, @code{buffer-list} and | |
363 @code{buffer-predicate} provide meaningful information in terminal | |
364 frames, and @code{tty-color-mode} is meaningful @emph{only} in | |
365 terminal frames. | |
366 | |
367 @menu | |
368 * Basic Parameters:: Parameters that are fundamental. | |
369 * Position Parameters:: The position of the frame on the screen. | |
370 * Size Parameters:: Frame's size. | |
371 * Layout Parameters:: Size of parts of the frame, and | |
372 enabling or disabling some parts. | |
373 * Buffer Parameters:: Which buffers have been or should be shown. | |
374 * Management Parameters:: Communicating with the window manager. | |
375 * Cursor Parameters:: Controlling the cursor appearance. | |
376 * Color Parameters:: Colors of various parts of the frame. | |
377 @end menu | |
378 | |
379 @node Basic Parameters | |
380 @subsubsection Basic Parameters | |
381 | |
382 These frame parameters give the most basic information about the | |
383 frame. @code{title} and @code{name} are meaningful on all terminals. | |
384 | |
385 @table @code | |
386 @item display | |
387 The display on which to open this frame. It should be a string of the | |
388 form @code{"@var{host}:@var{dpy}.@var{screen}"}, just like the | |
389 @code{DISPLAY} environment variable. | |
390 | |
391 @item display-type | |
392 This parameter describes the range of possible colors that can be used | |
393 in this frame. Its value is @code{color}, @code{grayscale} or | |
394 @code{mono}. | |
395 | |
396 @item title | |
87453 | 397 If a frame has a non-@code{nil} title, it appears in the window |
398 system's title bar at the top of the frame, and also in the mode line | |
399 of windows in that frame if @code{mode-line-frame-identification} uses | |
400 @samp{%F} (@pxref{%-Constructs}). This is normally the case when | |
401 Emacs is not using a window system, and can only display one frame at | |
402 a time. @xref{Frame Titles}. | |
84068 | 403 |
404 @item name | |
405 The name of the frame. The frame name serves as a default for the frame | |
406 title, if the @code{title} parameter is unspecified or @code{nil}. If | |
407 you don't specify a name, Emacs sets the frame name automatically | |
408 (@pxref{Frame Titles}). | |
409 | |
410 If you specify the frame name explicitly when you create the frame, the | |
411 name is also used (instead of the name of the Emacs executable) when | |
412 looking up X resources for the frame. | |
413 @end table | |
414 | |
415 @node Position Parameters | |
416 @subsubsection Position Parameters | |
417 | |
418 Position parameters' values are normally measured in pixels, but on | |
419 text-only terminals they count characters or lines instead. | |
420 | |
421 @table @code | |
422 @item left | |
92098 | 423 The position, in pixels, of the left (or right) edge of the frame with |
424 respect to the left (or right) edge of the screen. The value may be: | |
92096
6cc4c897d108
(Position Parameters): Clarify the description of `left' and `top',
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
425 |
6cc4c897d108
(Position Parameters): Clarify the description of `left' and `top',
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
426 @table @asis |
6cc4c897d108
(Position Parameters): Clarify the description of `left' and `top',
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
427 @item an integer |
6cc4c897d108
(Position Parameters): Clarify the description of `left' and `top',
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
428 A positive integer relates the left edge of the frame to the left edge |
6cc4c897d108
(Position Parameters): Clarify the description of `left' and `top',
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
429 of the screen. A negative integer relates the right frame edge to the |
6cc4c897d108
(Position Parameters): Clarify the description of `left' and `top',
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
430 right screen edge. |
84068 | 431 |
92096
6cc4c897d108
(Position Parameters): Clarify the description of `left' and `top',
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
432 @item @code{(+ @var{pos})} |
6cc4c897d108
(Position Parameters): Clarify the description of `left' and `top',
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
433 This specifies the position of the left frame edge relative to the left |
6cc4c897d108
(Position Parameters): Clarify the description of `left' and `top',
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
434 screen edge. The integer @var{pos} may be positive or negative; a |
6cc4c897d108
(Position Parameters): Clarify the description of `left' and `top',
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
435 negative value specifies a position outside the screen. |
6cc4c897d108
(Position Parameters): Clarify the description of `left' and `top',
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
436 |
6cc4c897d108
(Position Parameters): Clarify the description of `left' and `top',
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
437 @item @code{(- @var{pos})} |
6cc4c897d108
(Position Parameters): Clarify the description of `left' and `top',
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
438 This specifies the position of the right frame edge relative to the right |
6cc4c897d108
(Position Parameters): Clarify the description of `left' and `top',
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
439 screen edge. The integer @var{pos} may be positive or negative; a |
6cc4c897d108
(Position Parameters): Clarify the description of `left' and `top',
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
440 negative value specifies a position outside the screen. |
6cc4c897d108
(Position Parameters): Clarify the description of `left' and `top',
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
441 @end table |
84068 | 442 |
443 Some window managers ignore program-specified positions. If you want to | |
444 be sure the position you specify is not ignored, specify a | |
445 non-@code{nil} value for the @code{user-position} parameter as well. | |
446 | |
447 @item top | |
92096
6cc4c897d108
(Position Parameters): Clarify the description of `left' and `top',
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
448 The screen position of the top (or bottom) edge, in pixels, with respect |
6cc4c897d108
(Position Parameters): Clarify the description of `left' and `top',
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
449 to the top (or bottom) edge of the screen. It works just like |
6cc4c897d108
(Position Parameters): Clarify the description of `left' and `top',
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
450 @code{left}, except vertically instead of horizontally. |
84068 | 451 |
452 @item icon-left | |
453 The screen position of the left edge @emph{of the frame's icon}, in | |
454 pixels, counting from the left edge of the screen. This takes effect if | |
455 and when the frame is iconified. | |
456 | |
457 If you specify a value for this parameter, then you must also specify | |
458 a value for @code{icon-top} and vice versa. The window manager may | |
459 ignore these two parameters. | |
460 | |
461 @item icon-top | |
462 The screen position of the top edge @emph{of the frame's icon}, in | |
463 pixels, counting from the top edge of the screen. This takes effect if | |
464 and when the frame is iconified. | |
465 | |
466 @item user-position | |
467 When you create a frame and specify its screen position with the | |
468 @code{left} and @code{top} parameters, use this parameter to say whether | |
469 the specified position was user-specified (explicitly requested in some | |
470 way by a human user) or merely program-specified (chosen by a program). | |
471 A non-@code{nil} value says the position was user-specified. | |
472 | |
473 Window managers generally heed user-specified positions, and some heed | |
474 program-specified positions too. But many ignore program-specified | |
475 positions, placing the window in a default fashion or letting the user | |
476 place it with the mouse. Some window managers, including @code{twm}, | |
477 let the user specify whether to obey program-specified positions or | |
478 ignore them. | |
479 | |
480 When you call @code{make-frame}, you should specify a non-@code{nil} | |
481 value for this parameter if the values of the @code{left} and @code{top} | |
482 parameters represent the user's stated preference; otherwise, use | |
483 @code{nil}. | |
484 @end table | |
485 | |
486 @node Size Parameters | |
487 @subsubsection Size Parameters | |
488 | |
489 Size parameters' values are normally measured in pixels, but on | |
490 text-only terminals they count characters or lines instead. | |
491 | |
492 @table @code | |
493 @item height | |
494 The height of the frame contents, in characters. (To get the height in | |
495 pixels, call @code{frame-pixel-height}; see @ref{Size and Position}.) | |
496 | |
497 @item width | |
87453 | 498 The width of the frame contents, in characters. (To get the width in |
84068 | 499 pixels, call @code{frame-pixel-width}; see @ref{Size and Position}.) |
500 | |
501 @item user-size | |
502 This does for the size parameters @code{height} and @code{width} what | |
503 the @code{user-position} parameter (see above) does for the position | |
504 parameters @code{top} and @code{left}. | |
505 | |
506 @item fullscreen | |
507 Specify that width, height or both shall be set to the size of the screen. | |
508 The value @code{fullwidth} specifies that width shall be the size of the | |
509 screen. The value @code{fullheight} specifies that height shall be the | |
510 size of the screen. The value @code{fullboth} specifies that both the | |
511 width and the height shall be set to the size of the screen. | |
512 @end table | |
513 | |
514 @node Layout Parameters | |
515 @subsubsection Layout Parameters | |
516 | |
517 These frame parameters enable or disable various parts of the | |
518 frame, or control their sizes. | |
519 | |
520 @table @code | |
521 @item border-width | |
522 The width in pixels of the frame's border. | |
523 | |
524 @item internal-border-width | |
525 The distance in pixels between text (or fringe) and the frame's border. | |
526 | |
527 @item vertical-scroll-bars | |
528 Whether the frame has scroll bars for vertical scrolling, and which side | |
529 of the frame they should be on. The possible values are @code{left}, | |
530 @code{right}, and @code{nil} for no scroll bars. | |
531 | |
532 @ignore | |
533 @item horizontal-scroll-bars | |
534 Whether the frame has scroll bars for horizontal scrolling | |
535 (non-@code{nil} means yes). Horizontal scroll bars are not currently | |
536 implemented. | |
537 @end ignore | |
538 | |
539 @item scroll-bar-width | |
540 The width of vertical scroll bars, in pixels, or @code{nil} meaning to | |
541 use the default width. | |
542 | |
543 @item left-fringe | |
544 @itemx right-fringe | |
545 The default width of the left and right fringes of windows in this | |
546 frame (@pxref{Fringes}). If either of these is zero, that effectively | |
547 removes the corresponding fringe. A value of @code{nil} stands for | |
548 the standard fringe width, which is the width needed to display the | |
549 fringe bitmaps. | |
550 | |
551 The combined fringe widths must add up to an integral number of | |
552 columns, so the actual default fringe widths for the frame may be | |
553 larger than the specified values. The extra width needed to reach an | |
554 acceptable total is distributed evenly between the left and right | |
555 fringe. However, you can force one fringe or the other to a precise | |
556 width by specifying that width as a negative integer. If both widths are | |
557 negative, only the left fringe gets the specified width. | |
558 | |
559 @item menu-bar-lines | |
560 The number of lines to allocate at the top of the frame for a menu | |
561 bar. The default is 1. A value of @code{nil} means don't display a | |
562 menu bar. @xref{Menu Bar}. (The X toolkit and GTK allow at most one | |
563 menu bar line; they treat larger values as 1.) | |
564 | |
565 @item tool-bar-lines | |
566 The number of lines to use for the tool bar. A value of @code{nil} | |
567 means don't display a tool bar. (GTK allows at most one tool bar line; | |
568 it treats larger values as 1.) | |
569 | |
570 @item line-spacing | |
571 Additional space to leave below each text line, in pixels (a positive | |
572 integer). @xref{Line Height}, for more information. | |
573 @end table | |
574 | |
575 @node Buffer Parameters | |
576 @subsubsection Buffer Parameters | |
577 | |
578 These frame parameters, meaningful on all kinds of terminals, deal | |
579 with which buffers have been, or should, be displayed in the frame. | |
580 | |
581 @table @code | |
582 @item minibuffer | |
583 Whether this frame has its own minibuffer. The value @code{t} means | |
584 yes, @code{nil} means no, @code{only} means this frame is just a | |
585 minibuffer. If the value is a minibuffer window (in some other frame), | |
586 the new frame uses that minibuffer. | |
587 | |
588 @item buffer-predicate | |
589 The buffer-predicate function for this frame. The function | |
590 @code{other-buffer} uses this predicate (from the selected frame) to | |
591 decide which buffers it should consider, if the predicate is not | |
592 @code{nil}. It calls the predicate with one argument, a buffer, once for | |
593 each buffer; if the predicate returns a non-@code{nil} value, it | |
594 considers that buffer. | |
595 | |
596 @item buffer-list | |
597 A list of buffers that have been selected in this frame, | |
598 ordered most-recently-selected first. | |
599 | |
600 @item unsplittable | |
601 If non-@code{nil}, this frame's window is never split automatically. | |
602 @end table | |
603 | |
604 @node Management Parameters | |
605 @subsubsection Window Management Parameters | |
606 @cindex window manager, and frame parameters | |
607 | |
608 These frame parameters, meaningful only on window system displays, | |
609 interact with the window manager. | |
610 | |
611 @table @code | |
612 @item visibility | |
613 The state of visibility of the frame. There are three possibilities: | |
614 @code{nil} for invisible, @code{t} for visible, and @code{icon} for | |
615 iconified. @xref{Visibility of Frames}. | |
616 | |
617 @item auto-raise | |
618 Whether selecting the frame raises it (non-@code{nil} means yes). | |
619 | |
620 @item auto-lower | |
621 Whether deselecting the frame lowers it (non-@code{nil} means yes). | |
622 | |
623 @item icon-type | |
624 The type of icon to use for this frame when it is iconified. If the | |
625 value is a string, that specifies a file containing a bitmap to use. | |
626 Any other non-@code{nil} value specifies the default bitmap icon (a | |
627 picture of a gnu); @code{nil} specifies a text icon. | |
628 | |
629 @item icon-name | |
630 The name to use in the icon for this frame, when and if the icon | |
631 appears. If this is @code{nil}, the frame's title is used. | |
632 | |
633 @item window-id | |
634 The number of the window-system window used by the frame | |
635 to contain the actual Emacs windows. | |
636 | |
637 @item outer-window-id | |
638 The number of the outermost window-system window used for the whole frame. | |
639 | |
640 @item wait-for-wm | |
641 If non-@code{nil}, tell Xt to wait for the window manager to confirm | |
642 geometry changes. Some window managers, including versions of Fvwm2 | |
643 and KDE, fail to confirm, so Xt hangs. Set this to @code{nil} to | |
644 prevent hanging with those window managers. | |
645 | |
646 @ignore | |
647 @item parent-id | |
648 @c ??? Not yet working. | |
649 The X window number of the window that should be the parent of this one. | |
650 Specifying this lets you create an Emacs window inside some other | |
651 application's window. (It is not certain this will be implemented; try | |
652 it and see if it works.) | |
653 @end ignore | |
654 @end table | |
655 | |
656 @node Cursor Parameters | |
657 @subsubsection Cursor Parameters | |
658 | |
659 This frame parameter controls the way the cursor looks. | |
660 | |
661 @table @code | |
662 @item cursor-type | |
663 How to display the cursor. Legitimate values are: | |
664 | |
665 @table @code | |
666 @item box | |
667 Display a filled box. (This is the default.) | |
668 @item hollow | |
669 Display a hollow box. | |
670 @item nil | |
671 Don't display a cursor. | |
672 @item bar | |
673 Display a vertical bar between characters. | |
674 @item (bar . @var{width}) | |
675 Display a vertical bar @var{width} pixels wide between characters. | |
676 @item hbar | |
677 Display a horizontal bar. | |
678 @item (hbar . @var{height}) | |
679 Display a horizontal bar @var{height} pixels high. | |
680 @end table | |
681 @end table | |
682 | |
683 @vindex cursor-type | |
684 The buffer-local variable @code{cursor-type} overrides the value of | |
685 the @code{cursor-type} frame parameter, but if it is @code{t}, that | |
686 means to use the cursor specified for the frame. | |
687 | |
688 @defvar blink-cursor-alist | |
689 This variable specifies how to blink the cursor. Each element has the | |
690 form @code{(@var{on-state} . @var{off-state})}. Whenever the cursor | |
691 type equals @var{on-state} (comparing using @code{equal}), the | |
692 corresponding @var{off-state} specifies what the cursor looks like | |
693 when it blinks ``off.'' Both @var{on-state} and @var{off-state} | |
694 should be suitable values for the @code{cursor-type} frame parameter. | |
695 | |
696 There are various defaults for how to blink each type of cursor, if | |
697 the type is not mentioned as an @var{on-state} here. Changes in this | |
85114 | 698 variable do not take effect immediately, only when you specify the |
699 @code{cursor-type} frame parameter. | |
700 @end defvar | |
701 | |
702 @defvar cursor-in-non-selected-windows | |
703 This variable controls how the cursor looks in a window that is not | |
704 selected. It supports the same values as the @code{cursor-type} frame | |
705 parameter; also, @code{nil} means don't display a cursor in | |
706 nonselected windows, and @code{t} (the default) means use a standard | |
707 modificatoin of the usual cursor type (solid box becomes hollow box, | |
708 and bar becomes a narrower bar). | |
84068 | 709 @end defvar |
710 | |
711 @node Color Parameters | |
712 @subsubsection Color Parameters | |
713 | |
714 These frame parameters control the use of colors. | |
715 | |
716 @table @code | |
717 @item background-mode | |
718 This parameter is either @code{dark} or @code{light}, according | |
719 to whether the background color is a light one or a dark one. | |
720 | |
721 @item tty-color-mode | |
722 @cindex standard colors for character terminals | |
723 This parameter overrides the terminal's color support as given by the | |
724 system's terminal capabilities database in that this parameter's value | |
725 specifies the color mode to use in terminal frames. The value can be | |
726 either a symbol or a number. A number specifies the number of colors | |
727 to use (and, indirectly, what commands to issue to produce each | |
728 color). For example, @code{(tty-color-mode . 8)} specifies use of the | |
729 ANSI escape sequences for 8 standard text colors. A value of -1 turns | |
730 off color support. | |
731 | |
732 If the parameter's value is a symbol, it specifies a number through | |
733 the value of @code{tty-color-mode-alist}, and the associated number is | |
734 used instead. | |
735 | |
736 @item screen-gamma | |
737 @cindex gamma correction | |
738 If this is a number, Emacs performs ``gamma correction'' which adjusts | |
739 the brightness of all colors. The value should be the screen gamma of | |
740 your display, a floating point number. | |
741 | |
742 Usual PC monitors have a screen gamma of 2.2, so color values in | |
743 Emacs, and in X windows generally, are calibrated to display properly | |
744 on a monitor with that gamma value. If you specify 2.2 for | |
745 @code{screen-gamma}, that means no correction is needed. Other values | |
746 request correction, designed to make the corrected colors appear on | |
747 your screen the way they would have appeared without correction on an | |
748 ordinary monitor with a gamma value of 2.2. | |
749 | |
750 If your monitor displays colors too light, you should specify a | |
751 @code{screen-gamma} value smaller than 2.2. This requests correction | |
752 that makes colors darker. A screen gamma value of 1.5 may give good | |
753 results for LCD color displays. | |
99685
1b4415b23803
(Color Parameters): Document alpha parameter.
Chong Yidong <cyd@stupidchicken.com>
parents:
99490
diff
changeset
|
754 |
1b4415b23803
(Color Parameters): Document alpha parameter.
Chong Yidong <cyd@stupidchicken.com>
parents:
99490
diff
changeset
|
755 @item alpha |
1b4415b23803
(Color Parameters): Document alpha parameter.
Chong Yidong <cyd@stupidchicken.com>
parents:
99490
diff
changeset
|
756 @cindex opacity, frame |
1b4415b23803
(Color Parameters): Document alpha parameter.
Chong Yidong <cyd@stupidchicken.com>
parents:
99490
diff
changeset
|
757 @cindex transparency, frame |
1b4415b23803
(Color Parameters): Document alpha parameter.
Chong Yidong <cyd@stupidchicken.com>
parents:
99490
diff
changeset
|
758 @vindex frame-alpha-lower-limit |
1b4415b23803
(Color Parameters): Document alpha parameter.
Chong Yidong <cyd@stupidchicken.com>
parents:
99490
diff
changeset
|
759 This parameter specifies the opacity of the frame, on graphical |
1b4415b23803
(Color Parameters): Document alpha parameter.
Chong Yidong <cyd@stupidchicken.com>
parents:
99490
diff
changeset
|
760 displays that support variable opacity. It should be an integer |
1b4415b23803
(Color Parameters): Document alpha parameter.
Chong Yidong <cyd@stupidchicken.com>
parents:
99490
diff
changeset
|
761 between 0 and 100, where 0 means completely transparent and 100 means |
1b4415b23803
(Color Parameters): Document alpha parameter.
Chong Yidong <cyd@stupidchicken.com>
parents:
99490
diff
changeset
|
762 completely opaque. It can also have a @code{nil} value, which tells |
1b4415b23803
(Color Parameters): Document alpha parameter.
Chong Yidong <cyd@stupidchicken.com>
parents:
99490
diff
changeset
|
763 Emacs not to set the frame opacity (leaving it to the window manager). |
1b4415b23803
(Color Parameters): Document alpha parameter.
Chong Yidong <cyd@stupidchicken.com>
parents:
99490
diff
changeset
|
764 |
1b4415b23803
(Color Parameters): Document alpha parameter.
Chong Yidong <cyd@stupidchicken.com>
parents:
99490
diff
changeset
|
765 To prevent the frame from disappearing completely from view, the |
1b4415b23803
(Color Parameters): Document alpha parameter.
Chong Yidong <cyd@stupidchicken.com>
parents:
99490
diff
changeset
|
766 variable @var{frame-alpha-lower-limit} defines a lower opacity limit. |
1b4415b23803
(Color Parameters): Document alpha parameter.
Chong Yidong <cyd@stupidchicken.com>
parents:
99490
diff
changeset
|
767 If the value of the frame parameter is less than the value of this |
1b4415b23803
(Color Parameters): Document alpha parameter.
Chong Yidong <cyd@stupidchicken.com>
parents:
99490
diff
changeset
|
768 variable, Emacs uses the latter. By default, |
1b4415b23803
(Color Parameters): Document alpha parameter.
Chong Yidong <cyd@stupidchicken.com>
parents:
99490
diff
changeset
|
769 @var{frame-alpha-lower-limit} is 20. |
1b4415b23803
(Color Parameters): Document alpha parameter.
Chong Yidong <cyd@stupidchicken.com>
parents:
99490
diff
changeset
|
770 |
1b4415b23803
(Color Parameters): Document alpha parameter.
Chong Yidong <cyd@stupidchicken.com>
parents:
99490
diff
changeset
|
771 The @code{alpha} frame parameter can also be a cons cell |
1b4415b23803
(Color Parameters): Document alpha parameter.
Chong Yidong <cyd@stupidchicken.com>
parents:
99490
diff
changeset
|
772 @code{(@samp{active} . @samp{inactive})}, where @samp{active} is the |
1b4415b23803
(Color Parameters): Document alpha parameter.
Chong Yidong <cyd@stupidchicken.com>
parents:
99490
diff
changeset
|
773 opacity of the frame when it is selected, and @samp{inactive} is the |
1b4415b23803
(Color Parameters): Document alpha parameter.
Chong Yidong <cyd@stupidchicken.com>
parents:
99490
diff
changeset
|
774 opactity when it is not selected. |
84068 | 775 @end table |
776 | |
99687 | 777 The following frame parameters are semi-obsolete in that they are |
778 automatically equivalent to particular face attributes of particular | |
779 faces (@pxref{Standard Faces,,, emacs, The Emacs Manual}): | |
84068 | 780 |
781 @table @code | |
782 @item font | |
783 The name of the font for displaying text in the frame. This is a | |
784 string, either a valid font name for your system or the name of an Emacs | |
785 fontset (@pxref{Fontsets}). It is equivalent to the @code{font} | |
786 attribute of the @code{default} face. | |
787 | |
788 @item foreground-color | |
789 The color to use for the image of a character. It is equivalent to | |
790 the @code{:foreground} attribute of the @code{default} face. | |
791 | |
792 @item background-color | |
793 The color to use for the background of characters. It is equivalent to | |
794 the @code{:background} attribute of the @code{default} face. | |
795 | |
796 @item mouse-color | |
797 The color for the mouse pointer. It is equivalent to the @code{:background} | |
798 attribute of the @code{mouse} face. | |
799 | |
800 @item cursor-color | |
801 The color for the cursor that shows point. It is equivalent to the | |
802 @code{:background} attribute of the @code{cursor} face. | |
803 | |
804 @item border-color | |
805 The color for the border of the frame. It is equivalent to the | |
806 @code{:background} attribute of the @code{border} face. | |
807 | |
808 @item scroll-bar-foreground | |
809 If non-@code{nil}, the color for the foreground of scroll bars. It is | |
810 equivalent to the @code{:foreground} attribute of the | |
811 @code{scroll-bar} face. | |
812 | |
813 @item scroll-bar-background | |
814 If non-@code{nil}, the color for the background of scroll bars. It is | |
815 equivalent to the @code{:background} attribute of the | |
816 @code{scroll-bar} face. | |
817 @end table | |
818 | |
819 @node Size and Position | |
820 @subsection Frame Size And Position | |
821 @cindex size of frame | |
822 @cindex screen size | |
823 @cindex frame size | |
824 @cindex resize frame | |
825 | |
826 You can read or change the size and position of a frame using the | |
827 frame parameters @code{left}, @code{top}, @code{height}, and | |
828 @code{width}. Whatever geometry parameters you don't specify are chosen | |
829 by the window manager in its usual fashion. | |
830 | |
831 Here are some special features for working with sizes and positions. | |
832 (For the precise meaning of ``selected frame'' used by these functions, | |
833 see @ref{Input Focus}.) | |
834 | |
835 @defun set-frame-position frame left top | |
836 This function sets the position of the top left corner of @var{frame} to | |
837 @var{left} and @var{top}. These arguments are measured in pixels, and | |
838 normally count from the top left corner of the screen. | |
839 | |
840 Negative parameter values position the bottom edge of the window up from | |
841 the bottom edge of the screen, or the right window edge to the left of | |
842 the right edge of the screen. It would probably be better if the values | |
843 were always counted from the left and top, so that negative arguments | |
844 would position the frame partly off the top or left edge of the screen, | |
845 but it seems inadvisable to change that now. | |
846 @end defun | |
847 | |
848 @defun frame-height &optional frame | |
849 @defunx frame-width &optional frame | |
850 These functions return the height and width of @var{frame}, measured in | |
851 lines and columns. If you don't supply @var{frame}, they use the | |
852 selected frame. | |
853 @end defun | |
854 | |
855 @defun screen-height | |
856 @defunx screen-width | |
857 These functions are old aliases for @code{frame-height} and | |
858 @code{frame-width}. When you are using a non-window terminal, the size | |
859 of the frame is normally the same as the size of the terminal screen. | |
860 @end defun | |
861 | |
862 @defun frame-pixel-height &optional frame | |
863 @defunx frame-pixel-width &optional frame | |
87453 | 864 These functions return the height and width of the main display area |
865 of @var{frame}, measured in pixels. If you don't supply @var{frame}, | |
866 they use the selected frame. | |
867 | |
868 These values include the internal borders, and windows' scroll bars | |
869 and fringes (which belong to individual windows, not to the frame | |
870 itself), but do not include menu bars or tool bars (except when using | |
871 X without an X toolkit). | |
84068 | 872 @end defun |
873 | |
874 @defun frame-char-height &optional frame | |
875 @defunx frame-char-width &optional frame | |
876 These functions return the height and width of a character in | |
877 @var{frame}, measured in pixels. The values depend on the choice of | |
878 font. If you don't supply @var{frame}, these functions use the selected | |
879 frame. | |
880 @end defun | |
881 | |
882 @defun set-frame-size frame cols rows | |
883 This function sets the size of @var{frame}, measured in characters; | |
884 @var{cols} and @var{rows} specify the new width and height. | |
885 | |
886 To set the size based on values measured in pixels, use | |
887 @code{frame-char-height} and @code{frame-char-width} to convert | |
888 them to units of characters. | |
889 @end defun | |
890 | |
891 @defun set-frame-height frame lines &optional pretend | |
892 This function resizes @var{frame} to a height of @var{lines} lines. The | |
893 sizes of existing windows in @var{frame} are altered proportionally to | |
894 fit. | |
895 | |
896 If @var{pretend} is non-@code{nil}, then Emacs displays @var{lines} | |
897 lines of output in @var{frame}, but does not change its value for the | |
898 actual height of the frame. This is only useful for a terminal frame. | |
899 Using a smaller height than the terminal actually implements may be | |
900 useful to reproduce behavior observed on a smaller screen, or if the | |
901 terminal malfunctions when using its whole screen. Setting the frame | |
902 height ``for real'' does not always work, because knowing the correct | |
903 actual size may be necessary for correct cursor positioning on a | |
904 terminal frame. | |
905 @end defun | |
906 | |
907 @defun set-frame-width frame width &optional pretend | |
908 This function sets the width of @var{frame}, measured in characters. | |
909 The argument @var{pretend} has the same meaning as in | |
910 @code{set-frame-height}. | |
911 @end defun | |
912 | |
913 @findex set-screen-height | |
914 @findex set-screen-width | |
915 The older functions @code{set-screen-height} and | |
916 @code{set-screen-width} were used to specify the height and width of the | |
917 screen, in Emacs versions that did not support multiple frames. They | |
918 are semi-obsolete, but still work; they apply to the selected frame. | |
919 | |
920 @node Geometry | |
921 @subsection Geometry | |
922 | |
923 Here's how to examine the data in an X-style window geometry | |
924 specification: | |
925 | |
926 @defun x-parse-geometry geom | |
927 @cindex geometry specification | |
928 The function @code{x-parse-geometry} converts a standard X window | |
929 geometry string to an alist that you can use as part of the argument to | |
930 @code{make-frame}. | |
931 | |
932 The alist describes which parameters were specified in @var{geom}, and | |
933 gives the values specified for them. Each element looks like | |
934 @code{(@var{parameter} . @var{value})}. The possible @var{parameter} | |
935 values are @code{left}, @code{top}, @code{width}, and @code{height}. | |
936 | |
937 For the size parameters, the value must be an integer. The position | |
938 parameter names @code{left} and @code{top} are not totally accurate, | |
939 because some values indicate the position of the right or bottom edges | |
92096
6cc4c897d108
(Position Parameters): Clarify the description of `left' and `top',
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
940 instead. The @var{value} possibilities for the position parameters are: |
6cc4c897d108
(Position Parameters): Clarify the description of `left' and `top',
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
941 an integer, a list @code{(+ @var{pos})}, or a list @code{(- @var{pos})}; |
6cc4c897d108
(Position Parameters): Clarify the description of `left' and `top',
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
942 as previously described (@pxref{Position Parameters}). |
84068 | 943 |
944 Here is an example: | |
945 | |
946 @example | |
947 (x-parse-geometry "35x70+0-0") | |
948 @result{} ((height . 70) (width . 35) | |
949 (top - 0) (left . 0)) | |
950 @end example | |
951 @end defun | |
952 | |
953 @node Frame Titles | |
954 @section Frame Titles | |
955 @cindex frame title | |
956 | |
957 Every frame has a @code{name} parameter; this serves as the default | |
958 for the frame title which window systems typically display at the top of | |
959 the frame. You can specify a name explicitly by setting the @code{name} | |
960 frame property. | |
961 | |
962 Normally you don't specify the name explicitly, and Emacs computes the | |
963 frame name automatically based on a template stored in the variable | |
964 @code{frame-title-format}. Emacs recomputes the name each time the | |
965 frame is redisplayed. | |
966 | |
967 @defvar frame-title-format | |
968 This variable specifies how to compute a name for a frame when you have | |
969 not explicitly specified one. The variable's value is actually a mode | |
970 line construct, just like @code{mode-line-format}, except that the | |
971 @samp{%c} and @samp{%l} constructs are ignored. @xref{Mode Line | |
972 Data}. | |
973 @end defvar | |
974 | |
975 @defvar icon-title-format | |
976 This variable specifies how to compute the name for an iconified frame, | |
977 when you have not explicitly specified the frame title. This title | |
978 appears in the icon itself. | |
979 @end defvar | |
980 | |
981 @defvar multiple-frames | |
982 This variable is set automatically by Emacs. Its value is @code{t} when | |
983 there are two or more frames (not counting minibuffer-only frames or | |
984 invisible frames). The default value of @code{frame-title-format} uses | |
985 @code{multiple-frames} so as to put the buffer name in the frame title | |
986 only when there is more than one frame. | |
987 | |
988 The value of this variable is not guaranteed to be accurate except | |
989 while processing @code{frame-title-format} or | |
990 @code{icon-title-format}. | |
991 @end defvar | |
992 | |
993 @node Deleting Frames | |
994 @section Deleting Frames | |
995 @cindex deleting frames | |
996 | |
997 Frames remain potentially visible until you explicitly @dfn{delete} | |
998 them. A deleted frame cannot appear on the screen, but continues to | |
999 exist as a Lisp object until there are no references to it. | |
1000 | |
1001 @deffn Command delete-frame &optional frame force | |
1002 @vindex delete-frame-functions | |
1003 This function deletes the frame @var{frame}. Unless @var{frame} is a | |
1004 tooltip, it first runs the hook @code{delete-frame-functions} (each | |
1005 function gets one argument, @var{frame}). By default, @var{frame} is | |
1006 the selected frame. | |
1007 | |
1008 A frame cannot be deleted if its minibuffer is used by other frames. | |
1009 Normally, you cannot delete a frame if all other frames are invisible, | |
99763
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
1010 but if @var{force} is non-@code{nil}, then you are allowed to do so. |
84068 | 1011 @end deffn |
1012 | |
1013 @defun frame-live-p frame | |
1014 The function @code{frame-live-p} returns non-@code{nil} if the frame | |
1015 @var{frame} has not been deleted. The possible non-@code{nil} return | |
1016 values are like those of @code{framep}. @xref{Frames}. | |
1017 @end defun | |
1018 | |
1019 Some window managers provide a command to delete a window. These work | |
1020 by sending a special message to the program that operates the window. | |
1021 When Emacs gets one of these commands, it generates a | |
1022 @code{delete-frame} event, whose normal definition is a command that | |
1023 calls the function @code{delete-frame}. @xref{Misc Events}. | |
1024 | |
1025 @node Finding All Frames | |
1026 @section Finding All Frames | |
1027 @cindex frames, scanning all | |
1028 | |
1029 @defun frame-list | |
1030 The function @code{frame-list} returns a list of all the frames that | |
1031 have not been deleted. It is analogous to @code{buffer-list} for | |
1032 buffers, and includes frames on all terminals. The list that you get is | |
1033 newly created, so modifying the list doesn't have any effect on the | |
1034 internals of Emacs. | |
1035 @end defun | |
1036 | |
1037 @defun visible-frame-list | |
1038 This function returns a list of just the currently visible frames. | |
1039 @xref{Visibility of Frames}. (Terminal frames always count as | |
1040 ``visible,'' even though only the selected one is actually displayed.) | |
1041 @end defun | |
1042 | |
1043 @defun next-frame &optional frame minibuf | |
1044 The function @code{next-frame} lets you cycle conveniently through all | |
1045 the frames on the current display from an arbitrary starting point. It | |
1046 returns the ``next'' frame after @var{frame} in the cycle. If | |
1047 @var{frame} is omitted or @code{nil}, it defaults to the selected frame | |
1048 (@pxref{Input Focus}). | |
1049 | |
1050 The second argument, @var{minibuf}, says which frames to consider: | |
1051 | |
1052 @table @asis | |
1053 @item @code{nil} | |
1054 Exclude minibuffer-only frames. | |
1055 @item @code{visible} | |
1056 Consider all visible frames. | |
1057 @item 0 | |
1058 Consider all visible or iconified frames. | |
1059 @item a window | |
1060 Consider only the frames using that particular window as their | |
1061 minibuffer. | |
1062 @item anything else | |
1063 Consider all frames. | |
1064 @end table | |
1065 @end defun | |
1066 | |
1067 @defun previous-frame &optional frame minibuf | |
1068 Like @code{next-frame}, but cycles through all frames in the opposite | |
1069 direction. | |
1070 @end defun | |
1071 | |
1072 See also @code{next-window} and @code{previous-window}, in @ref{Cyclic | |
1073 Window Ordering}. | |
1074 | |
1075 @node Frames and Windows | |
1076 @section Frames and Windows | |
1077 | |
99763
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
1078 Each window is part of one and only one frame; you can get that frame |
84068 | 1079 with @code{window-frame}. |
1080 | |
1081 @defun window-frame window | |
1082 This function returns the frame that @var{window} is on. | |
1083 @end defun | |
1084 | |
1085 All the non-minibuffer windows in a frame are arranged in a cyclic | |
1086 order. The order runs from the frame's top window, which is at the | |
1087 upper left corner, down and to the right, until it reaches the window at | |
1088 the lower right corner (always the minibuffer window, if the frame has | |
1089 one), and then it moves back to the top. @xref{Cyclic Window Ordering}. | |
1090 | |
1091 @defun frame-first-window &optional frame | |
1092 This returns the topmost, leftmost window of frame @var{frame}. | |
1093 If omitted or @code{nil}, @var{frame} defaults to the selected frame. | |
1094 @end defun | |
1095 | |
1096 At any time, exactly one window on any frame is @dfn{selected within the | |
1097 frame}. The significance of this designation is that selecting the | |
99763
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
1098 frame also selects this window. Conversely, selecting a window for |
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
1099 Emacs with @code{select-window} also makes that window selected within |
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
1100 its frame. @xref{Selecting Windows}. |
84068 | 1101 |
1102 @defun frame-selected-window &optional frame | |
1103 This function returns the window on @var{frame} that is selected | |
1104 within @var{frame}. If omitted or @code{nil}, @var{frame} defaults to | |
1105 the selected frame. | |
1106 @end defun | |
1107 | |
99763
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
1108 @defun set-frame-selected-window frame window &optional norecord |
84068 | 1109 This sets the selected window of frame @var{frame} to @var{window}. |
1110 If @var{frame} is @code{nil}, it operates on the selected frame. If | |
1111 @var{frame} is the selected frame, this makes @var{window} the | |
1112 selected window. This function returns @var{window}. | |
99763
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
1113 |
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
1114 Optional argument @var{norecord} non-@code{nil} means to neither change |
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
1115 the order of recently selected windows nor the buffer list (@pxref{The |
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
1116 Buffer List}). |
84068 | 1117 @end defun |
1118 | |
1119 Another function that (usually) returns one of the windows in a given | |
1120 frame is @code{minibuffer-window}. @xref{Definition of minibuffer-window}. | |
1121 | |
1122 @node Minibuffers and Frames | |
1123 @section Minibuffers and Frames | |
1124 | |
1125 Normally, each frame has its own minibuffer window at the bottom, which | |
1126 is used whenever that frame is selected. If the frame has a minibuffer, | |
1127 you can get it with @code{minibuffer-window} (@pxref{Definition of | |
1128 minibuffer-window}). | |
1129 | |
1130 However, you can also create a frame with no minibuffer. Such a frame | |
1131 must use the minibuffer window of some other frame. When you create the | |
1132 frame, you can specify explicitly the minibuffer window to use (in some | |
1133 other frame). If you don't, then the minibuffer is found in the frame | |
1134 which is the value of the variable @code{default-minibuffer-frame}. Its | |
1135 value should be a frame that does have a minibuffer. | |
1136 | |
1137 If you use a minibuffer-only frame, you might want that frame to raise | |
1138 when you enter the minibuffer. If so, set the variable | |
1139 @code{minibuffer-auto-raise} to @code{t}. @xref{Raising and Lowering}. | |
1140 | |
1141 @defvar default-minibuffer-frame | |
1142 This variable specifies the frame to use for the minibuffer window, by | |
1143 default. It does not affect existing frames. It is always local to | |
1144 the current terminal and cannot be buffer-local. @xref{Multiple | |
1145 Displays}. | |
1146 @end defvar | |
1147 | |
1148 @node Input Focus | |
1149 @section Input Focus | |
1150 @cindex input focus | |
1151 @c @cindex selected frame Duplicates selected-frame | |
1152 | |
1153 At any time, one frame in Emacs is the @dfn{selected frame}. The selected | |
1154 window always resides on the selected frame. | |
1155 | |
1156 When Emacs displays its frames on several terminals (@pxref{Multiple | |
1157 Displays}), each terminal has its own selected frame. But only one of | |
1158 these is ``@emph{the} selected frame'': it's the frame that belongs to | |
1159 the terminal from which the most recent input came. That is, when Emacs | |
1160 runs a command that came from a certain terminal, the selected frame is | |
1161 the one of that terminal. Since Emacs runs only a single command at any | |
1162 given time, it needs to consider only one selected frame at a time; this | |
1163 frame is what we call @dfn{the selected frame} in this manual. The | |
99763
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
1164 display on which the selected frame is shown is the @dfn{selected |
84068 | 1165 frame's display}. |
1166 | |
1167 @defun selected-frame | |
1168 This function returns the selected frame. | |
1169 @end defun | |
1170 | |
1171 Some window systems and window managers direct keyboard input to the | |
1172 window object that the mouse is in; others require explicit clicks or | |
1173 commands to @dfn{shift the focus} to various window objects. Either | |
1174 way, Emacs automatically keeps track of which frame has the focus. To | |
99763
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
1175 explicitly switch to a different frame from a Lisp function, call |
84068 | 1176 @code{select-frame-set-input-focus}. |
1177 | |
1178 Lisp programs can also switch frames ``temporarily'' by calling the | |
1179 function @code{select-frame}. This does not alter the window system's | |
1180 concept of focus; rather, it escapes from the window manager's control | |
1181 until that control is somehow reasserted. | |
1182 | |
1183 When using a text-only terminal, only one frame can be displayed at a | |
1184 time on the terminal, so after a call to @code{select-frame}, the next | |
1185 redisplay actually displays the newly selected frame. This frame | |
99763
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
1186 remains selected until a subsequent call to @code{select-frame}. Each |
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
1187 terminal frame has a number which appears in the mode line before the |
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
1188 buffer name (@pxref{Mode Line Variables}). |
84068 | 1189 |
1190 @defun select-frame-set-input-focus frame | |
99763
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
1191 This function selects @var{frame}, raises it (should it happen to be |
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
1192 obscured by other frames) and tries to give it the X server's focus. On |
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
1193 a text-only terminal, the next redisplay displays the new frame on the |
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
1194 entire terminal screen. The return value of this function is not |
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
1195 significant. |
84068 | 1196 @end defun |
1197 | |
1198 @c ??? This is not yet implemented properly. | |
99763
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
1199 @defun select-frame frame &optional norecord |
84068 | 1200 This function selects frame @var{frame}, temporarily disregarding the |
1201 focus of the X server if any. The selection of @var{frame} lasts until | |
1202 the next time the user does something to select a different frame, or | |
1203 until the next time this function is called. (If you are using a | |
1204 window system, the previously selected frame may be restored as the | |
1205 selected frame after return to the command loop, because it still may | |
99763
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
1206 have the window system's input focus.) |
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
1207 |
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
1208 The specified @var{frame} becomes the selected frame, as explained |
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
1209 above, and the terminal that @var{frame} is on becomes the selected |
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
1210 terminal. The window selected within @var{frame} becomes the selected |
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
1211 window. This function returns @var{frame}, or @code{nil} if @var{frame} |
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
1212 has been deleted. |
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
1213 |
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
1214 Optional argument @var{norecord} non-@code{nil} means to neither change |
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
1215 the order of recently selected windows nor the buffer list. @xref{The |
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
1216 Buffer List}. |
84068 | 1217 |
1218 In general, you should never use @code{select-frame} in a way that could | |
1219 switch to a different terminal without switching back when you're done. | |
1220 @end defun | |
1221 | |
1222 Emacs cooperates with the window system by arranging to select frames as | |
1223 the server and window manager request. It does so by generating a | |
1224 special kind of input event, called a @dfn{focus} event, when | |
1225 appropriate. The command loop handles a focus event by calling | |
1226 @code{handle-switch-frame}. @xref{Focus Events}. | |
1227 | |
1228 @deffn Command handle-switch-frame frame | |
1229 This function handles a focus event by selecting frame @var{frame}. | |
1230 | |
1231 Focus events normally do their job by invoking this command. | |
1232 Don't call it for any other reason. | |
1233 @end deffn | |
1234 | |
1235 @defun redirect-frame-focus frame &optional focus-frame | |
1236 This function redirects focus from @var{frame} to @var{focus-frame}. | |
1237 This means that @var{focus-frame} will receive subsequent keystrokes and | |
1238 events intended for @var{frame}. After such an event, the value of | |
1239 @code{last-event-frame} will be @var{focus-frame}. Also, switch-frame | |
1240 events specifying @var{frame} will instead select @var{focus-frame}. | |
1241 | |
1242 If @var{focus-frame} is omitted or @code{nil}, that cancels any existing | |
1243 redirection for @var{frame}, which therefore once again receives its own | |
1244 events. | |
1245 | |
1246 One use of focus redirection is for frames that don't have minibuffers. | |
1247 These frames use minibuffers on other frames. Activating a minibuffer | |
1248 on another frame redirects focus to that frame. This puts the focus on | |
1249 the minibuffer's frame, where it belongs, even though the mouse remains | |
1250 in the frame that activated the minibuffer. | |
1251 | |
1252 Selecting a frame can also change focus redirections. Selecting frame | |
1253 @code{bar}, when @code{foo} had been selected, changes any redirections | |
1254 pointing to @code{foo} so that they point to @code{bar} instead. This | |
1255 allows focus redirection to work properly when the user switches from | |
1256 one frame to another using @code{select-window}. | |
1257 | |
1258 This means that a frame whose focus is redirected to itself is treated | |
1259 differently from a frame whose focus is not redirected. | |
1260 @code{select-frame} affects the former but not the latter. | |
1261 | |
1262 The redirection lasts until @code{redirect-frame-focus} is called to | |
1263 change it. | |
1264 @end defun | |
1265 | |
1266 @defopt focus-follows-mouse | |
1267 This option is how you inform Emacs whether the window manager transfers | |
1268 focus when the user moves the mouse. Non-@code{nil} says that it does. | |
1269 When this is so, the command @code{other-frame} moves the mouse to a | |
99763
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
1270 position consistent with the new selected frame. |
84068 | 1271 @end defopt |
1272 | |
1273 @node Visibility of Frames | |
1274 @section Visibility of Frames | |
1275 @cindex visible frame | |
1276 @cindex invisible frame | |
1277 @cindex iconified frame | |
1278 @cindex frame visibility | |
1279 | |
1280 A window frame may be @dfn{visible}, @dfn{invisible}, or | |
1281 @dfn{iconified}. If it is visible, you can see its contents, unless | |
1282 other windows cover it. If it is iconified, the frame's contents do | |
1283 not appear on the screen, but an icon does. If the frame is | |
1284 invisible, it doesn't show on the screen, not even as an icon. | |
1285 | |
1286 Visibility is meaningless for terminal frames, since only the selected | |
1287 one is actually displayed in any case. | |
1288 | |
1289 @deffn Command make-frame-visible &optional frame | |
1290 This function makes frame @var{frame} visible. If you omit | |
1291 @var{frame}, it makes the selected frame visible. This does not raise | |
1292 the frame, but you can do that with @code{raise-frame} if you wish | |
1293 (@pxref{Raising and Lowering}). | |
1294 @end deffn | |
1295 | |
1296 @deffn Command make-frame-invisible &optional frame force | |
1297 This function makes frame @var{frame} invisible. If you omit | |
1298 @var{frame}, it makes the selected frame invisible. | |
1299 | |
1300 Unless @var{force} is non-@code{nil}, this function refuses to make | |
1301 @var{frame} invisible if all other frames are invisible.. | |
1302 @end deffn | |
1303 | |
1304 @deffn Command iconify-frame &optional frame | |
1305 This function iconifies frame @var{frame}. If you omit @var{frame}, it | |
1306 iconifies the selected frame. | |
1307 @end deffn | |
1308 | |
1309 @defun frame-visible-p frame | |
1310 This returns the visibility status of frame @var{frame}. The value is | |
1311 @code{t} if @var{frame} is visible, @code{nil} if it is invisible, and | |
1312 @code{icon} if it is iconified. | |
1313 | |
1314 On a text-only terminal, all frames are considered visible, whether | |
1315 they are currently being displayed or not, and this function returns | |
1316 @code{t} for all frames. | |
1317 @end defun | |
1318 | |
1319 The visibility status of a frame is also available as a frame | |
1320 parameter. You can read or change it as such. @xref{Management | |
1321 Parameters}. | |
1322 | |
1323 The user can iconify and deiconify frames with the window manager. | |
1324 This happens below the level at which Emacs can exert any control, but | |
1325 Emacs does provide events that you can use to keep track of such | |
1326 changes. @xref{Misc Events}. | |
1327 | |
1328 @node Raising and Lowering | |
1329 @section Raising and Lowering Frames | |
1330 | |
1331 Most window systems use a desktop metaphor. Part of this metaphor is | |
1332 the idea that windows are stacked in a notional third dimension | |
1333 perpendicular to the screen surface, and thus ordered from ``highest'' | |
1334 to ``lowest.'' Where two windows overlap, the one higher up covers | |
1335 the one underneath. Even a window at the bottom of the stack can be | |
1336 seen if no other window overlaps it. | |
1337 | |
1338 @c @cindex raising a frame redundant with raise-frame | |
1339 @cindex lowering a frame | |
1340 A window's place in this ordering is not fixed; in fact, users tend | |
1341 to change the order frequently. @dfn{Raising} a window means moving | |
1342 it ``up,'' to the top of the stack. @dfn{Lowering} a window means | |
1343 moving it to the bottom of the stack. This motion is in the notional | |
1344 third dimension only, and does not change the position of the window | |
1345 on the screen. | |
1346 | |
99763
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
1347 With Emacs, frames constitute the windows in the metaphor sketched |
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
1348 above. You can raise and lower frames using these functions: |
84068 | 1349 |
1350 @deffn Command raise-frame &optional frame | |
1351 This function raises frame @var{frame} (default, the selected frame). | |
1352 If @var{frame} is invisible or iconified, this makes it visible. | |
1353 @end deffn | |
1354 | |
1355 @deffn Command lower-frame &optional frame | |
1356 This function lowers frame @var{frame} (default, the selected frame). | |
1357 @end deffn | |
1358 | |
1359 @defopt minibuffer-auto-raise | |
1360 If this is non-@code{nil}, activation of the minibuffer raises the frame | |
1361 that the minibuffer window is in. | |
1362 @end defopt | |
1363 | |
1364 You can also enable auto-raise (raising automatically when a frame is | |
1365 selected) or auto-lower (lowering automatically when it is deselected) | |
1366 for any frame using frame parameters. @xref{Management Parameters}. | |
1367 | |
1368 @node Frame Configurations | |
1369 @section Frame Configurations | |
1370 @cindex frame configuration | |
1371 | |
1372 A @dfn{frame configuration} records the current arrangement of frames, | |
1373 all their properties, and the window configuration of each one. | |
1374 (@xref{Window Configurations}.) | |
1375 | |
1376 @defun current-frame-configuration | |
1377 This function returns a frame configuration list that describes | |
1378 the current arrangement of frames and their contents. | |
1379 @end defun | |
1380 | |
1381 @defun set-frame-configuration configuration &optional nodelete | |
1382 This function restores the state of frames described in | |
1383 @var{configuration}. However, this function does not restore deleted | |
1384 frames. | |
1385 | |
1386 Ordinarily, this function deletes all existing frames not listed in | |
1387 @var{configuration}. But if @var{nodelete} is non-@code{nil}, the | |
1388 unwanted frames are iconified instead. | |
1389 @end defun | |
1390 | |
1391 @node Mouse Tracking | |
1392 @section Mouse Tracking | |
1393 @cindex mouse tracking | |
1394 @c @cindex tracking the mouse Duplicates track-mouse | |
1395 | |
1396 Sometimes it is useful to @dfn{track} the mouse, which means to display | |
1397 something to indicate where the mouse is and move the indicator as the | |
1398 mouse moves. For efficient mouse tracking, you need a way to wait until | |
1399 the mouse actually moves. | |
1400 | |
1401 The convenient way to track the mouse is to ask for events to represent | |
1402 mouse motion. Then you can wait for motion by waiting for an event. In | |
1403 addition, you can easily handle any other sorts of events that may | |
1404 occur. That is useful, because normally you don't want to track the | |
1405 mouse forever---only until some other event, such as the release of a | |
1406 button. | |
1407 | |
1408 @defspec track-mouse body@dots{} | |
1409 This special form executes @var{body}, with generation of mouse motion | |
99763
742bad2b3aeb
(Frames): Fix typo, add cross references, reword.
Martin Rudalics <rudalics@gmx.at>
parents:
99687
diff
changeset
|
1410 events enabled. Typically, @var{body} would use @code{read-event} to |
84068 | 1411 read the motion events and modify the display accordingly. @xref{Motion |
1412 Events}, for the format of mouse motion events. | |
1413 | |
1414 The value of @code{track-mouse} is that of the last form in @var{body}. | |
1415 You should design @var{body} to return when it sees the up-event that | |
1416 indicates the release of the button, or whatever kind of event means | |
1417 it is time to stop tracking. | |
1418 @end defspec | |
1419 | |
1420 The usual purpose of tracking mouse motion is to indicate on the screen | |
1421 the consequences of pushing or releasing a button at the current | |
1422 position. | |
1423 | |
1424 In many cases, you can avoid the need to track the mouse by using | |
1425 the @code{mouse-face} text property (@pxref{Special Properties}). | |
1426 That works at a much lower level and runs more smoothly than | |
1427 Lisp-level mouse tracking. | |
1428 | |
1429 @ignore | |
1430 @c These are not implemented yet. | |
1431 | |
1432 These functions change the screen appearance instantaneously. The | |
1433 effect is transient, only until the next ordinary Emacs redisplay. That | |
1434 is OK for mouse tracking, since it doesn't make sense for mouse tracking | |
1435 to change the text, and the body of @code{track-mouse} normally reads | |
1436 the events itself and does not do redisplay. | |
1437 | |
1438 @defun x-contour-region window beg end | |
1439 This function draws lines to make a box around the text from @var{beg} | |
1440 to @var{end}, in window @var{window}. | |
1441 @end defun | |
1442 | |
1443 @defun x-uncontour-region window beg end | |
1444 This function erases the lines that would make a box around the text | |
1445 from @var{beg} to @var{end}, in window @var{window}. Use it to remove | |
1446 a contour that you previously made by calling @code{x-contour-region}. | |
1447 @end defun | |
1448 | |
1449 @defun x-draw-rectangle frame left top right bottom | |
1450 This function draws a hollow rectangle on frame @var{frame} with the | |
1451 specified edge coordinates, all measured in pixels from the inside top | |
1452 left corner. It uses the cursor color, the one used for indicating the | |
1453 location of point. | |
1454 @end defun | |
1455 | |
1456 @defun x-erase-rectangle frame left top right bottom | |
1457 This function erases a hollow rectangle on frame @var{frame} with the | |
1458 specified edge coordinates, all measured in pixels from the inside top | |
1459 left corner. Erasure means redrawing the text and background that | |
1460 normally belong in the specified rectangle. | |
1461 @end defun | |
1462 @end ignore | |
1463 | |
1464 @node Mouse Position | |
1465 @section Mouse Position | |
1466 @cindex mouse position | |
1467 @cindex position of mouse | |
1468 | |
1469 The functions @code{mouse-position} and @code{set-mouse-position} | |
1470 give access to the current position of the mouse. | |
1471 | |
1472 @defun mouse-position | |
1473 This function returns a description of the position of the mouse. The | |
1474 value looks like @code{(@var{frame} @var{x} . @var{y})}, where @var{x} | |
1475 and @var{y} are integers giving the position in characters relative to | |
1476 the top left corner of the inside of @var{frame}. | |
1477 @end defun | |
1478 | |
1479 @defvar mouse-position-function | |
1480 If non-@code{nil}, the value of this variable is a function for | |
1481 @code{mouse-position} to call. @code{mouse-position} calls this | |
1482 function just before returning, with its normal return value as the | |
1483 sole argument, and it returns whatever this function returns to it. | |
1484 | |
1485 This abnormal hook exists for the benefit of packages like | |
1486 @file{xt-mouse.el} that need to do mouse handling at the Lisp level. | |
1487 @end defvar | |
1488 | |
1489 @defun set-mouse-position frame x y | |
1490 This function @dfn{warps the mouse} to position @var{x}, @var{y} in | |
1491 frame @var{frame}. The arguments @var{x} and @var{y} are integers, | |
1492 giving the position in characters relative to the top left corner of the | |
1493 inside of @var{frame}. If @var{frame} is not visible, this function | |
1494 does nothing. The return value is not significant. | |
1495 @end defun | |
1496 | |
1497 @defun mouse-pixel-position | |
1498 This function is like @code{mouse-position} except that it returns | |
1499 coordinates in units of pixels rather than units of characters. | |
1500 @end defun | |
1501 | |
1502 @defun set-mouse-pixel-position frame x y | |
1503 This function warps the mouse like @code{set-mouse-position} except that | |
1504 @var{x} and @var{y} are in units of pixels rather than units of | |
1505 characters. These coordinates are not required to be within the frame. | |
1506 | |
1507 If @var{frame} is not visible, this function does nothing. The return | |
1508 value is not significant. | |
1509 @end defun | |
1510 | |
1511 @need 3000 | |
1512 | |
1513 @node Pop-Up Menus | |
1514 @section Pop-Up Menus | |
1515 | |
1516 When using a window system, a Lisp program can pop up a menu so that | |
1517 the user can choose an alternative with the mouse. | |
1518 | |
1519 @defun x-popup-menu position menu | |
1520 This function displays a pop-up menu and returns an indication of | |
1521 what selection the user makes. | |
1522 | |
1523 The argument @var{position} specifies where on the screen to put the | |
1524 top left corner of the menu. It can be either a mouse button event | |
1525 (which says to put the menu where the user actuated the button) or a | |
1526 list of this form: | |
1527 | |
1528 @example | |
1529 ((@var{xoffset} @var{yoffset}) @var{window}) | |
1530 @end example | |
1531 | |
1532 @noindent | |
1533 where @var{xoffset} and @var{yoffset} are coordinates, measured in | |
1534 pixels, counting from the top left corner of @var{window}. @var{window} | |
1535 may be a window or a frame. | |
1536 | |
1537 If @var{position} is @code{t}, it means to use the current mouse | |
1538 position. If @var{position} is @code{nil}, it means to precompute the | |
1539 key binding equivalents for the keymaps specified in @var{menu}, | |
1540 without actually displaying or popping up the menu. | |
1541 | |
1542 The argument @var{menu} says what to display in the menu. It can be a | |
1543 keymap or a list of keymaps (@pxref{Menu Keymaps}). In this case, the | |
1544 return value is the list of events corresponding to the user's choice. | |
1545 (This list has more than one element if the choice occurred in a | |
1546 submenu.) Note that @code{x-popup-menu} does not actually execute the | |
1547 command bound to that sequence of events. | |
1548 | |
1549 Alternatively, @var{menu} can have the following form: | |
1550 | |
1551 @example | |
1552 (@var{title} @var{pane1} @var{pane2}...) | |
1553 @end example | |
1554 | |
1555 @noindent | |
1556 where each pane is a list of form | |
1557 | |
1558 @example | |
1559 (@var{title} @var{item1} @var{item2}...) | |
1560 @end example | |
1561 | |
1562 Each item should normally be a cons cell @code{(@var{line} . @var{value})}, | |
1563 where @var{line} is a string, and @var{value} is the value to return if | |
1564 that @var{line} is chosen. An item can also be a string; this makes a | |
1565 non-selectable line in the menu. | |
1566 | |
1567 If the user gets rid of the menu without making a valid choice, for | |
1568 instance by clicking the mouse away from a valid choice or by typing | |
1569 keyboard input, then this normally results in a quit and | |
1570 @code{x-popup-menu} does not return. But if @var{position} is a mouse | |
1571 button event (indicating that the user invoked the menu with the | |
1572 mouse) then no quit occurs and @code{x-popup-menu} returns @code{nil}. | |
1573 @end defun | |
1574 | |
1575 @strong{Usage note:} Don't use @code{x-popup-menu} to display a menu | |
1576 if you could do the job with a prefix key defined with a menu keymap. | |
1577 If you use a menu keymap to implement a menu, @kbd{C-h c} and @kbd{C-h | |
1578 a} can see the individual items in that menu and provide help for them. | |
1579 If instead you implement the menu by defining a command that calls | |
1580 @code{x-popup-menu}, the help facilities cannot know what happens inside | |
1581 that command, so they cannot give any help for the menu's items. | |
1582 | |
1583 The menu bar mechanism, which lets you switch between submenus by | |
1584 moving the mouse, cannot look within the definition of a command to see | |
1585 that it calls @code{x-popup-menu}. Therefore, if you try to implement a | |
1586 submenu using @code{x-popup-menu}, it cannot work with the menu bar in | |
1587 an integrated fashion. This is why all menu bar submenus are | |
1588 implemented with menu keymaps within the parent menu, and never with | |
1589 @code{x-popup-menu}. @xref{Menu Bar}. | |
1590 | |
1591 If you want a menu bar submenu to have contents that vary, you should | |
1592 still use a menu keymap to implement it. To make the contents vary, add | |
1593 a hook function to @code{menu-bar-update-hook} to update the contents of | |
1594 the menu keymap as necessary. | |
1595 | |
1596 @node Dialog Boxes | |
1597 @section Dialog Boxes | |
1598 @cindex dialog boxes | |
1599 | |
1600 A dialog box is a variant of a pop-up menu---it looks a little | |
1601 different, it always appears in the center of a frame, and it has just | |
1602 one level and one or more buttons. The main use of dialog boxes is | |
1603 for asking questions that the user can answer with ``yes,'' ``no,'' | |
1604 and a few other alternatives. With a single button, they can also | |
1605 force the user to acknowledge important information. The functions | |
1606 @code{y-or-n-p} and @code{yes-or-no-p} use dialog boxes instead of the | |
1607 keyboard, when called from commands invoked by mouse clicks. | |
1608 | |
1609 @defun x-popup-dialog position contents &optional header | |
1610 This function displays a pop-up dialog box and returns an indication of | |
1611 what selection the user makes. The argument @var{contents} specifies | |
1612 the alternatives to offer; it has this format: | |
1613 | |
1614 @example | |
1615 (@var{title} (@var{string} . @var{value})@dots{}) | |
1616 @end example | |
1617 | |
1618 @noindent | |
1619 which looks like the list that specifies a single pane for | |
1620 @code{x-popup-menu}. | |
1621 | |
1622 The return value is @var{value} from the chosen alternative. | |
1623 | |
1624 As for @code{x-popup-menu}, an element of the list may be just a | |
1625 string instead of a cons cell @code{(@var{string} . @var{value})}. | |
1626 That makes a box that cannot be selected. | |
1627 | |
1628 If @code{nil} appears in the list, it separates the left-hand items from | |
1629 the right-hand items; items that precede the @code{nil} appear on the | |
1630 left, and items that follow the @code{nil} appear on the right. If you | |
1631 don't include a @code{nil} in the list, then approximately half the | |
1632 items appear on each side. | |
1633 | |
1634 Dialog boxes always appear in the center of a frame; the argument | |
1635 @var{position} specifies which frame. The possible values are as in | |
1636 @code{x-popup-menu}, but the precise coordinates or the individual | |
1637 window don't matter; only the frame matters. | |
1638 | |
1639 If @var{header} is non-@code{nil}, the frame title for the box is | |
1640 @samp{Information}, otherwise it is @samp{Question}. The former is used | |
1641 for @code{message-box} (@pxref{message-box}). | |
1642 | |
1643 In some configurations, Emacs cannot display a real dialog box; so | |
1644 instead it displays the same items in a pop-up menu in the center of the | |
1645 frame. | |
1646 | |
1647 If the user gets rid of the dialog box without making a valid choice, | |
1648 for instance using the window manager, then this produces a quit and | |
1649 @code{x-popup-dialog} does not return. | |
1650 @end defun | |
1651 | |
1652 @node Pointer Shape | |
1653 @section Pointer Shape | |
1654 @cindex pointer shape | |
1655 @cindex mouse pointer shape | |
1656 | |
1657 You can specify the mouse pointer style for particular text or | |
1658 images using the @code{pointer} text property, and for images with the | |
1659 @code{:pointer} and @code{:map} image properties. The values you can | |
1660 use in these properties are @code{text} (or @code{nil}), @code{arrow}, | |
1661 @code{hand}, @code{vdrag}, @code{hdrag}, @code{modeline}, and | |
1662 @code{hourglass}. @code{text} stands for the usual mouse pointer | |
1663 style used over text. | |
1664 | |
1665 Over void parts of the window (parts that do not correspond to any | |
1666 of the buffer contents), the mouse pointer usually uses the | |
1667 @code{arrow} style, but you can specify a different style (one of | |
1668 those above) by setting @code{void-text-area-pointer}. | |
1669 | |
1670 @defvar void-text-area-pointer | |
1671 This variable specifies the mouse pointer style for void text areas. | |
1672 These include the areas after the end of a line or below the last line | |
1673 in the buffer. The default is to use the @code{arrow} (non-text) | |
1674 pointer style. | |
1675 @end defvar | |
1676 | |
1677 You can specify what the @code{text} pointer style really looks like | |
1678 by setting the variable @code{x-pointer-shape}. | |
1679 | |
1680 @defvar x-pointer-shape | |
1681 This variable specifies the pointer shape to use ordinarily in the | |
1682 Emacs frame, for the @code{text} pointer style. | |
1683 @end defvar | |
1684 | |
1685 @defvar x-sensitive-text-pointer-shape | |
1686 This variable specifies the pointer shape to use when the mouse | |
1687 is over mouse-sensitive text. | |
1688 @end defvar | |
1689 | |
1690 These variables affect newly created frames. They do not normally | |
1691 affect existing frames; however, if you set the mouse color of a | |
1692 frame, that also installs the current value of those two variables. | |
1693 @xref{Color Parameters}. | |
1694 | |
1695 The values you can use, to specify either of these pointer shapes, are | |
1696 defined in the file @file{lisp/term/x-win.el}. Use @kbd{M-x apropos | |
1697 @key{RET} x-pointer @key{RET}} to see a list of them. | |
1698 | |
1699 @node Window System Selections | |
1700 @section Window System Selections | |
1701 @cindex selection (for window systems) | |
1702 | |
1703 The X server records a set of @dfn{selections} which permit transfer of | |
1704 data between application programs. The various selections are | |
1705 distinguished by @dfn{selection types}, represented in Emacs by | |
1706 symbols. X clients including Emacs can read or set the selection for | |
1707 any given type. | |
1708 | |
1709 @deffn Command x-set-selection type data | |
1710 This function sets a ``selection'' in the X server. It takes two | |
1711 arguments: a selection type @var{type}, and the value to assign to it, | |
1712 @var{data}. If @var{data} is @code{nil}, it means to clear out the | |
1713 selection. Otherwise, @var{data} may be a string, a symbol, an integer | |
1714 (or a cons of two integers or list of two integers), an overlay, or a | |
1715 cons of two markers pointing to the same buffer. An overlay or a pair | |
1716 of markers stands for text in the overlay or between the markers. | |
1717 | |
1718 The argument @var{data} may also be a vector of valid non-vector | |
1719 selection values. | |
1720 | |
1721 Each possible @var{type} has its own selection value, which changes | |
1722 independently. The usual values of @var{type} are @code{PRIMARY}, | |
1723 @code{SECONDARY} and @code{CLIPBOARD}; these are symbols with upper-case | |
1724 names, in accord with X Window System conventions. If @var{type} is | |
1725 @code{nil}, that stands for @code{PRIMARY}. | |
1726 | |
1727 This function returns @var{data}. | |
1728 @end deffn | |
1729 | |
1730 @defun x-get-selection &optional type data-type | |
1731 This function accesses selections set up by Emacs or by other X | |
1732 clients. It takes two optional arguments, @var{type} and | |
1733 @var{data-type}. The default for @var{type}, the selection type, is | |
1734 @code{PRIMARY}. | |
1735 | |
1736 The @var{data-type} argument specifies the form of data conversion to | |
1737 use, to convert the raw data obtained from another X client into Lisp | |
1738 data. Meaningful values include @code{TEXT}, @code{STRING}, | |
1739 @code{UTF8_STRING}, @code{TARGETS}, @code{LENGTH}, @code{DELETE}, | |
1740 @code{FILE_NAME}, @code{CHARACTER_POSITION}, @code{NAME}, | |
1741 @code{LINE_NUMBER}, @code{COLUMN_NUMBER}, @code{OWNER_OS}, | |
1742 @code{HOST_NAME}, @code{USER}, @code{CLASS}, @code{ATOM}, and | |
1743 @code{INTEGER}. (These are symbols with upper-case names in accord | |
1744 with X conventions.) The default for @var{data-type} is | |
1745 @code{STRING}. | |
1746 @end defun | |
1747 | |
1748 @cindex cut buffer | |
1749 The X server also has a set of eight numbered @dfn{cut buffers} which can | |
1750 store text or other data being moved between applications. Cut buffers | |
1751 are considered obsolete, but Emacs supports them for the sake of X | |
1752 clients that still use them. Cut buffers are numbered from 0 to 7. | |
1753 | |
1754 @defun x-get-cut-buffer &optional n | |
1755 This function returns the contents of cut buffer number @var{n}. | |
1756 If omitted @var{n} defaults to 0. | |
1757 @end defun | |
1758 | |
1759 @defun x-set-cut-buffer string &optional push | |
1760 @anchor{Definition of x-set-cut-buffer} | |
1761 This function stores @var{string} into the first cut buffer (cut buffer | |
1762 0). If @var{push} is @code{nil}, only the first cut buffer is changed. | |
1763 If @var{push} is non-@code{nil}, that says to move the values down | |
1764 through the series of cut buffers, much like the way successive kills in | |
1765 Emacs move down the kill ring. In other words, the previous value of | |
1766 the first cut buffer moves into the second cut buffer, and the second to | |
1767 the third, and so on through all eight cut buffers. | |
1768 @end defun | |
1769 | |
1770 @defvar selection-coding-system | |
1771 This variable specifies the coding system to use when reading and | |
1772 writing selections or the clipboard. @xref{Coding | |
1773 Systems}. The default is @code{compound-text-with-extensions}, which | |
1774 converts to the text representation that X11 normally uses. | |
1775 @end defvar | |
1776 | |
1777 @cindex clipboard support (for MS-Windows) | |
1778 When Emacs runs on MS-Windows, it does not implement X selections in | |
1779 general, but it does support the clipboard. @code{x-get-selection} | |
1780 and @code{x-set-selection} on MS-Windows support the text data type | |
1781 only; if the clipboard holds other types of data, Emacs treats the | |
1782 clipboard as empty. | |
1783 | |
1784 @defopt x-select-enable-clipboard | |
1785 If this is non-@code{nil}, the Emacs yank functions consult the | |
1786 clipboard before the primary selection, and the kill functions store in | |
1787 the clipboard as well as the primary selection. Otherwise they do not | |
1788 access the clipboard at all. The default is @code{nil} on most systems, | |
97043
9592c50233ab
Remove support for Mac Carbon.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
92098
diff
changeset
|
1789 but @code{t} on MS-Windows. |
84068 | 1790 @end defopt |
1791 | |
1792 @node Drag and Drop | |
1793 @section Drag and Drop | |
1794 | |
1795 @vindex x-dnd-test-function | |
1796 @vindex x-dnd-known-types | |
1797 When a user drags something from another application over Emacs, that other | |
1798 application expects Emacs to tell it if Emacs can handle the data that is | |
1799 dragged. The variable @code{x-dnd-test-function} is used by Emacs to determine | |
1800 what to reply. The default value is @code{x-dnd-default-test-function} | |
1801 which accepts drops if the type of the data to be dropped is present in | |
1802 @code{x-dnd-known-types}. You can customize @code{x-dnd-test-function} and/or | |
1803 @code{x-dnd-known-types} if you want Emacs to accept or reject drops based | |
1804 on some other criteria. | |
1805 | |
1806 @vindex x-dnd-types-alist | |
1807 If you want to change the way Emacs handles drop of different types | |
1808 or add a new type, customize @code{x-dnd-types-alist}. This requires | |
1809 detailed knowledge of what types other applications use for drag and | |
1810 drop. | |
1811 | |
1812 @vindex dnd-protocol-alist | |
1813 When an URL is dropped on Emacs it may be a file, but it may also be | |
1814 another URL type (ftp, http, etc.). Emacs first checks | |
1815 @code{dnd-protocol-alist} to determine what to do with the URL. If | |
1816 there is no match there and if @code{browse-url-browser-function} is | |
1817 an alist, Emacs looks for a match there. If no match is found the | |
1818 text for the URL is inserted. If you want to alter Emacs behavior, | |
1819 you can customize these variables. | |
1820 | |
1821 @node Color Names | |
1822 @section Color Names | |
1823 | |
1824 @cindex color names | |
1825 @cindex specify color | |
1826 @cindex numerical RGB color specification | |
1827 A color name is text (usually in a string) that specifies a color. | |
1828 Symbolic names such as @samp{black}, @samp{white}, @samp{red}, etc., | |
1829 are allowed; use @kbd{M-x list-colors-display} to see a list of | |
1830 defined names. You can also specify colors numerically in forms such | |
1831 as @samp{#@var{rgb}} and @samp{RGB:@var{r}/@var{g}/@var{b}}, where | |
1832 @var{r} specifies the red level, @var{g} specifies the green level, | |
1833 and @var{b} specifies the blue level. You can use either one, two, | |
1834 three, or four hex digits for @var{r}; then you must use the same | |
1835 number of hex digits for all @var{g} and @var{b} as well, making | |
1836 either 3, 6, 9 or 12 hex digits in all. (See the documentation of the | |
1837 X Window System for more details about numerical RGB specification of | |
1838 colors.) | |
1839 | |
1840 These functions provide a way to determine which color names are | |
1841 valid, and what they look like. In some cases, the value depends on the | |
1842 @dfn{selected frame}, as described below; see @ref{Input Focus}, for the | |
1843 meaning of the term ``selected frame.'' | |
1844 | |
98969
5919c911fb16
(Color Names): Add an xref to `read-color'.
Eli Zaretskii <eliz@gnu.org>
parents:
98755
diff
changeset
|
1845 To read user input of color names with completion, use |
5919c911fb16
(Color Names): Add an xref to `read-color'.
Eli Zaretskii <eliz@gnu.org>
parents:
98755
diff
changeset
|
1846 @code{read-color} (@pxref{High-Level Completion, read-color}). |
5919c911fb16
(Color Names): Add an xref to `read-color'.
Eli Zaretskii <eliz@gnu.org>
parents:
98755
diff
changeset
|
1847 |
84068 | 1848 @defun color-defined-p color &optional frame |
1849 This function reports whether a color name is meaningful. It returns | |
1850 @code{t} if so; otherwise, @code{nil}. The argument @var{frame} says | |
1851 which frame's display to ask about; if @var{frame} is omitted or | |
1852 @code{nil}, the selected frame is used. | |
1853 | |
1854 Note that this does not tell you whether the display you are using | |
1855 really supports that color. When using X, you can ask for any defined | |
1856 color on any kind of display, and you will get some result---typically, | |
1857 the closest it can do. To determine whether a frame can really display | |
1858 a certain color, use @code{color-supported-p} (see below). | |
1859 | |
1860 @findex x-color-defined-p | |
1861 This function used to be called @code{x-color-defined-p}, | |
1862 and that name is still supported as an alias. | |
1863 @end defun | |
1864 | |
1865 @defun defined-colors &optional frame | |
1866 This function returns a list of the color names that are defined | |
1867 and supported on frame @var{frame} (default, the selected frame). | |
1868 If @var{frame} does not support colors, the value is @code{nil}. | |
1869 | |
1870 @findex x-defined-colors | |
1871 This function used to be called @code{x-defined-colors}, | |
1872 and that name is still supported as an alias. | |
1873 @end defun | |
1874 | |
1875 @defun color-supported-p color &optional frame background-p | |
1876 This returns @code{t} if @var{frame} can really display the color | |
1877 @var{color} (or at least something close to it). If @var{frame} is | |
1878 omitted or @code{nil}, the question applies to the selected frame. | |
1879 | |
1880 Some terminals support a different set of colors for foreground and | |
1881 background. If @var{background-p} is non-@code{nil}, that means you are | |
1882 asking whether @var{color} can be used as a background; otherwise you | |
1883 are asking whether it can be used as a foreground. | |
1884 | |
1885 The argument @var{color} must be a valid color name. | |
1886 @end defun | |
1887 | |
1888 @defun color-gray-p color &optional frame | |
1889 This returns @code{t} if @var{color} is a shade of gray, as defined on | |
1890 @var{frame}'s display. If @var{frame} is omitted or @code{nil}, the | |
1891 question applies to the selected frame. If @var{color} is not a valid | |
1892 color name, this function returns @code{nil}. | |
1893 @end defun | |
1894 | |
1895 @defun color-values color &optional frame | |
1896 @cindex rgb value | |
1897 This function returns a value that describes what @var{color} should | |
1898 ideally look like on @var{frame}. If @var{color} is defined, the | |
1899 value is a list of three integers, which give the amount of red, the | |
1900 amount of green, and the amount of blue. Each integer ranges in | |
1901 principle from 0 to 65535, but some displays may not use the full | |
1902 range. This three-element list is called the @dfn{rgb values} of the | |
1903 color. | |
1904 | |
1905 If @var{color} is not defined, the value is @code{nil}. | |
1906 | |
1907 @example | |
1908 (color-values "black") | |
1909 @result{} (0 0 0) | |
1910 (color-values "white") | |
1911 @result{} (65280 65280 65280) | |
1912 (color-values "red") | |
1913 @result{} (65280 0 0) | |
1914 (color-values "pink") | |
1915 @result{} (65280 49152 51968) | |
1916 (color-values "hungry") | |
1917 @result{} nil | |
1918 @end example | |
1919 | |
1920 The color values are returned for @var{frame}'s display. If | |
1921 @var{frame} is omitted or @code{nil}, the information is returned for | |
1922 the selected frame's display. If the frame cannot display colors, the | |
1923 value is @code{nil}. | |
1924 | |
1925 @findex x-color-values | |
1926 This function used to be called @code{x-color-values}, | |
1927 and that name is still supported as an alias. | |
1928 @end defun | |
1929 | |
1930 @node Text Terminal Colors | |
1931 @section Text Terminal Colors | |
1932 @cindex colors on text-only terminals | |
1933 | |
1934 Text-only terminals usually support only a small number of colors, | |
1935 and the computer uses small integers to select colors on the terminal. | |
1936 This means that the computer cannot reliably tell what the selected | |
1937 color looks like; instead, you have to inform your application which | |
1938 small integers correspond to which colors. However, Emacs does know | |
1939 the standard set of colors and will try to use them automatically. | |
1940 | |
1941 The functions described in this section control how terminal colors | |
1942 are used by Emacs. | |
1943 | |
1944 Several of these functions use or return @dfn{rgb values}, described | |
1945 in @ref{Color Names}. | |
1946 | |
1947 These functions accept a display (either a frame or the name of a | |
1948 terminal) as an optional argument. We hope in the future to make Emacs | |
1949 support more than one text-only terminal at one time; then this argument | |
1950 will specify which terminal to operate on (the default being the | |
1951 selected frame's terminal; @pxref{Input Focus}). At present, though, | |
1952 the @var{frame} argument has no effect. | |
1953 | |
1954 @defun tty-color-define name number &optional rgb frame | |
1955 This function associates the color name @var{name} with | |
1956 color number @var{number} on the terminal. | |
1957 | |
1958 The optional argument @var{rgb}, if specified, is an rgb value, a list | |
1959 of three numbers that specify what the color actually looks like. | |
1960 If you do not specify @var{rgb}, then this color cannot be used by | |
1961 @code{tty-color-approximate} to approximate other colors, because | |
1962 Emacs will not know what it looks like. | |
1963 @end defun | |
1964 | |
1965 @defun tty-color-clear &optional frame | |
1966 This function clears the table of defined colors for a text-only terminal. | |
1967 @end defun | |
1968 | |
1969 @defun tty-color-alist &optional frame | |
1970 This function returns an alist recording the known colors supported by a | |
1971 text-only terminal. | |
1972 | |
1973 Each element has the form @code{(@var{name} @var{number} . @var{rgb})} | |
1974 or @code{(@var{name} @var{number})}. Here, @var{name} is the color | |
1975 name, @var{number} is the number used to specify it to the terminal. | |
1976 If present, @var{rgb} is a list of three color values (for red, green, | |
1977 and blue) that says what the color actually looks like. | |
1978 @end defun | |
1979 | |
1980 @defun tty-color-approximate rgb &optional frame | |
1981 This function finds the closest color, among the known colors | |
1982 supported for @var{display}, to that described by the rgb value | |
1983 @var{rgb} (a list of color values). The return value is an element of | |
1984 @code{tty-color-alist}. | |
1985 @end defun | |
1986 | |
1987 @defun tty-color-translate color &optional frame | |
1988 This function finds the closest color to @var{color} among the known | |
1989 colors supported for @var{display} and returns its index (an integer). | |
1990 If the name @var{color} is not defined, the value is @code{nil}. | |
1991 @end defun | |
1992 | |
1993 @node Resources | |
1994 @section X Resources | |
1995 | |
1996 @defun x-get-resource attribute class &optional component subclass | |
1997 The function @code{x-get-resource} retrieves a resource value from the X | |
1998 Window defaults database. | |
1999 | |
2000 Resources are indexed by a combination of a @dfn{key} and a @dfn{class}. | |
2001 This function searches using a key of the form | |
2002 @samp{@var{instance}.@var{attribute}} (where @var{instance} is the name | |
2003 under which Emacs was invoked), and using @samp{Emacs.@var{class}} as | |
2004 the class. | |
2005 | |
2006 The optional arguments @var{component} and @var{subclass} add to the key | |
2007 and the class, respectively. You must specify both of them or neither. | |
2008 If you specify them, the key is | |
2009 @samp{@var{instance}.@var{component}.@var{attribute}}, and the class is | |
2010 @samp{Emacs.@var{class}.@var{subclass}}. | |
2011 @end defun | |
2012 | |
2013 @defvar x-resource-class | |
2014 This variable specifies the application name that @code{x-get-resource} | |
2015 should look up. The default value is @code{"Emacs"}. You can examine X | |
2016 resources for application names other than ``Emacs'' by binding this | |
2017 variable to some other string, around a call to @code{x-get-resource}. | |
2018 @end defvar | |
2019 | |
2020 @defvar x-resource-name | |
2021 This variable specifies the instance name that @code{x-get-resource} | |
2022 should look up. The default value is the name Emacs was invoked with, | |
2023 or the value specified with the @samp{-name} or @samp{-rn} switches. | |
2024 @end defvar | |
2025 | |
2026 To illustrate some of the above, suppose that you have the line: | |
2027 | |
2028 @example | |
2029 xterm.vt100.background: yellow | |
2030 @end example | |
2031 | |
2032 @noindent | |
2033 in your X resources file (whose name is usually @file{~/.Xdefaults} | |
2034 or @file{~/.Xresources}). Then: | |
2035 | |
2036 @example | |
2037 @group | |
2038 (let ((x-resource-class "XTerm") (x-resource-name "xterm")) | |
2039 (x-get-resource "vt100.background" "VT100.Background")) | |
2040 @result{} "yellow" | |
2041 @end group | |
2042 @group | |
2043 (let ((x-resource-class "XTerm") (x-resource-name "xterm")) | |
2044 (x-get-resource "background" "VT100" "vt100" "Background")) | |
2045 @result{} "yellow" | |
2046 @end group | |
2047 @end example | |
2048 | |
2049 @xref{X Resources,, X Resources, emacs, The GNU Emacs Manual}. | |
2050 | |
2051 @node Display Feature Testing | |
2052 @section Display Feature Testing | |
2053 @cindex display feature testing | |
2054 | |
2055 The functions in this section describe the basic capabilities of a | |
2056 particular display. Lisp programs can use them to adapt their behavior | |
2057 to what the display can do. For example, a program that ordinarily uses | |
2058 a popup menu could use the minibuffer if popup menus are not supported. | |
2059 | |
2060 The optional argument @var{display} in these functions specifies which | |
2061 display to ask the question about. It can be a display name, a frame | |
2062 (which designates the display that frame is on), or @code{nil} (which | |
2063 refers to the selected frame's display, @pxref{Input Focus}). | |
2064 | |
2065 @xref{Color Names}, @ref{Text Terminal Colors}, for other functions to | |
2066 obtain information about displays. | |
2067 | |
2068 @defun display-popup-menus-p &optional display | |
2069 This function returns @code{t} if popup menus are supported on | |
2070 @var{display}, @code{nil} if not. Support for popup menus requires that | |
2071 the mouse be available, since the user cannot choose menu items without | |
2072 a mouse. | |
2073 @end defun | |
2074 | |
2075 @defun display-graphic-p &optional display | |
2076 This function returns @code{t} if @var{display} is a graphic display | |
2077 capable of displaying several frames and several different fonts at | |
2078 once. This is true for displays that use a window system such as X, and | |
2079 false for text-only terminals. | |
2080 @end defun | |
2081 | |
2082 @defun display-mouse-p &optional display | |
2083 @cindex mouse, availability | |
2084 This function returns @code{t} if @var{display} has a mouse available, | |
2085 @code{nil} if not. | |
2086 @end defun | |
2087 | |
2088 @defun display-color-p &optional display | |
2089 @findex x-display-color-p | |
2090 This function returns @code{t} if the screen is a color screen. | |
2091 It used to be called @code{x-display-color-p}, and that name | |
2092 is still supported as an alias. | |
2093 @end defun | |
2094 | |
2095 @defun display-grayscale-p &optional display | |
2096 This function returns @code{t} if the screen can display shades of gray. | |
2097 (All color displays can do this.) | |
2098 @end defun | |
2099 | |
2100 @defun display-supports-face-attributes-p attributes &optional display | |
2101 @anchor{Display Face Attribute Testing} | |
2102 This function returns non-@code{nil} if all the face attributes in | |
2103 @var{attributes} are supported (@pxref{Face Attributes}). | |
2104 | |
2105 The definition of `supported' is somewhat heuristic, but basically | |
2106 means that a face containing all the attributes in @var{attributes}, | |
2107 when merged with the default face for display, can be represented in a | |
2108 way that's | |
2109 | |
2110 @enumerate | |
2111 @item | |
2112 different in appearance than the default face, and | |
2113 | |
2114 @item | |
2115 `close in spirit' to what the attributes specify, if not exact. | |
2116 @end enumerate | |
2117 | |
2118 Point (2) implies that a @code{:weight black} attribute will be | |
2119 satisfied by any display that can display bold, as will | |
2120 @code{:foreground "yellow"} as long as some yellowish color can be | |
2121 displayed, but @code{:slant italic} will @emph{not} be satisfied by | |
2122 the tty display code's automatic substitution of a `dim' face for | |
2123 italic. | |
2124 @end defun | |
2125 | |
2126 @defun display-selections-p &optional display | |
2127 This function returns @code{t} if @var{display} supports selections. | |
2128 Windowed displays normally support selections, but they may also be | |
2129 supported in some other cases. | |
2130 @end defun | |
2131 | |
2132 @defun display-images-p &optional display | |
2133 This function returns @code{t} if @var{display} can display images. | |
2134 Windowed displays ought in principle to handle images, but some | |
2135 systems lack the support for that. On a display that does not support | |
2136 images, Emacs cannot display a tool bar. | |
2137 @end defun | |
2138 | |
2139 @defun display-screens &optional display | |
2140 This function returns the number of screens associated with the display. | |
2141 @end defun | |
2142 | |
2143 @defun display-pixel-height &optional display | |
2144 This function returns the height of the screen in pixels. | |
2145 On a character terminal, it gives the height in characters. | |
2146 | |
2147 For graphical terminals, note that on ``multi-monitor'' setups this | |
2148 refers to the pixel width for all physical monitors associated with | |
2149 @var{display}. @xref{Multiple Displays}. | |
2150 @end defun | |
2151 | |
2152 @defun display-pixel-width &optional display | |
2153 This function returns the width of the screen in pixels. | |
2154 On a character terminal, it gives the width in characters. | |
2155 | |
2156 For graphical terminals, note that on ``multi-monitor'' setups this | |
2157 refers to the pixel width for all physical monitors associated with | |
2158 @var{display}. @xref{Multiple Displays}. | |
2159 @end defun | |
2160 | |
2161 @defun display-mm-height &optional display | |
2162 This function returns the height of the screen in millimeters, | |
2163 or @code{nil} if Emacs cannot get that information. | |
2164 @end defun | |
2165 | |
2166 @defun display-mm-width &optional display | |
2167 This function returns the width of the screen in millimeters, | |
2168 or @code{nil} if Emacs cannot get that information. | |
2169 @end defun | |
2170 | |
2171 @defvar display-mm-dimensions-alist | |
2172 This variable allows the user to specify the dimensions of graphical | |
2173 displays returned by @code{display-mm-height} and | |
2174 @code{display-mm-width} in case the system provides incorrect values. | |
2175 @end defvar | |
2176 | |
2177 @defun display-backing-store &optional display | |
2178 This function returns the backing store capability of the display. | |
2179 Backing store means recording the pixels of windows (and parts of | |
2180 windows) that are not exposed, so that when exposed they can be | |
2181 displayed very quickly. | |
2182 | |
2183 Values can be the symbols @code{always}, @code{when-mapped}, or | |
2184 @code{not-useful}. The function can also return @code{nil} | |
2185 when the question is inapplicable to a certain kind of display. | |
2186 @end defun | |
2187 | |
2188 @defun display-save-under &optional display | |
2189 This function returns non-@code{nil} if the display supports the | |
2190 SaveUnder feature. That feature is used by pop-up windows | |
2191 to save the pixels they obscure, so that they can pop down | |
2192 quickly. | |
2193 @end defun | |
2194 | |
2195 @defun display-planes &optional display | |
2196 This function returns the number of planes the display supports. | |
2197 This is typically the number of bits per pixel. | |
2198 For a tty display, it is log to base two of the number of colors supported. | |
2199 @end defun | |
2200 | |
2201 @defun display-visual-class &optional display | |
2202 This function returns the visual class for the screen. The value is one | |
2203 of the symbols @code{static-gray}, @code{gray-scale}, | |
2204 @code{static-color}, @code{pseudo-color}, @code{true-color}, and | |
2205 @code{direct-color}. | |
2206 @end defun | |
2207 | |
2208 @defun display-color-cells &optional display | |
2209 This function returns the number of color cells the screen supports. | |
2210 @end defun | |
2211 | |
2212 These functions obtain additional information specifically | |
2213 about X displays. | |
2214 | |
2215 @defun x-server-version &optional display | |
2216 This function returns the list of version numbers of the X server | |
2217 running the display. The value is a list of three integers: the major | |
2218 and minor version numbers of the X protocol, and the | |
2219 distributor-specific release number of the X server software itself. | |
2220 @end defun | |
2221 | |
2222 @defun x-server-vendor &optional display | |
2223 This function returns the ``vendor'' that provided the X server | |
2224 software (as a string). Really this means whoever distributes the X | |
2225 server. | |
2226 | |
2227 When the developers of X labelled software distributors as | |
2228 ``vendors,'' they showed their false assumption that no system could | |
2229 ever be developed and distributed noncommercially. | |
2230 @end defun | |
2231 | |
2232 @ignore | |
2233 @defvar x-no-window-manager | |
2234 This variable's value is @code{t} if no X window manager is in use. | |
2235 @end defvar | |
2236 @end ignore | |
2237 | |
2238 @ignore | |
2239 @item | |
2240 The functions @code{x-pixel-width} and @code{x-pixel-height} return the | |
2241 width and height of an X Window frame, measured in pixels. | |
2242 @end ignore | |
2243 | |
2244 @ignore | |
2245 arch-tag: 94977df6-3dca-4730-b57b-c6329e9282ba | |
2246 @end ignore |