1 This is ../info/lispref.info, produced by makeinfo version 4.0 from
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 Start, Next: Vertical Scrolling, Prev: Window Point, Up: Windows
55 The Window Start Position
56 =========================
58 Each window contains a marker used to keep track of a buffer position
59 that specifies where in the buffer display should start. This position
60 is called the "display-start" position of the window (or just the
61 "start"). The character after this position is the one that appears at
62 the upper left corner of the window. It is usually, but not
63 inevitably, at the beginning of a text line.
65 - Function: window-start &optional window
66 This function returns the display-start position of window WINDOW.
67 If WINDOW is `nil', the selected window is used. For example,
72 When you create a window, or display a different buffer in it, the
73 display-start position is set to a display-start position recently
74 used for the same buffer, or 1 if the buffer doesn't have any.
76 For a realistic example, see the description of `count-lines' in
79 - Function: window-end &optional window guarantee
80 This function returns the position of the end of the display in
81 window WINDOW. If WINDOW is `nil', the selected window is used.
83 Simply changing the buffer text or setting `window-start' does not
84 update the value that `window-end' returns. The value is updated
85 only when Emacs redisplays and redisplay actually finishes.
87 If the last redisplay of WINDOW was preempted, and did not finish,
88 Emacs does not know the position of the end of display in that
89 window. In that case, this function returns a value that is not
90 correct. In a future version, `window-end' will return `nil' in
93 If optional arg GUARANTEE is non-`nil', the return value is
94 guaranteed to be the same as `window-end' would return at the end
95 of the next full redisplay assuming nothing else changes in the
96 meantime. This function is potentially much slower with this flag
100 - Function: set-window-start window position &optional noforce
101 This function sets the display-start position of WINDOW to
102 POSITION in WINDOW's buffer. It returns POSITION.
104 The display routines insist that the position of point be visible
105 when a buffer is displayed. Normally, they change the
106 display-start position (that is, scroll the window) whenever
107 necessary to make point visible. However, if you specify the
108 start position with this function using `nil' for NOFORCE, it
109 means you want display to start at POSITION even if that would put
110 the location of point off the screen. If this does place point
111 off screen, the display routines move point to the left margin on
112 the middle line in the window.
114 For example, if point is 1 and you set the start of the window
115 to 2, then point would be "above" the top of the window. The
116 display routines will automatically move point if it is still 1
117 when redisplay occurs. Here is an example:
119 ;; Here is what `foo' looks like before executing
120 ;; the `set-window-start' expression.
122 ---------- Buffer: foo ----------
123 -!-This is the contents of buffer foo.
129 ---------- Buffer: foo ----------
136 ;; Here is what `foo' looks like after executing
137 ;; the `set-window-start' expression.
138 ---------- Buffer: foo ----------
139 his is the contents of buffer foo.
145 ---------- Buffer: foo ----------
147 If NOFORCE is non-`nil', and POSITION would place point off screen
148 at the next redisplay, then redisplay computes a new window-start
149 position that works well with point, and thus POSITION is not used.
151 - Function: pos-visible-in-window-p &optional position window
152 This function returns `t' if POSITION is within the range of text
153 currently visible on the screen in WINDOW. It returns `nil' if
154 POSITION is scrolled vertically out of view. The argument
155 POSITION defaults to the current position of point; WINDOW, to the
156 selected window. Here is an example:
158 (or (pos-visible-in-window-p
159 (point) (selected-window))
162 The `pos-visible-in-window-p' function considers only vertical
163 scrolling. If POSITION is out of view only because WINDOW has
164 been scrolled horizontally, `pos-visible-in-window-p' returns `t'.
165 *Note Horizontal Scrolling::.
168 File: lispref.info, Node: Vertical Scrolling, Next: Horizontal Scrolling, Prev: Window Start, Up: Windows
173 Vertical scrolling means moving the text up or down in a window. It
174 works by changing the value of the window's display-start location. It
175 may also change the value of `window-point' to keep it on the screen.
177 In the commands `scroll-up' and `scroll-down', the directions "up"
178 and "down" refer to the motion of the text in the buffer at which you
179 are looking through the window. Imagine that the text is written on a
180 long roll of paper and that the scrolling commands move the paper up
181 and down. Thus, if you are looking at text in the middle of a buffer
182 and repeatedly call `scroll-down', you will eventually see the
183 beginning of the buffer.
185 Some people have urged that the opposite convention be used: they
186 imagine that the window moves over text that remains in place. Then
187 "down" commands would take you to the end of the buffer. This view is
188 more consistent with the actual relationship between windows and the
189 text in the buffer, but it is less like what the user sees. The
190 position of a window on the terminal does not move, and short scrolling
191 commands clearly move the text up or down on the screen. We have chosen
192 names that fit the user's point of view.
194 The scrolling functions (aside from `scroll-other-window') have
195 unpredictable results if the current buffer is different from the buffer
196 that is displayed in the selected window. *Note Current Buffer::.
198 - Command: scroll-up &optional lines
199 This function scrolls the text in the selected window upward LINES
200 lines. If LINES is negative, scrolling is actually downward.
202 If LINES is `nil' (or omitted), then the length of scroll is
203 `next-screen-context-lines' lines less than the usable height of
204 the window (not counting its modeline).
206 `scroll-up' returns `nil'.
208 - Command: scroll-down &optional lines
209 This function scrolls the text in the selected window downward
210 LINES lines. If LINES is negative, scrolling is actually upward.
212 If LINES is omitted or `nil', then the length of the scroll is
213 `next-screen-context-lines' lines less than the usable height of
214 the window (not counting its mode line).
216 `scroll-down' returns `nil'.
218 - Command: scroll-other-window &optional lines
219 This function scrolls the text in another window upward LINES
220 lines. Negative values of LINES, or `nil', are handled as in
223 You can specify a buffer to scroll with the variable
224 `other-window-scroll-buffer'. When the selected window is the
225 minibuffer, the next window is normally the one at the top left
226 corner. You can specify a different window to scroll with the
227 variable `minibuffer-scroll-window'. This variable has no effect
228 when any other window is selected. *Note Minibuffer Misc::.
230 When the minibuffer is active, it is the next window if the
231 selected window is the one at the bottom right corner. In this
232 case, `scroll-other-window' attempts to scroll the minibuffer. If
233 the minibuffer contains just one line, it has nowhere to scroll
234 to, so the line reappears after the echo area momentarily displays
235 the message "Beginning of buffer".
237 - Variable: other-window-scroll-buffer
238 If this variable is non-`nil', it tells `scroll-other-window'
239 which buffer to scroll.
241 - User Option: scroll-step
242 This variable controls how scrolling is done automatically when
243 point moves off the screen. If the value is zero, then redisplay
244 scrolls the text to center point vertically in the window. If the
245 value is a positive integer N, then redisplay brings point back on
246 screen by scrolling N lines in either direction, if possible;
247 otherwise, it centers point. The default value is zero.
249 - User Option: scroll-conservatively
250 This variable controls how many lines Emacs tries to scroll before
251 recentering. If you set it to a small number, then when you move
252 point a short distance off the screen, XEmacs will scroll the
253 screen just far enough to bring point back on screen, provided
254 that does not exceed `scroll-conservatively' lines. This variable
255 overrides the redisplay preemption.
257 - User Option: next-screen-context-lines
258 The value of this variable is the number of lines of continuity to
259 retain when scrolling by full screens. For example, `scroll-up'
260 with an argument of `nil' scrolls so that this many lines at the
261 bottom of the window appear instead at the top. The default value
264 - Command: recenter &optional location window
265 This function scrolls WINDOW (which defaults to the selected
266 window) to put the text where point is located at a specified
267 vertical position within the window.
269 If LOCATION is a nonnegative number, it puts the line containing
270 point LOCATION lines down from the top of the window. If LOCATION
271 is a negative number, then it counts upward from the bottom of the
272 window, so that -1 stands for the last usable line in the window.
273 If LOCATION is a non-`nil' list, then it stands for the line in
274 the middle of the window.
276 If LOCATION is `nil', `recenter' puts the line containing point in
277 the middle of the window, then clears and redisplays the entire
280 When `recenter' is called interactively, LOCATION is the raw
281 prefix argument. Thus, typing `C-u' as the prefix sets the
282 LOCATION to a non-`nil' list, while typing `C-u 4' sets LOCATION
283 to 4, which positions the current line four lines from the top.
285 With an argument of zero, `recenter' positions the current line at
286 the top of the window. This action is so handy that some people
287 make a separate key binding to do this. For example,
289 (defun line-to-top-of-window ()
290 "Scroll current line to top of window.
291 Replaces three keystroke sequence C-u 0 C-l."
295 (global-set-key [kp-multiply] 'line-to-top-of-window)
298 File: lispref.info, Node: Horizontal Scrolling, Next: Size of Window, Prev: Vertical Scrolling, Up: Windows
303 Because we read English first from top to bottom and second from left
304 to right, horizontal scrolling is not like vertical scrolling. Vertical
305 scrolling involves selection of a contiguous portion of text to display.
306 Horizontal scrolling causes part of each line to go off screen. The
307 amount of horizontal scrolling is therefore specified as a number of
308 columns rather than as a position in the buffer. It has nothing to do
309 with the display-start position returned by `window-start'.
311 Usually, no horizontal scrolling is in effect; then the leftmost
312 column is at the left edge of the window. In this state, scrolling to
313 the right is meaningless, since there is no data to the left of the
314 screen to be revealed by it; so this is not allowed. Scrolling to the
315 left is allowed; it scrolls the first columns of text off the edge of
316 the window and can reveal additional columns on the right that were
317 truncated before. Once a window has a nonzero amount of leftward
318 horizontal scrolling, you can scroll it back to the right, but only so
319 far as to reduce the net horizontal scroll to zero. There is no limit
320 to how far left you can scroll, but eventually all the text will
321 disappear off the left edge.
323 - Command: scroll-left &optional count
324 This function scrolls the selected window COUNT columns to the
325 left (or to the right if COUNT is negative). The return value is
326 the total amount of leftward horizontal scrolling in effect after
327 the change--just like the value returned by `window-hscroll'
330 - Command: scroll-right &optional count
331 This function scrolls the selected window COUNT columns to the
332 right (or to the left if COUNT is negative). The return value is
333 the total amount of leftward horizontal scrolling in effect after
334 the change--just like the value returned by `window-hscroll'
337 Once you scroll a window as far right as it can go, back to its
338 normal position where the total leftward scrolling is zero,
339 attempts to scroll any farther right have no effect.
341 - Function: window-hscroll &optional window
342 This function returns the total leftward horizontal scrolling of
343 WINDOW--the number of columns by which the text in WINDOW is
344 scrolled left past the left margin.
346 The value is never negative. It is zero when no horizontal
347 scrolling has been done in WINDOW (which is usually the case).
349 If WINDOW is `nil', the selected window is used.
358 - Function: set-window-hscroll window columns
359 This function sets the number of columns from the left margin that
360 WINDOW is scrolled to the value of COLUMNS. The argument COLUMNS
361 should be zero or positive; if not, it is taken as zero.
363 The value returned is COLUMNS.
365 (set-window-hscroll (selected-window) 10)
368 Here is how you can determine whether a given position POSITION is
369 off the screen due to horizontal scrolling:
371 (defun hscroll-on-screen (window position)
375 (>= (- (current-column) (window-hscroll window)) 0)
376 (< (- (current-column) (window-hscroll window))
377 (window-width window)))))
380 File: lispref.info, Node: Size of Window, Next: Position of Window, Prev: Horizontal Scrolling, Up: Windows
385 An Emacs window is rectangular, and its size information consists of
386 the height (in lines or pixels) and the width (in character positions
387 or pixels). The modeline is included in the height. The pixel width
388 and height values include scrollbars and margins, while the
389 line/character-position values do not.
391 Note that the height in lines, and the width in characters, are
392 determined by dividing the corresponding pixel value by the height or
393 width of the default font in that window (if this is a variable-width
394 font, the average width is used). The resulting values may or may not
395 represent the actual number of lines in the window, or the actual number
396 of character positions in any particular line, esp. if there are pixmaps
397 or various different fonts in the window.
399 The following functions return size information about a window:
401 - Function: window-height &optional window
402 This function returns the number of lines in WINDOW, including its
403 modeline but not including the horizontal scrollbar, if any (this
404 is different from `window-pixel-height'). If WINDOW is `nil', the
405 function uses the selected window.
409 (split-window-vertically)
410 => #<window on "windows.texi" 0x679b>
414 - Function: window-width &optional window
415 This function returns the number of columns in WINDOW, not
416 including any left margin, right margin, or vertical scrollbar
417 (this is different from `window-pixel-width'). If WINDOW is
418 `nil', the function uses the selected window.
424 (split-window-horizontally)
425 => #<window on "windows.texi" 0x7538>
429 Note that after splitting the window into two side-by-side windows,
430 the width of each window is less the half the width of the original
431 window because a vertical scrollbar appeared between the windows,
432 occupying two columns worth of space. Also, the height shrunk by one
433 because horizontal scrollbars appeared that weren't there before.
434 (Horizontal scrollbars appear only when lines are truncated, not when
435 they wrap. This is usually the case for horizontally split windows but
436 not for full-frame windows. You can change this using the variables
437 `truncate-lines' and `truncate-partial-width-windows'.)
439 - Function: window-pixel-height &optional window
440 This function returns the height of WINDOW in pixels, including
441 its modeline and horizontal scrollbar, if any. If WINDOW is
442 `nil', the function uses the selected window.
444 (window-pixel-height)
446 (split-window-vertically)
447 => #<window on "windows.texi" 0x68a6>
448 (window-pixel-height)
451 - Function: window-pixel-width &optional window
452 This function returns the width of WINDOW in pixels, including any
453 left margin, right margin, or vertical scrollbar that may be
454 displayed alongside it. If WINDOW is `nil', the function uses the
459 (window-pixel-height)
461 (split-window-horizontally)
462 => #<window on "windows.texi" 0x7538>
465 (window-pixel-height)
468 - Function: window-text-area-pixel-height &optional window
469 This function returns the height in pixels of the text displaying
470 portion of WINDOW, which defaults to the selected window. Unlike
471 `window-pixel-height', the space occupied by the modeline and
472 horizontal scrollbar, if any, is not counted.
474 - Function: window-text-area-pixel-width &optional window
475 This function returns the width in pixels of the text displaying
476 portion of WINDOW, which defaults to the selected window. Unlike
477 `window-pixel-width', the space occupied by the vertical scrollbar
478 and divider, if any, is not counted.
480 - Function: window-displayed-text-pixel-height &optional window
482 This function returns the height in pixels of the text displayed in
483 WINDOW, which defaults to the selected window. Unlike
484 `window-text-area-pixel-height', any blank space below the end of
485 the buffer is not included. If optional argument NOCLIPPED is
486 non-`nil', any space occupied by clipped lines will not be
490 File: lispref.info, Node: Position of Window, Next: Resizing Windows, Prev: Size of Window, Up: Windows
492 The Position of a Window
493 ========================
495 XEmacs provides functions to determine the absolute location of
496 windows within a frame, and the relative location of a window in
497 comparison to other windows in the same frame.
499 - Function: window-pixel-edges &optional window
500 This function returns a list of the pixel edge coordinates of
501 WINDOW. If WINDOW is `nil', the selected window is used.
503 The order of the list is `(LEFT TOP RIGHT BOTTOM)', all elements
504 relative to 0, 0 at the top left corner of WINDOW's frame. The
505 element RIGHT of the value is one more than the rightmost pixel
506 used by WINDOW (including any left margin, right margin, or
507 vertical scrollbar displayed alongside it), and BOTTOM is one more
508 than the bottommost pixel used by WINDOW (including any modeline
509 or horizontal scrollbar displayed above or below it). The frame
510 area does not include any frame menubars, toolbars, or gutters
511 that may be displayed; thus, for example, if there is only one
512 window on the frame, the values for LEFT and TOP will always be 0.
514 If WINDOW is at the upper left corner of its frame, RIGHT and
515 BOTTOM are the same as the values returned by
516 `(window-pixel-width)' and `(window-pixel-height)' respectively,
517 and LEFT and TOP are zero.
519 There is no longer a function `window-edges' because it does not
520 make sense in a world with variable-width and variable-height lines, as
521 are allowed in XEmacs.
523 - Function: window-highest-p window
524 This function returns non-`nil' if WINDOW is along the top of its
527 - Function: window-lowest-p window
528 This function returns non-`nil' if WINDOW is along the bottom of
531 - Function: window-text-area-pixel-edges &optional window
532 This function allows one to determine the location of the
533 text-displaying portion of WINDOW, which defaults to the selected
534 window, with respect to the top left corner of the window. It
535 returns a list of integer pixel positions `(left top right
536 bottom)', all relative to `(0,0)' at the top left corner of the
540 File: lispref.info, Node: Resizing Windows, Next: Window Configurations, Prev: Position of Window, Up: Windows
542 Changing the Size of a Window
543 =============================
545 The window size functions fall into two classes: high-level commands
546 that change the size of windows and low-level functions that access
547 window size. XEmacs does not permit overlapping windows or gaps between
548 windows, so resizing one window affects other windows.
550 - Command: enlarge-window count &optional horizontal window
551 This function makes the selected window COUNT lines taller,
552 stealing lines from neighboring windows. It takes the lines from
553 one window at a time until that window is used up, then takes from
554 another. If a window from which lines are stolen shrinks below
555 `window-min-height' lines, that window disappears.
557 If HORIZONTAL is non-`nil', this function makes WINDOW wider by
558 COUNT columns, stealing columns instead of lines. If a window
559 from which columns are stolen shrinks below `window-min-width'
560 columns, that window disappears.
562 If the requested size would exceed that of the window's frame,
563 then the function makes the window occupy the entire height (or
566 If COUNT is negative, this function shrinks the window by -COUNT
567 lines or columns. If that makes the window smaller than the
568 minimum size (`window-min-height' and `window-min-width'),
569 `enlarge-window' deletes the window.
571 If WINDOW is non-`nil', it specifies a window to change instead of
574 `enlarge-window' returns `nil'.
576 - Command: enlarge-window-horizontally columns
577 This function makes the selected window COLUMNS wider. It could
578 be defined as follows:
580 (defun enlarge-window-horizontally (columns)
581 (enlarge-window columns t))
583 - Command: enlarge-window-pixels count &optional side window
584 This function makes the selected window COUNT pixels larger. When
585 called from Lisp, optional second argument SIDE non-`nil' means to
586 grow sideways COUNT pixels, and optional third argument WINDOW
587 specifies the window to change instead of the selected window.
589 - Command: shrink-window count &optional horizontal window
590 This function is like `enlarge-window' but negates the argument
591 COUNT, making the selected window smaller by giving lines (or
592 columns) to the other windows. If the window shrinks below
593 `window-min-height' or `window-min-width', then it disappears.
595 If COUNT is negative, the window is enlarged by -COUNT lines or
598 If WINDOW is non-`nil', it specifies a window to change instead of
601 - Command: shrink-window-horizontally columns
602 This function makes the selected window COLUMNS narrower. It
603 could be defined as follows:
605 (defun shrink-window-horizontally (columns)
606 (shrink-window columns t))
608 - Command: shrink-window-pixels count &optional side window
609 This function makes the selected window COUNT pixels smaller.
610 When called from Lisp, optional second argument SIDE non-`nil'
611 means to shrink sideways COUNT pixels, and optional third argument
612 WINDOW specifies the window to change instead of the selected
615 The following two variables constrain the window-size-changing
616 functions to a minimum height and width.
618 - User Option: window-min-height
619 The value of this variable determines how short a window may become
620 before it is automatically deleted. Making a window smaller than
621 `window-min-height' automatically deletes it, and no window may be
622 created shorter than this. The absolute minimum height is two
623 (allowing one line for the mode line, and one line for the buffer
624 display). Actions that change window sizes reset this variable to
625 two if it is less than two. The default value is 4.
627 - User Option: window-min-width
628 The value of this variable determines how narrow a window may
629 become before it automatically deleted. Making a window smaller
630 than `window-min-width' automatically deletes it, and no window
631 may be created narrower than this. The absolute minimum width is
632 one; any value below that is ignored. The default value is 10.
634 - Variable: window-size-change-functions
635 This variable holds a list of functions to be called if the size
636 of any window changes for any reason. The functions are called
637 just once per redisplay, and just once for each frame on which
638 size changes have occurred.
640 Each function receives the frame as its sole argument. There is no
641 direct way to find out which windows changed size, or precisely
642 how; however, if your size-change function keeps track, after each
643 change, of the windows that interest you, you can figure out what
644 has changed by comparing the old size data with the new.
646 Creating or deleting windows counts as a size change, and therefore
647 causes these functions to be called. Changing the frame size also
648 counts, because it changes the sizes of the existing windows.
650 It is not a good idea to use `save-window-excursion' in these
651 functions, because that always counts as a size change, and it
652 would cause these functions to be called over and over. In most
653 cases, `save-selected-window' is what you need here.
656 File: lispref.info, Node: Window Configurations, Prev: Resizing Windows, Up: Windows
658 Window Configurations
659 =====================
661 A "window configuration" records the entire layout of a frame--all
662 windows, their sizes, which buffers they contain, what part of each
663 buffer is displayed, and the values of point and the mark. You can
664 bring back an entire previous layout by restoring a window
665 configuration previously saved.
667 If you want to record all frames instead of just one, use a frame
668 configuration instead of a window configuration. *Note Frame
671 - Function: current-window-configuration &optional frame
672 This function returns a new object representing the current current
673 window configuration of FRAME, namely the number of windows, their
674 sizes and current buffers, which window is the selected window,
675 and for each window the displayed buffer, the display-start
676 position, and the positions of point and the mark. An exception
677 is made for point in the current buffer, whose value is not saved.
679 FRAME defaults to the selected frame.
681 - Function: set-window-configuration configuration
682 This function restores the configuration of XEmacs's windows and
683 buffers to the state specified by CONFIGURATION. The argument
684 CONFIGURATION must be a value that was previously returned by
685 `current-window-configuration'.
687 This function always counts as a window size change and triggers
688 execution of the `window-size-change-functions'. (It doesn't know
689 how to tell whether the new configuration actually differs from
692 Here is a way of using this function to get the same effect as
693 `save-window-excursion':
695 (let ((config (current-window-configuration)))
697 (progn (split-window-vertically nil)
699 (set-window-configuration config)))
701 - Special Form: save-window-excursion forms...
702 This special form records the window configuration, executes FORMS
703 in sequence, then restores the earlier window configuration. The
704 window configuration includes the value of point and the portion
705 of the buffer that is visible. It also includes the choice of
706 selected window. However, it does not include the value of point
707 in the current buffer; use `save-excursion' if you wish to
710 Don't use this construct when `save-selected-window' is all you
713 Exit from `save-window-excursion' always triggers execution of the
714 `window-size-change-functions'. (It doesn't know how to tell
715 whether the restored configuration actually differs from the one in
716 effect at the end of the FORMS.)
718 The return value is the value of the final form in FORMS. For
722 => #<window 25 on control.texi>
723 (setq w (selected-window))
724 => #<window 19 on control.texi>
725 (save-window-excursion
726 (delete-other-windows w)
727 (switch-to-buffer "foo")
730 ;; The frame is now split again.
732 - Function: window-configuration-p object
733 This function returns `t' if OBJECT is a window configuration.
735 Primitives to look inside of window configurations would make sense,
736 but none are implemented. It is not clear they are useful enough to be
740 File: lispref.info, Node: Frames, Next: Consoles and Devices, Prev: Windows, Up: Top
745 A FRAME is a rectangle on the screen that contains one or more
746 XEmacs windows (*note Windows::). A frame initially contains a single
747 main window (plus perhaps an echo area), which you can subdivide
748 vertically or horizontally into smaller windows. Each window is
749 associated with a modeline (*note Modeline Format::), and optionally two
750 scrollbars (*note Scrollbars::). By default the vertical scrollbar is
751 on, the horizontal scrollbar is off.
753 The frame may also contain menubars (*note Menubar::), toolbars
754 (*note Toolbar Intro::), and gutters (*note Gutter Intro::). By default
755 there is one of each at the top of the frame, with menubar topmost,
756 toolbar next, and gutter lowest, immediately above the windows.
757 (Warning: the gutter is a new, experimental, and unstable feature of
758 XEmacs version 21.2.)
760 When XEmacs runs on a text-only terminal, it starts with one "TTY
761 frame". If you create additional ones, XEmacs displays one and only
762 one at any given time--on the terminal screen, of course.
764 When XEmacs communicates directly with an X server, it does not have
765 a TTY frame; instead, it starts with a single "X window frame". It can
766 display multiple X window frames at the same time, each in its own X
769 - Function: framep object
770 This predicate returns `t' if OBJECT is a frame, and `nil'
775 * Creating Frames:: Creating additional frames.
776 * Frame Properties:: Controlling frame size, position, font, etc.
777 * Frame Titles:: Automatic updating of frame titles.
778 * Deleting Frames:: Frames last until explicitly deleted.
779 * Finding All Frames:: How to examine all existing frames.
780 * Frames and Windows:: A frame contains windows;
781 display of text always works through windows.
782 * Minibuffers and Frames:: How a frame finds the minibuffer to use.
783 * Input Focus:: Specifying the selected frame.
784 * Visibility of Frames:: Frames may be visible or invisible, or icons.
785 * Raising and Lowering:: Raising a frame makes it hide other X windows;
786 lowering it makes the others hide them.
787 * Frame Configurations:: Saving the state of all frames.
788 * Frame Hooks:: Hooks for customizing frame behavior.
790 *Note Display::, for related information.
793 File: lispref.info, Node: Creating Frames, Next: Frame Properties, Up: Frames
798 To create a new frame, call the function `make-frame'.
800 - Command: make-frame &optional props device
801 This function creates a new frame on DEVICE, if DEVICE permits
802 creation of frames. (An X server does; an ordinary terminal does
803 not (yet).) DEVICE defaults to the selected device if omitted.
804 *Note Consoles and Devices::.
806 The argument PROPS is a property list (a list of alternating
807 keyword-value specifications) of properties for the new frame. (An
808 alist is accepted for backward compatibility but should not be
809 passed in.) Any properties not mentioned in PROPS default
810 according to the value of the variable `default-frame-plist'. For
811 X devices, properties not specified in `default-frame-plist'
812 default in turn from `default-x-frame-plist' and, if not specified
813 there, from the X resources. For TTY devices,
814 `default-tty-frame-plist' is consulted as well as
815 `default-frame-plist'.
817 The set of possible properties depends in principle on what kind of
818 window system XEmacs uses to display its frames. *Note X Frame
819 Properties::, for documentation of individual properties you can
820 specify when creating an X window frame.
823 File: lispref.info, Node: Frame Properties, Next: Frame Titles, Prev: Creating Frames, Up: Frames
828 A frame has many properties that control its appearance and behavior.
829 Just what properties a frame has depends on which display mechanism it
832 Frame properties exist for the sake of window systems. A terminal
833 frame has few properties, mostly for compatibility's sake; only the
834 height, width and `buffer-predicate' properties really do something.
838 * Property Access:: How to change a frame's properties.
839 * Initial Properties:: Specifying frame properties when you make a frame.
840 * X Frame Properties:: List of frame properties.
841 * Size and Position:: Changing the size and position of a frame.
842 * Frame Name:: The name of a frame (as opposed to its title).
845 File: lispref.info, Node: Property Access, Next: Initial Properties, Up: Frame Properties
847 Access to Frame Properties
848 --------------------------
850 These functions let you read and change the properties of a frame.
852 - Function: frame-properties &optional frame
853 This function returns a plist listing all the properties of FRAME
856 - Function: frame-property frame property &optional default
857 This function returns FRAME's value for the property PROPERTY, or
858 DEFAULT if there is no such property.
860 - Function: set-frame-properties frame plist
861 This function alters the properties of frame FRAME based on the
862 elements of property list PLIST. If you don't mention a property
863 in PLIST, its value doesn't change.
865 - Function: set-frame-property frame property value
866 This function sets the property PROPERTY of frame FRAME to the
870 File: lispref.info, Node: Initial Properties, Next: X Frame Properties, Prev: Property Access, Up: Frame Properties
872 Initial Frame Properties
873 ------------------------
875 You can specify the properties for the initial startup frame by
876 setting `initial-frame-plist' in your `.emacs' file.
878 - Variable: initial-frame-plist
879 This variable's value is a plist of alternating property-value
880 pairs used when creating the initial X window frame.
882 XEmacs creates the initial frame before it reads your `~/.emacs'
883 file. After reading that file, XEmacs checks
884 `initial-frame-plist', and applies the property settings in the
885 altered value to the already created initial frame.
887 If these settings affect the frame geometry and appearance, you'll
888 see the frame appear with the wrong ones and then change to the
889 specified ones. If that bothers you, you can specify the same
890 geometry and appearance with X resources; those do take affect
891 before the frame is created. *Note X Resources: (xemacs)Resources
894 X resource settings typically apply to all frames. If you want to
895 specify some X resources solely for the sake of the initial frame,
896 and you don't want them to apply to subsequent frames, here's how
897 to achieve this: specify properties in `default-frame-plist' to
898 override the X resources for subsequent frames; then, to prevent
899 these from affecting the initial frame, specify the same
900 properties in `initial-frame-plist' with values that match the X
903 If these properties specify a separate minibuffer-only frame via a
904 `minibuffer' property of `nil', and you have not yet created one,
905 XEmacs creates one for you.
907 - Variable: minibuffer-frame-plist
908 This variable's value is a plist of properties used when creating
909 an initial minibuffer-only frame--if such a frame is needed,
910 according to the properties for the main initial frame.
912 - Variable: default-frame-plist
913 This is a plist specifying default values of frame properties for
914 subsequent XEmacs frames (not the initial ones).
916 See also `special-display-frame-plist', in *Note Choosing Window::.
918 If you use options that specify window appearance when you invoke
919 XEmacs, they take effect by adding elements to `default-frame-plist'.
920 One exception is `-geometry', which adds the specified position to
921 `initial-frame-plist' instead. *Note Command Arguments:
922 (xemacs)Command Arguments.
925 File: lispref.info, Node: X Frame Properties, Next: Size and Position, Prev: Initial Properties, Up: Frame Properties
927 X Window Frame Properties
928 -------------------------
930 Just what properties a frame has depends on what display mechanism it
931 uses. Here is a table of the properties of an X window frame; of these,
932 `name', `height', `width', and `buffer-predicate' provide meaningful
933 information in non-X frames.
936 The name of the frame. Most window managers display the frame's
937 name in the frame's border, at the top of the frame. If you don't
938 specify a name, and you have more than one frame, XEmacs sets the
939 frame name based on the buffer displayed in the frame's selected
942 If you specify the frame name explicitly when you create the
943 frame, the name is also used (instead of the name of the XEmacs
944 executable) when looking up X resources for the frame.
947 The display on which to open this frame. It should be a string of
948 the form `"HOST:DPY.SCREEN"', just like the `DISPLAY' environment
952 The screen position of the left edge, in pixels, with respect to
953 the left edge of the screen. The value may be a positive number
954 POS, or a list of the form `(+ POS)' which permits specifying a
957 A negative number -POS, or a list of the form `(- POS)', actually
958 specifies the position of the right edge of the window with
959 respect to the right edge of the screen. A positive value of POS
960 counts toward the left. If the property is a negative integer
961 -POS then POS is positive!
964 The screen position of the top edge, in pixels, with respect to the
965 top edge of the screen. The value may be a positive number POS,
966 or a list of the form `(+ POS)' which permits specifying a
969 A negative number -POS, or a list of the form `(- POS)', actually
970 specifies the position of the bottom edge of the window with
971 respect to the bottom edge of the screen. A positive value of POS
972 counts toward the top. If the property is a negative integer -POS
973 then POS is positive!
976 The screen position of the left edge _of the frame's icon_, in
977 pixels, counting from the left edge of the screen. This takes
978 effect if and when the frame is iconified.
981 The screen position of the top edge _of the frame's icon_, in
982 pixels, counting from the top edge of the screen. This takes
983 effect if and when the frame is iconified.
986 Non-`nil' if the screen position of the frame was explicitly
987 requested by the user (for example, with the `-geometry' option).
988 Nothing automatically makes this property non-`nil'; it is up to
989 Lisp programs that call `make-frame' to specify this property as
990 well as specifying the `left' and `top' properties.
993 The height of the frame contents, in characters. (To get the
994 height in pixels, call `frame-pixel-height'; see *Note Size and
998 The width of the frame contents, in characters. (To get the
999 height in pixels, call `frame-pixel-width'; see *Note Size and
1003 The number of the X window for the frame.
1006 Whether this frame has its own minibuffer. The value `t' means
1007 yes, `nil' means no, `only' means this frame is just a minibuffer.
1008 If the value is a minibuffer window (in some other frame), the
1009 new frame uses that minibuffer. (Minibuffer-only and
1010 minibuffer-less frames are not yet implemented in XEmacs.)
1013 The buffer-predicate function for this frame. The function
1014 `other-buffer' uses this predicate (from the selected frame) to
1015 decide which buffers it should consider, if the predicate is not
1016 `nil'. It calls the predicate with one arg, a buffer, once for
1017 each buffer; if the predicate returns a non-`nil' value, it
1018 considers that buffer.
1021 The width of the vertical scroll bar, in pixels.
1024 The color for the cursor that shows point.
1027 The color for the border of the frame.
1030 The width in pixels of the window border.
1032 `internal-border-width'
1033 The distance in pixels between text and border.
1036 If non-`nil', this frame's window is never split automatically.
1039 The space in pixels between adjacent lines of text. (Not currently
1043 Whether the frame has a modeline.
1046 File: lispref.info, Node: Size and Position, Next: Frame Name, Prev: X Frame Properties, Up: Frame Properties
1048 Frame Size And Position
1049 -----------------------
1051 You can read or change the size and position of a frame using the
1052 frame properties `left', `top', `height', and `width'. Whatever
1053 geometry properties you don't specify are chosen by the window manager
1054 in its usual fashion.
1056 Here are some special features for working with sizes and positions:
1058 - Function: set-frame-position frame left top
1059 This function sets the position of the top left corner of FRAME to
1060 LEFT and TOP. These arguments are measured in pixels, and count
1061 from the top left corner of the screen. Negative property values
1062 count up or rightward from the top left corner of the screen.
1064 - Function: frame-height &optional frame
1065 - Function: frame-width &optional frame
1066 These functions return the height and width of FRAME, measured in
1067 lines and columns. If you don't supply FRAME, they use the
1070 - Function: frame-pixel-height &optional frame
1071 - Function: frame-pixel-width &optional frame
1072 These functions return the height and width of FRAME, measured in
1073 pixels. If you don't supply FRAME, they use the selected frame.
1075 - Function: set-frame-size frame cols rows &optional pretend
1076 This function sets the size of FRAME, measured in characters; COLS
1077 and ROWS specify the new width and height. (If PRETEND is
1078 non-`nil', it means that redisplay should act as if the frame's
1079 size is COLS by ROWS, but the actual size of the frame should not
1080 be changed. You should not normally use this option.)
1082 You can also use the functions `set-frame-height' and
1083 `set-frame-width' to set the height and width individually. The frame
1084 is the first argument and the size (in rows or columns) is the second.
1085 (There is an optional third argument, PRETEND, which has the same
1086 purpose as the corresponding argument in `set-frame-size'.)
1089 File: lispref.info, Node: Frame Name, Prev: Size and Position, Up: Frame Properties
1091 The Name of a Frame (As Opposed to Its Title)
1092 ---------------------------------------------
1094 Under X, every frame has a name, which is not the same as the title
1095 of the frame. A frame's name is used to look up its resources and does
1096 not normally change over the lifetime of a frame. It is perfectly
1097 allowable, and quite common, for multiple frames to have the same name.
1099 - Function: frame-name &optional frame
1100 This function returns the name of FRAME, which defaults to the
1101 selected frame if not specified. The name of a frame can also be
1102 obtained from the frame's properties. *Note Frame Properties::.
1104 - Variable: default-frame-name
1105 This variable holds the default name to assign to newly-created
1106 frames. This can be overridden by arguments to `make-frame'. This
1110 File: lispref.info, Node: Frame Titles, Next: Deleting Frames, Prev: Frame Properties, Up: Frames
1115 Every frame has a title; most window managers display the frame
1116 title at the top of the frame. You can specify an explicit title with
1117 the `name' frame property. But normally you don't specify this
1118 explicitly, and XEmacs computes the title automatically.
1120 XEmacs computes the frame title based on a template stored in the
1121 variable `frame-title-format'.
1123 - Variable: frame-title-format
1124 This variable specifies how to compute a title for a frame when
1125 you have not explicitly specified one.
1127 The variable's value is actually a modeline construct, just like
1128 `modeline-format'. *Note Modeline Data::.
1130 - Variable: frame-icon-title-format
1131 This variable specifies how to compute the title for an iconified
1132 frame, when you have not explicitly specified the frame title.
1133 This title appears in the icon itself.
1135 - Function: x-set-frame-icon-pixmap frame pixmap &optional mask
1136 This function sets the icon of the given frame to the given image
1137 instance, which should be an image instance object (as returned by
1138 `make-image-instance'), a glyph object (as returned by
1139 `make-glyph'), or `nil'. If a glyph object is given, the glyph
1140 will be instantiated on the frame to produce an image instance
1143 If the given image instance has a mask, that will be used as the
1144 icon mask; however, not all window managers support this.
1146 The window manager is also not required to support color pixmaps,
1147 only bitmaps (one plane deep).
1149 If the image instance does not have a mask, then the optional
1150 third argument may be the image instance to use as the mask (it
1151 must be one plane deep). *Note Glyphs::.
1154 File: lispref.info, Node: Deleting Frames, Next: Finding All Frames, Prev: Frame Titles, Up: Frames
1159 Frames remain potentially visible until you explicitly "delete"
1160 them. A deleted frame cannot appear on the screen, but continues to
1161 exist as a Lisp object until there are no references to it.
1163 - Command: delete-frame &optional frame force
1164 This function deletes the frame FRAME. By default, FRAME is the
1167 A frame may not be deleted if its minibuffer is used by other
1168 frames. Normally, you cannot delete the last non-minibuffer-only
1169 frame (you must use `save-buffers-kill-emacs' or `kill-emacs').
1170 However, if optional second argument FORCE is non-`nil', you can
1171 delete the last frame. (This will automatically call
1172 `save-buffers-kill-emacs'.)
1174 - Function: frame-live-p frame
1175 The function `frame-live-p' returns non-`nil' if the frame FRAME
1176 has not been deleted.