1 This is Info file ../../info/lispref.info, produced by Makeinfo version
2 1.68 from the input file lispref.texi.
4 INFO-DIR-SECTION XEmacs Editor
6 * Lispref: (lispref). XEmacs Lisp Reference Manual.
11 GNU Emacs Lisp Reference Manual Second Edition (v2.01), May 1993 GNU
12 Emacs Lisp Reference Manual Further Revised (v2.02), August 1993 Lucid
13 Emacs Lisp Reference Manual (for 19.10) First Edition, March 1994
14 XEmacs Lisp Programmer's Manual (for 19.12) Second Edition, April 1995
15 GNU Emacs Lisp Reference Manual v2.4, June 1995 XEmacs Lisp
16 Programmer's Manual (for 19.13) Third Edition, July 1995 XEmacs Lisp
17 Reference Manual (for 19.14 and 20.0) v3.1, March 1996 XEmacs Lisp
18 Reference Manual (for 19.15 and 20.1, 20.2, 20.3) v3.2, April, May,
19 November 1997 XEmacs Lisp Reference Manual (for 21.0) v3.3, April 1998
21 Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995 Free Software
22 Foundation, Inc. Copyright (C) 1994, 1995 Sun Microsystems, Inc.
23 Copyright (C) 1995, 1996 Ben Wing.
25 Permission is granted to make and distribute verbatim copies of this
26 manual provided the copyright notice and this permission notice are
27 preserved on all copies.
29 Permission is granted to copy and distribute modified versions of
30 this manual under the conditions for verbatim copying, provided that the
31 entire resulting derived work is distributed under the terms of a
32 permission notice identical to this one.
34 Permission is granted to copy and distribute translations of this
35 manual into another language, under the above conditions for modified
36 versions, except that this permission notice may be stated in a
37 translation approved by the Foundation.
39 Permission is granted to copy and distribute modified versions of
40 this manual under the conditions for verbatim copying, provided also
41 that the section entitled "GNU General Public License" is included
42 exactly as in the original, and provided that the entire resulting
43 derived work is distributed under the terms of a permission notice
44 identical to this one.
46 Permission is granted to copy and distribute translations of this
47 manual into another language, under the above conditions for modified
48 versions, except that the section entitled "GNU General Public License"
49 may be included in a translation approved by the Free Software
50 Foundation instead of in the original English.
53 File: lispref.info, Node: Window Point, Next: Window Start, Prev: Choosing Window, Up: Windows
58 Each window has its own value of point, independent of the value of
59 point in other windows displaying the same buffer. This makes it useful
60 to have multiple windows showing one buffer.
62 * The window point is established when a window is first created; it
63 is initialized from the buffer's point, or from the window point
64 of another window opened on the buffer if such a window exists.
66 * Selecting a window sets the value of point in its buffer to the
67 window's value of point. Conversely, deselecting a window sets
68 the window's value of point from that of the buffer. Thus, when
69 you switch between windows that display a given buffer, the point
70 value for the selected window is in effect in the buffer, while
71 the point values for the other windows are stored in those windows.
73 * As long as the selected window displays the current buffer, the
74 window's point and the buffer's point always move together; they
77 * *Note Positions::, for more details on buffer positions.
79 As far as the user is concerned, point is where the cursor is, and
80 when the user switches to another buffer, the cursor jumps to the
81 position of point in that buffer.
83 - Function: window-point WINDOW
84 This function returns the current position of point in WINDOW.
85 For a nonselected window, this is the value point would have (in
86 that window's buffer) if that window were selected.
88 When WINDOW is the selected window and its buffer is also the
89 current buffer, the value returned is the same as point in that
92 Strictly speaking, it would be more correct to return the
93 "top-level" value of point, outside of any `save-excursion' forms.
94 But that value is hard to find.
96 - Function: set-window-point WINDOW POSITION
97 This function positions point in WINDOW at position POSITION in
101 File: lispref.info, Node: Window Start, Next: Vertical Scrolling, Prev: Window Point, Up: Windows
103 The Window Start Position
104 =========================
106 Each window contains a marker used to keep track of a buffer position
107 that specifies where in the buffer display should start. This position
108 is called the "display-start" position of the window (or just the
109 "start"). The character after this position is the one that appears at
110 the upper left corner of the window. It is usually, but not
111 inevitably, at the beginning of a text line.
113 - Function: window-start &optional WINDOW
114 This function returns the display-start position of window WINDOW.
115 If WINDOW is `nil', the selected window is used. For example,
120 When you create a window, or display a different buffer in it, the
121 display-start position is set to a display-start position recently
122 used for the same buffer, or 1 if the buffer doesn't have any.
124 For a realistic example, see the description of `count-lines' in
127 - Function: window-end &optional WINDOW
128 This function returns the position of the end of the display in
129 window WINDOW. If WINDOW is `nil', the selected window is used.
131 Simply changing the buffer text or moving point does not update the
132 value that `window-end' returns. The value is updated only when
133 Emacs redisplays and redisplay actually finishes.
135 If the last redisplay of WINDOW was preempted, and did not finish,
136 Emacs does not know the position of the end of display in that
137 window. In that case, this function returns a value that is not
138 correct. In a future version, `window-end' will return `nil' in
141 - Function: set-window-start WINDOW POSITION &optional NOFORCE
142 This function sets the display-start position of WINDOW to
143 POSITION in WINDOW's buffer. It returns POSITION.
145 The display routines insist that the position of point be visible
146 when a buffer is displayed. Normally, they change the
147 display-start position (that is, scroll the window) whenever
148 necessary to make point visible. However, if you specify the
149 start position with this function using `nil' for NOFORCE, it
150 means you want display to start at POSITION even if that would put
151 the location of point off the screen. If this does place point
152 off screen, the display routines move point to the left margin on
153 the middle line in the window.
155 For example, if point is 1 and you set the start of the window
156 to 2, then point would be "above" the top of the window. The
157 display routines will automatically move point if it is still 1
158 when redisplay occurs. Here is an example:
160 ;; Here is what `foo' looks like before executing
161 ;; the `set-window-start' expression.
163 ---------- Buffer: foo ----------
164 -!-This is the contents of buffer foo.
170 ---------- Buffer: foo ----------
177 ;; Here is what `foo' looks like after executing
178 ;; the `set-window-start' expression.
179 ---------- Buffer: foo ----------
180 his is the contents of buffer foo.
186 ---------- Buffer: foo ----------
188 If NOFORCE is non-`nil', and POSITION would place point off screen
189 at the next redisplay, then redisplay computes a new window-start
190 position that works well with point, and thus POSITION is not used.
192 - Function: pos-visible-in-window-p &optional POSITION WINDOW
193 This function returns `t' if POSITION is within the range of text
194 currently visible on the screen in WINDOW. It returns `nil' if
195 POSITION is scrolled vertically out of view. The argument
196 POSITION defaults to the current position of point; WINDOW, to the
197 selected window. Here is an example:
199 (or (pos-visible-in-window-p
200 (point) (selected-window))
203 The `pos-visible-in-window-p' function considers only vertical
204 scrolling. If POSITION is out of view only because WINDOW has
205 been scrolled horizontally, `pos-visible-in-window-p' returns `t'.
206 *Note Horizontal Scrolling::.
209 File: lispref.info, Node: Vertical Scrolling, Next: Horizontal Scrolling, Prev: Window Start, Up: Windows
214 Vertical scrolling means moving the text up or down in a window. It
215 works by changing the value of the window's display-start location. It
216 may also change the value of `window-point' to keep it on the screen.
218 In the commands `scroll-up' and `scroll-down', the directions "up"
219 and "down" refer to the motion of the text in the buffer at which you
220 are looking through the window. Imagine that the text is written on a
221 long roll of paper and that the scrolling commands move the paper up
222 and down. Thus, if you are looking at text in the middle of a buffer
223 and repeatedly call `scroll-down', you will eventually see the
224 beginning of the buffer.
226 Some people have urged that the opposite convention be used: they
227 imagine that the window moves over text that remains in place. Then
228 "down" commands would take you to the end of the buffer. This view is
229 more consistent with the actual relationship between windows and the
230 text in the buffer, but it is less like what the user sees. The
231 position of a window on the terminal does not move, and short scrolling
232 commands clearly move the text up or down on the screen. We have chosen
233 names that fit the user's point of view.
235 The scrolling functions (aside from `scroll-other-window') have
236 unpredictable results if the current buffer is different from the buffer
237 that is displayed in the selected window. *Note Current Buffer::.
239 - Command: scroll-up &optional COUNT
240 This function scrolls the text in the selected window upward COUNT
241 lines. If COUNT is negative, scrolling is actually downward.
243 If COUNT is `nil' (or omitted), then the length of scroll is
244 `next-screen-context-lines' lines less than the usable height of
245 the window (not counting its modeline).
247 `scroll-up' returns `nil'.
249 - Command: scroll-down &optional COUNT
250 This function scrolls the text in the selected window downward
251 COUNT lines. If COUNT is negative, scrolling is actually upward.
253 If COUNT is omitted or `nil', then the length of the scroll is
254 `next-screen-context-lines' lines less than the usable height of
255 the window (not counting its mode line).
257 `scroll-down' returns `nil'.
259 - Command: scroll-other-window &optional COUNT
260 This function scrolls the text in another window upward COUNT
261 lines. Negative values of COUNT, or `nil', are handled as in
264 You can specify a buffer to scroll with the variable
265 `other-window-scroll-buffer'. When the selected window is the
266 minibuffer, the next window is normally the one at the top left
267 corner. You can specify a different window to scroll with the
268 variable `minibuffer-scroll-window'. This variable has no effect
269 when any other window is selected. *Note Minibuffer Misc::.
271 When the minibuffer is active, it is the next window if the
272 selected window is the one at the bottom right corner. In this
273 case, `scroll-other-window' attempts to scroll the minibuffer. If
274 the minibuffer contains just one line, it has nowhere to scroll
275 to, so the line reappears after the echo area momentarily displays
276 the message "Beginning of buffer".
278 - Variable: other-window-scroll-buffer
279 If this variable is non-`nil', it tells `scroll-other-window'
280 which buffer to scroll.
282 - User Option: scroll-step
283 This variable controls how scrolling is done automatically when
284 point moves off the screen. If the value is zero, then redisplay
285 scrolls the text to center point vertically in the window. If the
286 value is a positive integer N, then redisplay brings point back on
287 screen by scrolling N lines in either direction, if possible;
288 otherwise, it centers point. The default value is zero.
290 - User Option: scroll-conservatively
291 This variable controls how many lines Emacs tries to scroll before
292 recentering. If you set it to a small number, then when you move
293 point a short distance off the screen, XEmacs will scroll the
294 screen just far enough to bring point back on screen, provided
295 that does not exceed `scroll-conservatively' lines. This variable
296 overrides the redisplay preemption.
298 - User Option: next-screen-context-lines
299 The value of this variable is the number of lines of continuity to
300 retain when scrolling by full screens. For example, `scroll-up'
301 with an argument of `nil' scrolls so that this many lines at the
302 bottom of the window appear instead at the top. The default value
305 - Command: recenter &optional COUNT
306 This function scrolls the selected window to put the text where
307 point is located at a specified vertical position within the
310 If COUNT is a nonnegative number, it puts the line containing
311 point COUNT lines down from the top of the window. If COUNT is a
312 negative number, then it counts upward from the bottom of the
313 window, so that -1 stands for the last usable line in the window.
314 If COUNT is a non-`nil' list, then it stands for the line in the
315 middle of the window.
317 If COUNT is `nil', `recenter' puts the line containing point in
318 the middle of the window, then clears and redisplays the entire
321 When `recenter' is called interactively, COUNT is the raw prefix
322 argument. Thus, typing `C-u' as the prefix sets the COUNT to a
323 non-`nil' list, while typing `C-u 4' sets COUNT to 4, which
324 positions the current line four lines from the top.
326 With an argument of zero, `recenter' positions the current line at
327 the top of the window. This action is so handy that some people
328 make a separate key binding to do this. For example,
330 (defun line-to-top-of-window ()
331 "Scroll current line to top of window.
332 Replaces three keystroke sequence C-u 0 C-l."
336 (global-set-key [kp-multiply] 'line-to-top-of-window)
339 File: lispref.info, Node: Horizontal Scrolling, Next: Size of Window, Prev: Vertical Scrolling, Up: Windows
344 Because we read English first from top to bottom and second from left
345 to right, horizontal scrolling is not like vertical scrolling. Vertical
346 scrolling involves selection of a contiguous portion of text to display.
347 Horizontal scrolling causes part of each line to go off screen. The
348 amount of horizontal scrolling is therefore specified as a number of
349 columns rather than as a position in the buffer. It has nothing to do
350 with the display-start position returned by `window-start'.
352 Usually, no horizontal scrolling is in effect; then the leftmost
353 column is at the left edge of the window. In this state, scrolling to
354 the right is meaningless, since there is no data to the left of the
355 screen to be revealed by it; so this is not allowed. Scrolling to the
356 left is allowed; it scrolls the first columns of text off the edge of
357 the window and can reveal additional columns on the right that were
358 truncated before. Once a window has a nonzero amount of leftward
359 horizontal scrolling, you can scroll it back to the right, but only so
360 far as to reduce the net horizontal scroll to zero. There is no limit
361 to how far left you can scroll, but eventually all the text will
362 disappear off the left edge.
364 - Command: scroll-left COUNT
365 This function scrolls the selected window COUNT columns to the
366 left (or to the right if COUNT is negative). The return value is
367 the total amount of leftward horizontal scrolling in effect after
368 the change--just like the value returned by `window-hscroll'
371 - Command: scroll-right COUNT
372 This function scrolls the selected window COUNT columns to the
373 right (or to the left if COUNT is negative). The return value is
374 the total amount of leftward horizontal scrolling in effect after
375 the change--just like the value returned by `window-hscroll'
378 Once you scroll a window as far right as it can go, back to its
379 normal position where the total leftward scrolling is zero,
380 attempts to scroll any farther right have no effect.
382 - Function: window-hscroll &optional WINDOW
383 This function returns the total leftward horizontal scrolling of
384 WINDOW--the number of columns by which the text in WINDOW is
385 scrolled left past the left margin.
387 The value is never negative. It is zero when no horizontal
388 scrolling has been done in WINDOW (which is usually the case).
390 If WINDOW is `nil', the selected window is used.
399 - Function: set-window-hscroll WINDOW COLUMNS
400 This function sets the number of columns from the left margin that
401 WINDOW is scrolled to the value of COLUMNS. The argument COLUMNS
402 should be zero or positive; if not, it is taken as zero.
404 The value returned is COLUMNS.
406 (set-window-hscroll (selected-window) 10)
409 Here is how you can determine whether a given position POSITION is
410 off the screen due to horizontal scrolling:
412 (defun hscroll-on-screen (window position)
416 (>= (- (current-column) (window-hscroll window)) 0)
417 (< (- (current-column) (window-hscroll window))
418 (window-width window)))))
421 File: lispref.info, Node: Size of Window, Next: Position of Window, Prev: Horizontal Scrolling, Up: Windows
426 An Emacs window is rectangular, and its size information consists of
427 the height (in lines or pixels) and the width (in character positions
428 or pixels). The modeline is included in the height. The pixel width
429 and height values include scrollbars and margins, while the
430 line/character-position values do not.
432 Note that the height in lines, and the width in characters, are
433 determined by dividing the corresponding pixel value by the height or
434 width of the default font in that window (if this is a variable-width
435 font, the average width is used). The resulting values may or may not
436 represent the actual number of lines in the window, or the actual number
437 of character positions in any particular line, esp. if there are pixmaps
438 or various different fonts in the window.
440 The following functions return size information about a window:
442 - Function: window-height &optional WINDOW
443 This function returns the number of lines in WINDOW, including its
444 modeline but not including the horizontal scrollbar, if any (this
445 is different from `window-pixel-height'). If WINDOW is `nil', the
446 function uses the selected window.
450 (split-window-vertically)
451 => #<window on "windows.texi" 0x679b>
455 - Function: window-width &optional WINDOW
456 This function returns the number of columns in WINDOW, not
457 including any left margin, right margin, or vertical scrollbar
458 (this is different from `window-pixel-width'). If WINDOW is
459 `nil', the function uses the selected window.
465 (split-window-horizontally)
466 => #<window on "windows.texi" 0x7538>
470 Note that after splitting the window into two side-by-side windows,
471 the width of each window is less the half the width of the original
472 window because a vertical scrollbar appeared between the windows,
473 occupying two columns worth of space. Also, the height shrunk by one
474 because horizontal scrollbars appeared that weren't there before.
475 (Horizontal scrollbars appear only when lines are truncated, not when
476 they wrap. This is usually the case for horizontally split windows but
477 not for full-frame windows. You can change this using the variables
478 `truncate-lines' and `truncate-partial-width-windows'.)
480 - Function: window-pixel-height &optional WINDOW
481 This function returns the height of WINDOW in pixels, including
482 its modeline and horizontal scrollbar, if any. If WINDOW is
483 `nil', the function uses the selected window.
485 (window-pixel-height)
487 (split-window-vertically)
488 => #<window on "windows.texi" 0x68a6>
489 (window-pixel-height)
492 - Function: window-pixel-width &optional WINDOW
493 This function returns the width of WINDOW in pixels, including any
494 left margin, right margin, or vertical scrollbar that may be
495 displayed alongside it. If WINDOW is `nil', the function uses the
500 (window-pixel-height)
502 (split-window-horizontally)
503 => #<window on "windows.texi" 0x7538>
506 (window-pixel-height)
509 - Function: window-text-area-pixel-height &optional WINDOW
510 This function returns the height in pixels of the text displaying
511 portion of WINDOW, which defaults to the selected window. Unlike
512 `window-pixel-height', the space occupied by the modeline and
513 horizontal scrollbar, if any, is not counted.
515 - Function: window-text-area-pixel-width &optional WINDOW
516 This function returns the width in pixels of the text displaying
517 portion of WINDOW, which defaults to the selected window. Unlike
518 `window-pixel-width', the space occupied by the vertical scrollbar
519 and divider, if any, is not counted.
521 - Function: window-displayed-text-pixel-height &optional WINDOW
523 This function returns the height in pixels of the text displayed in
524 WINDOW, which defaults to the selected window. Unlike
525 `window-text-area-pixel-height', any blank space below the end of
526 the buffer is not included. If optional argument NOCLIPPED is
527 non-`nil', any space occupied by clipped lines will not be
531 File: lispref.info, Node: Position of Window, Next: Resizing Windows, Prev: Size of Window, Up: Windows
533 The Position of a Window
534 ========================
536 XEmacs provides functions to determine the absolute location of
537 windows within a frame, and the relative location of a window in
538 comparison to other windows in the same frame.
540 - Function: window-pixel-edges &optional WINDOW
541 This function returns a list of the pixel edge coordinates of
542 WINDOW. If WINDOW is `nil', the selected window is used.
544 The order of the list is `(LEFT TOP RIGHT BOTTOM)', all elements
545 relative to 0, 0 at the top left corner of the frame. The element
546 RIGHT of the value is one more than the rightmost pixel used by
547 WINDOW (including any left margin, right margin, or vertical
548 scrollbar displayed alongside it), and BOTTOM is one more than the
549 bottommost pixel used by WINDOW (including any modeline or
550 horizontal scrollbar displayed above or below it). The frame area
551 does not include any frame menubars or toolbars that may be
552 displayed; thus, for example, if there is only one window on the
553 frame, the values for LEFT and TOP will always be 0.
555 If WINDOW is at the upper left corner of its frame, RIGHT and
556 BOTTOM are the same as the values returned by
557 `(window-pixel-width)' and `(window-pixel-height)' respectively,
558 and TOP and BOTTOM are zero.
560 There is no longer a function `window-edges' because it does not
561 make sense in a world with variable-width and variable-height lines, as
562 are allowed in XEmacs.
564 - Function: window-highest-p WINDOW
565 This function returns non-`nil' if WINDOW is along the top of its
568 - Function: window-lowest-p WINDOW
569 This function returns non-`nil' if WINDOW is along the bottom of
572 - Function: window-text-area-pixel-edges &optional WINDOW
573 This function allows one to determine the location of the
574 text-displaying portion of WINDOW, which defaults to the selected
575 window, with respect to the top left corner of the window. It
576 returns a list of integer pixel positions `(left top right
577 bottom)', all relative to `(0,0)' at the top left corner of the
581 File: lispref.info, Node: Resizing Windows, Next: Window Configurations, Prev: Position of Window, Up: Windows
583 Changing the Size of a Window
584 =============================
586 The window size functions fall into two classes: high-level commands
587 that change the size of windows and low-level functions that access
588 window size. XEmacs does not permit overlapping windows or gaps between
589 windows, so resizing one window affects other windows.
591 - Command: enlarge-window SIZE &optional HORIZONTAL WINDOW
592 This function makes the selected window SIZE lines taller,
593 stealing lines from neighboring windows. It takes the lines from
594 one window at a time until that window is used up, then takes from
595 another. If a window from which lines are stolen shrinks below
596 `window-min-height' lines, that window disappears.
598 If HORIZONTAL is non-`nil', this function makes WINDOW wider by
599 SIZE columns, stealing columns instead of lines. If a window from
600 which columns are stolen shrinks below `window-min-width' columns,
601 that window disappears.
603 If the requested size would exceed that of the window's frame,
604 then the function makes the window occupy the entire height (or
607 If SIZE is negative, this function shrinks the window by -SIZE
608 lines or columns. If that makes the window smaller than the
609 minimum size (`window-min-height' and `window-min-width'),
610 `enlarge-window' deletes the window.
612 If WINDOW is non-`nil', it specifies a window to change instead of
615 `enlarge-window' returns `nil'.
617 - Command: enlarge-window-horizontally COLUMNS
618 This function makes the selected window COLUMNS wider. It could
619 be defined as follows:
621 (defun enlarge-window-horizontally (columns)
622 (enlarge-window columns t))
624 - Command: enlarge-window-pixels COUNT &optional SIDE WINDOW
625 This function makes the selected window COUNT pixels larger. When
626 called from Lisp, optional second argument SIDE non-`nil' means to
627 grow sideways COUNT pixels, and optional third argument WINDOW
628 specifies the window to change instead of the selected window.
630 - Command: shrink-window SIZE &optional HORIZONTAL WINDOW
631 This function is like `enlarge-window' but negates the argument
632 SIZE, making the selected window smaller by giving lines (or
633 columns) to the other windows. If the window shrinks below
634 `window-min-height' or `window-min-width', then it disappears.
636 If SIZE is negative, the window is enlarged by -SIZE lines or
639 If WINDOW is non-`nil', it specifies a window to change instead of
642 - Command: shrink-window-horizontally COLUMNS
643 This function makes the selected window COLUMNS narrower. It
644 could be defined as follows:
646 (defun shrink-window-horizontally (columns)
647 (shrink-window columns t))
649 - Command: shrink-window-pixels COUNT &optional SIDE WINDOW
650 This function makes the selected window COUNT pixels smaller.
651 When called from Lisp, optional second argument SIDE non-`nil'
652 means to shrink sideways COUNT pixels, and optional third argument
653 WINDOW specifies the window to change instead of the selected
656 The following two variables constrain the window-size-changing
657 functions to a minimum height and width.
659 - User Option: window-min-height
660 The value of this variable determines how short a window may become
661 before it is automatically deleted. Making a window smaller than
662 `window-min-height' automatically deletes it, and no window may be
663 created shorter than this. The absolute minimum height is two
664 (allowing one line for the mode line, and one line for the buffer
665 display). Actions that change window sizes reset this variable to
666 two if it is less than two. The default value is 4.
668 - User Option: window-min-width
669 The value of this variable determines how narrow a window may
670 become before it automatically deleted. Making a window smaller
671 than `window-min-width' automatically deletes it, and no window
672 may be created narrower than this. The absolute minimum width is
673 one; any value below that is ignored. The default value is 10.
675 - Variable: window-size-change-functions
676 This variable holds a list of functions to be called if the size
677 of any window changes for any reason. The functions are called
678 just once per redisplay, and just once for each frame on which
679 size changes have occurred.
681 Each function receives the frame as its sole argument. There is no
682 direct way to find out which windows changed size, or precisely
683 how; however, if your size-change function keeps track, after each
684 change, of the windows that interest you, you can figure out what
685 has changed by comparing the old size data with the new.
687 Creating or deleting windows counts as a size change, and therefore
688 causes these functions to be called. Changing the frame size also
689 counts, because it changes the sizes of the existing windows.
691 It is not a good idea to use `save-window-excursion' in these
692 functions, because that always counts as a size change, and it
693 would cause these functions to be called over and over. In most
694 cases, `save-selected-window' is what you need here.
697 File: lispref.info, Node: Window Configurations, Prev: Resizing Windows, Up: Windows
699 Window Configurations
700 =====================
702 A "window configuration" records the entire layout of a frame--all
703 windows, their sizes, which buffers they contain, what part of each
704 buffer is displayed, and the values of point and the mark. You can
705 bring back an entire previous layout by restoring a window
706 configuration previously saved.
708 If you want to record all frames instead of just one, use a frame
709 configuration instead of a window configuration. *Note Frame
712 - Function: current-window-configuration
713 This function returns a new object representing XEmacs's current
714 window configuration, namely the number of windows, their sizes
715 and current buffers, which window is the selected window, and for
716 each window the displayed buffer, the display-start position, and
717 the positions of point and the mark. An exception is made for
718 point in the current buffer, whose value is not saved.
720 - Function: set-window-configuration CONFIGURATION
721 This function restores the configuration of XEmacs's windows and
722 buffers to the state specified by CONFIGURATION. The argument
723 CONFIGURATION must be a value that was previously returned by
724 `current-window-configuration'.
726 This function always counts as a window size change and triggers
727 execution of the `window-size-change-functions'. (It doesn't know
728 how to tell whether the new configuration actually differs from
731 Here is a way of using this function to get the same effect as
732 `save-window-excursion':
734 (let ((config (current-window-configuration)))
736 (progn (split-window-vertically nil)
738 (set-window-configuration config)))
740 - Special Form: save-window-excursion FORMS...
741 This special form records the window configuration, executes FORMS
742 in sequence, then restores the earlier window configuration. The
743 window configuration includes the value of point and the portion
744 of the buffer that is visible. It also includes the choice of
745 selected window. However, it does not include the value of point
746 in the current buffer; use `save-excursion' if you wish to
749 Don't use this construct when `save-selected-window' is all you
752 Exit from `save-window-excursion' always triggers execution of the
753 `window-size-change-functions'. (It doesn't know how to tell
754 whether the restored configuration actually differs from the one in
755 effect at the end of the FORMS.)
757 The return value is the value of the final form in FORMS. For
761 => #<window 25 on control.texi>
762 (setq w (selected-window))
763 => #<window 19 on control.texi>
764 (save-window-excursion
765 (delete-other-windows w)
766 (switch-to-buffer "foo")
769 ;; The frame is now split again.
771 - Function: window-configuration-p OBJECT
772 This function returns `t' if OBJECT is a window configuration.
774 Primitives to look inside of window configurations would make sense,
775 but none are implemented. It is not clear they are useful enough to be
779 File: lispref.info, Node: Frames, Next: Consoles and Devices, Prev: Windows, Up: Top
784 A FRAME is a rectangle on the screen that contains one or more
785 XEmacs windows. A frame initially contains a single main window (plus
786 perhaps a minibuffer window), which you can subdivide vertically or
787 horizontally into smaller windows.
789 When XEmacs runs on a text-only terminal, it starts with one "TTY
790 frame". If you create additional ones, XEmacs displays one and only
791 one at any given time--on the terminal screen, of course.
793 When XEmacs communicates directly with an X server, it does not have
794 a TTY frame; instead, it starts with a single "X window frame". It can
795 display multiple X window frames at the same time, each in its own X
798 - Function: framep OBJECT
799 This predicate returns `t' if OBJECT is a frame, and `nil'
804 * Creating Frames:: Creating additional frames.
805 * Frame Properties:: Controlling frame size, position, font, etc.
806 * Frame Titles:: Automatic updating of frame titles.
807 * Deleting Frames:: Frames last until explicitly deleted.
808 * Finding All Frames:: How to examine all existing frames.
809 * Frames and Windows:: A frame contains windows;
810 display of text always works through windows.
811 * Minibuffers and Frames:: How a frame finds the minibuffer to use.
812 * Input Focus:: Specifying the selected frame.
813 * Visibility of Frames:: Frames may be visible or invisible, or icons.
814 * Raising and Lowering:: Raising a frame makes it hide other X windows;
815 lowering it makes the others hide them.
816 * Frame Configurations:: Saving the state of all frames.
817 * Frame Hooks:: Hooks for customizing frame behavior.
819 *Note Display::, for related information.
822 File: lispref.info, Node: Creating Frames, Next: Frame Properties, Up: Frames
827 To create a new frame, call the function `make-frame'.
829 - Function: make-frame &optional PROPS DEVICE
830 This function creates a new frame on DEVICE, if DEVICE permits
831 creation of frames. (An X server does; an ordinary terminal does
832 not (yet).) DEVICE defaults to the selected device if omitted.
833 *Note Consoles and Devices::.
835 The argument PROPS is a property list (a list of alternating
836 keyword-value specifications) of properties for the new frame. (An
837 alist is accepted for backward compatibility but should not be
838 passed in.) Any properties not mentioned in PROPS default
839 according to the value of the variable `default-frame-plist'. For
840 X devices, properties not specified in `default-frame-plist'
841 default in turn from `default-x-frame-plist' and, if not specified
842 there, from the X resources. For TTY devices,
843 `default-tty-frame-plist' is consulted as well as
844 `default-frame-plist'.
846 The set of possible properties depends in principle on what kind of
847 window system XEmacs uses to display its frames. *Note X Frame
848 Properties::, for documentation of individual properties you can
849 specify when creating an X window frame.
852 File: lispref.info, Node: Frame Properties, Next: Frame Titles, Prev: Creating Frames, Up: Frames
857 A frame has many properties that control its appearance and behavior.
858 Just what properties a frame has depends on which display mechanism it
861 Frame properties exist for the sake of window systems. A terminal
862 frame has few properties, mostly for compatibility's sake; only the
863 height, width and `buffer-predicate' properties really do something.
867 * Property Access:: How to change a frame's properties.
868 * Initial Properties:: Specifying frame properties when you make a frame.
869 * X Frame Properties:: List of frame properties.
870 * Size and Position:: Changing the size and position of a frame.
871 * Frame Name:: The name of a frame (as opposed to its title).
874 File: lispref.info, Node: Property Access, Next: Initial Properties, Up: Frame Properties
876 Access to Frame Properties
877 --------------------------
879 These functions let you read and change the properties of a frame.
881 - Function: frame-properties &optional FRAME
882 This function returns a plist listing all the properties of FRAME
885 - Function: frame-property FRAME PROPERTY &optional DEFAULT
886 This function returns FRAME's value for the property PROPERTY.
888 - Function: set-frame-properties FRAME PLIST
889 This function alters the properties of frame FRAME based on the
890 elements of property list PLIST. If you don't mention a property
891 in PLIST, its value doesn't change.
893 - Function: set-frame-property FRAME PROP VAL
894 This function sets the property PROP of frame FRAME to the value
898 File: lispref.info, Node: Initial Properties, Next: X Frame Properties, Prev: Property Access, Up: Frame Properties
900 Initial Frame Properties
901 ------------------------
903 You can specify the properties for the initial startup frame by
904 setting `initial-frame-plist' in your `.emacs' file.
906 - Variable: initial-frame-plist
907 This variable's value is a plist of alternating property-value
908 pairs used when creating the initial X window frame.
910 XEmacs creates the initial frame before it reads your `~/.emacs'
911 file. After reading that file, XEmacs checks
912 `initial-frame-plist', and applies the property settings in the
913 altered value to the already created initial frame.
915 If these settings affect the frame geometry and appearance, you'll
916 see the frame appear with the wrong ones and then change to the
917 specified ones. If that bothers you, you can specify the same
918 geometry and appearance with X resources; those do take affect
919 before the frame is created. *Note X Resources: (xemacs)Resources
922 X resource settings typically apply to all frames. If you want to
923 specify some X resources solely for the sake of the initial frame,
924 and you don't want them to apply to subsequent frames, here's how
925 to achieve this: specify properties in `default-frame-plist' to
926 override the X resources for subsequent frames; then, to prevent
927 these from affecting the initial frame, specify the same
928 properties in `initial-frame-plist' with values that match the X
931 If these properties specify a separate minibuffer-only frame via a
932 `minibuffer' property of `nil', and you have not yet created one,
933 XEmacs creates one for you.
935 - Variable: minibuffer-frame-plist
936 This variable's value is a plist of properties used when creating
937 an initial minibuffer-only frame--if such a frame is needed,
938 according to the properties for the main initial frame.
940 - Variable: default-frame-plist
941 This is a plist specifying default values of frame properties for
942 subsequent XEmacs frames (not the initial ones).
944 See also `special-display-frame-plist', in *Note Choosing Window::.
946 If you use options that specify window appearance when you invoke
947 XEmacs, they take effect by adding elements to `default-frame-plist'.
948 One exception is `-geometry', which adds the specified position to
949 `initial-frame-plist' instead. *Note Command Arguments:
950 (xemacs)Command Arguments.
953 File: lispref.info, Node: X Frame Properties, Next: Size and Position, Prev: Initial Properties, Up: Frame Properties
955 X Window Frame Properties
956 -------------------------
958 Just what properties a frame has depends on what display mechanism it
959 uses. Here is a table of the properties of an X window frame; of these,
960 `name', `height', `width', and `buffer-predicate' provide meaningful
961 information in non-X frames.
964 The name of the frame. Most window managers display the frame's
965 name in the frame's border, at the top of the frame. If you don't
966 specify a name, and you have more than one frame, XEmacs sets the
967 frame name based on the buffer displayed in the frame's selected
970 If you specify the frame name explicitly when you create the
971 frame, the name is also used (instead of the name of the XEmacs
972 executable) when looking up X resources for the frame.
975 The display on which to open this frame. It should be a string of
976 the form `"HOST:DPY.SCREEN"', just like the `DISPLAY' environment
980 The screen position of the left edge, in pixels, with respect to
981 the left edge of the screen. The value may be a positive number
982 POS, or a list of the form `(+ POS)' which permits specifying a
985 A negative number -POS, or a list of the form `(- POS)', actually
986 specifies the position of the right edge of the window with
987 respect to the right edge of the screen. A positive value of POS
988 counts toward the left. If the property is a negative integer
989 -POS then POS is positive!
992 The screen position of the top edge, in pixels, with respect to the
993 top edge of the screen. The value may be a positive number POS,
994 or a list of the form `(+ POS)' which permits specifying a
997 A negative number -POS, or a list of the form `(- POS)', actually
998 specifies the position of the bottom edge of the window with
999 respect to the bottom edge of the screen. A positive value of POS
1000 counts toward the top. If the property is a negative integer -POS
1001 then POS is positive!
1004 The screen position of the left edge *of the frame's icon*, in
1005 pixels, counting from the left edge of the screen. This takes
1006 effect if and when the frame is iconified.
1009 The screen position of the top edge *of the frame's icon*, in
1010 pixels, counting from the top edge of the screen. This takes
1011 effect if and when the frame is iconified.
1014 Non-`nil' if the screen position of the frame was explicitly
1015 requested by the user (for example, with the `-geometry' option).
1016 Nothing automatically makes this property non-`nil'; it is up to
1017 Lisp programs that call `make-frame' to specify this property as
1018 well as specifying the `left' and `top' properties.
1021 The height of the frame contents, in characters. (To get the
1022 height in pixels, call `frame-pixel-height'; see *Note Size and
1026 The width of the frame contents, in characters. (To get the
1027 height in pixels, call `frame-pixel-width'; see *Note Size and
1031 The number of the X window for the frame.
1034 Whether this frame has its own minibuffer. The value `t' means
1035 yes, `nil' means no, `only' means this frame is just a minibuffer.
1036 If the value is a minibuffer window (in some other frame), the
1037 new frame uses that minibuffer. (Minibuffer-only and
1038 minibuffer-less frames are not yet implemented in XEmacs.)
1041 The buffer-predicate function for this frame. The function
1042 `other-buffer' uses this predicate (from the selected frame) to
1043 decide which buffers it should consider, if the predicate is not
1044 `nil'. It calls the predicate with one arg, a buffer, once for
1045 each buffer; if the predicate returns a non-`nil' value, it
1046 considers that buffer.
1049 The width of the vertical scroll bar, in pixels.
1052 The color for the cursor that shows point.
1055 The color for the border of the frame.
1058 The width in pixels of the window border.
1060 `internal-border-width'
1061 The distance in pixels between text and border.
1064 If non-`nil', this frame's window is never split automatically.
1067 The space in pixels between adjacent lines of text. (Not currently
1071 Whether the frame has a modeline.
1074 File: lispref.info, Node: Size and Position, Next: Frame Name, Prev: X Frame Properties, Up: Frame Properties
1076 Frame Size And Position
1077 -----------------------
1079 You can read or change the size and position of a frame using the
1080 frame properties `left', `top', `height', and `width'. Whatever
1081 geometry properties you don't specify are chosen by the window manager
1082 in its usual fashion.
1084 Here are some special features for working with sizes and positions:
1086 - Function: set-frame-position FRAME LEFT TOP
1087 This function sets the position of the top left corner of FRAME to
1088 LEFT and TOP. These arguments are measured in pixels, and count
1089 from the top left corner of the screen. Negative property values
1090 count up or rightward from the top left corner of the screen.
1092 - Function: frame-height &optional FRAME
1093 - Function: frame-width &optional FRAME
1094 These functions return the height and width of FRAME, measured in
1095 lines and columns. If you don't supply FRAME, they use the
1098 - Function: frame-pixel-height &optional FRAME
1099 - Function: frame-pixel-width &optional FRAME
1100 These functions return the height and width of FRAME, measured in
1101 pixels. If you don't supply FRAME, they use the selected frame.
1103 - Function: set-frame-size FRAME COLS ROWS &optional PRETEND
1104 This function sets the size of FRAME, measured in characters; COLS
1105 and ROWS specify the new width and height. (If PRETEND is
1106 non-nil, it means that redisplay should act as if the frame's size
1107 is COLS by ROWS, but the actual size of the frame should not be
1108 changed. You should not normally use this option.)
1110 You can also use the functions `set-frame-height' and
1111 `set-frame-width' to set the height and width individually. The frame
1112 is the first argument and the size (in rows or columns) is the second.
1113 (There is an optional third argument, PRETEND, which has the same
1114 purpose as the corresponding argument in `set-frame-size'.)
1117 File: lispref.info, Node: Frame Name, Prev: Size and Position, Up: Frame Properties
1119 The Name of a Frame (As Opposed to Its Title)
1120 ---------------------------------------------
1122 Under X, every frame has a name, which is not the same as the title
1123 of the frame. A frame's name is used to look up its resources and does
1124 not normally change over the lifetime of a frame. It is perfectly
1125 allowable, and quite common, for multiple frames to have the same name.
1127 - Function: frame-name &optional FRAME
1128 This function returns the name of FRAME, which defaults to the
1129 selected frame if not specified. The name of a frame can also be
1130 obtained from the frame's properties. *Note Frame Properties::.
1132 - Variable: default-frame-name
1133 This variable holds the default name to assign to newly-created
1134 frames. This can be overridden by arguments to `make-frame'. This
1138 File: lispref.info, Node: Frame Titles, Next: Deleting Frames, Prev: Frame Properties, Up: Frames
1143 Every frame has a title; most window managers display the frame
1144 title at the top of the frame. You can specify an explicit title with
1145 the `name' frame property. But normally you don't specify this
1146 explicitly, and XEmacs computes the title automatically.
1148 XEmacs computes the frame title based on a template stored in the
1149 variable `frame-title-format'.
1151 - Variable: frame-title-format
1152 This variable specifies how to compute a title for a frame when
1153 you have not explicitly specified one.
1155 The variable's value is actually a modeline construct, just like
1156 `modeline-format'. *Note Modeline Data::.
1158 - Variable: frame-icon-title-format
1159 This variable specifies how to compute the title for an iconified
1160 frame, when you have not explicitly specified the frame title.
1161 This title appears in the icon itself.
1163 - Function: x-set-frame-icon-pixmap FRAME PIXMAP &optional MASK
1164 This function sets the icon of the given frame to the given image
1165 instance, which should be an image instance object (as returned by
1166 `make-image-instance'), a glyph object (as returned by
1167 `make-glyph'), or `nil'. If a glyph object is given, the glyph
1168 will be instantiated on the frame to produce an image instance
1171 If the given image instance has a mask, that will be used as the
1172 icon mask; however, not all window managers support this.
1174 The window manager is also not required to support color pixmaps,
1175 only bitmaps (one plane deep).
1177 If the image instance does not have a mask, then the optional
1178 third argument may be the image instance to use as the mask (it
1179 must be one plane deep). *Note Glyphs::.
1182 File: lispref.info, Node: Deleting Frames, Next: Finding All Frames, Prev: Frame Titles, Up: Frames
1187 Frames remain potentially visible until you explicitly "delete"
1188 them. A deleted frame cannot appear on the screen, but continues to
1189 exist as a Lisp object until there are no references to it.
1191 - Command: delete-frame &optional FRAME
1192 This function deletes the frame FRAME. By default, FRAME is the
1195 - Function: frame-live-p FRAME
1196 The function `frame-live-p' returns non-`nil' if the frame FRAME
1197 has not been deleted.