This commit was generated by cvs2svn to compensate for changes in r6453,
[chise/xemacs-chise.git.1] / info / lispref.info-26
1 This is Info file ../../info/lispref.info, produced by Makeinfo version
2 1.68 from the input file lispref.texi.
3
4 INFO-DIR-SECTION XEmacs Editor
5 START-INFO-DIR-ENTRY
6 * Lispref: (lispref).           XEmacs Lisp Reference Manual.
7 END-INFO-DIR-ENTRY
8
9    Edition History:
10
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
20
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.
24
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.
28
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.
33
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.
38
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.
45
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.
51
52 \1f
53 File: lispref.info,  Node: Window Point,  Next: Window Start,  Prev: Choosing Window,  Up: Windows
54
55 Windows and Point
56 =================
57
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.
61
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.
65
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.
72
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
75      remain equal.
76
77    * *Note Positions::, for more details on buffer positions.
78
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.
82
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.
87
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
90      buffer.
91
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.
95
96  - Function: set-window-point WINDOW POSITION
97      This function positions point in WINDOW at position POSITION in
98      WINDOW's buffer.
99
100 \1f
101 File: lispref.info,  Node: Window Start,  Next: Vertical Scrolling,  Prev: Window Point,  Up: Windows
102
103 The Window Start Position
104 =========================
105
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.
112
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,
116
117           (window-start)
118                => 7058
119
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.
123
124      For a realistic example, see the description of `count-lines' in
125      *Note Text Lines::.
126
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.
130
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.
134
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
139      that case.
140
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.
144
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.
154
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:
159
160           ;; Here is what `foo' looks like before executing
161           ;;   the `set-window-start' expression.
162           
163           ---------- Buffer: foo ----------
164           -!-This is the contents of buffer foo.
165           2
166           3
167           4
168           5
169           6
170           ---------- Buffer: foo ----------
171           
172           (set-window-start
173            (selected-window)
174            (1+ (window-start)))
175           => 2
176           
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.
181           2
182           3
183           -!-4
184           5
185           6
186           ---------- Buffer: foo ----------
187
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.
191
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:
198
199           (or (pos-visible-in-window-p
200                (point) (selected-window))
201               (recenter 0))
202
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::.
207
208 \1f
209 File: lispref.info,  Node: Vertical Scrolling,  Next: Horizontal Scrolling,  Prev: Window Start,  Up: Windows
210
211 Vertical Scrolling
212 ==================
213
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.
217
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.
225
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.
234
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::.
238
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.
242
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).
246
247      `scroll-up' returns `nil'.
248
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.
252
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).
256
257      `scroll-down' returns `nil'.
258
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
262      `scroll-up'.
263
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::.
270
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".
277
278  - Variable: other-window-scroll-buffer
279      If this variable is non-`nil', it tells `scroll-other-window'
280      which buffer to scroll.
281
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.
289
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.
297
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
303      is `2'.
304
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
308      window.
309
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.
316
317      If COUNT is `nil', `recenter' puts the line containing point in
318      the middle of the window, then clears and redisplays the entire
319      selected frame.
320
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.
325
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,
329
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."
333             (interactive)
334             (recenter 0))
335           
336           (global-set-key [kp-multiply] 'line-to-top-of-window)
337
338 \1f
339 File: lispref.info,  Node: Horizontal Scrolling,  Next: Size of Window,  Prev: Vertical Scrolling,  Up: Windows
340
341 Horizontal Scrolling
342 ====================
343
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'.
351
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.
363
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'
369      (below).
370
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'
376      (below).
377
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.
381
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.
386
387      The value is never negative.  It is zero when no horizontal
388      scrolling has been done in WINDOW (which is usually the case).
389
390      If WINDOW is `nil', the selected window is used.
391
392           (window-hscroll)
393                => 0
394           (scroll-left 5)
395                => 5
396           (window-hscroll)
397                => 5
398
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.
403
404      The value returned is COLUMNS.
405
406           (set-window-hscroll (selected-window) 10)
407                => 10
408
409    Here is how you can determine whether a given position POSITION is
410 off the screen due to horizontal scrolling:
411
412      (defun hscroll-on-screen (window position)
413        (save-excursion
414          (goto-char position)
415          (and
416           (>= (- (current-column) (window-hscroll window)) 0)
417           (< (- (current-column) (window-hscroll window))
418              (window-width window)))))
419
420 \1f
421 File: lispref.info,  Node: Size of Window,  Next: Position of Window,  Prev: Horizontal Scrolling,  Up: Windows
422
423 The Size of a Window
424 ====================
425
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.
431
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.
439
440    The following functions return size information about a window:
441
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.
447
448           (window-height)
449                => 40
450           (split-window-vertically)
451                => #<window on "windows.texi" 0x679b>
452           (window-height)
453                => 20
454
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.
460
461           (window-width)
462                => 80
463           (window-height)
464                => 40
465           (split-window-horizontally)
466                => #<window on "windows.texi" 0x7538>
467           (window-width)
468                => 39
469
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'.)
479
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.
484
485           (window-pixel-height)
486                => 600
487           (split-window-vertically)
488                => #<window on "windows.texi" 0x68a6>
489           (window-pixel-height)
490                => 300
491
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
496      selected window.
497
498           (window-pixel-width)
499                => 735
500           (window-pixel-height)
501                => 600
502           (split-window-horizontally)
503                => #<window on "windows.texi" 0x7538>
504           (window-pixel-width)
505                => 367
506           (window-pixel-height)
507                => 600
508
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.
514
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.
520
521  - Function: window-displayed-text-pixel-height &optional WINDOW
522           NOCLIPPED
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
528      included.
529
530 \1f
531 File: lispref.info,  Node: Position of Window,  Next: Resizing Windows,  Prev: Size of Window,  Up: Windows
532
533 The Position of a Window
534 ========================
535
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.
539
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.
543
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.
554
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.
559
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.
563
564  - Function: window-highest-p WINDOW
565      This function returns non-`nil' if WINDOW is along the top of its
566      frame.
567
568  - Function: window-lowest-p WINDOW
569      This function returns non-`nil' if WINDOW is along the bottom of
570      its frame.
571
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
578      window.
579
580 \1f
581 File: lispref.info,  Node: Resizing Windows,  Next: Window Configurations,  Prev: Position of Window,  Up: Windows
582
583 Changing the Size of a Window
584 =============================
585
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.
590
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.
597
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.
602
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
605      width) of the frame.
606
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.
611
612      If WINDOW is non-`nil', it specifies a window to change instead of
613      the selected window.
614
615      `enlarge-window' returns `nil'.
616
617  - Command: enlarge-window-horizontally COLUMNS
618      This function makes the selected window COLUMNS wider.  It could
619      be defined as follows:
620
621           (defun enlarge-window-horizontally (columns)
622             (enlarge-window columns t))
623
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.
629
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.
635
636      If SIZE is negative, the window is enlarged by -SIZE lines or
637      columns.
638
639      If WINDOW is non-`nil', it specifies a window to change instead of
640      the selected window.
641
642  - Command: shrink-window-horizontally COLUMNS
643      This function makes the selected window COLUMNS narrower.  It
644      could be defined as follows:
645
646           (defun shrink-window-horizontally (columns)
647             (shrink-window columns t))
648
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
654      window.
655
656    The following two variables constrain the window-size-changing
657 functions to a minimum height and width.
658
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.
667
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.
674
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.
680
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.
686
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.
690
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.
695
696 \1f
697 File: lispref.info,  Node: Window Configurations,  Prev: Resizing Windows,  Up: Windows
698
699 Window Configurations
700 =====================
701
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.
707
708    If you want to record all frames instead of just one, use a frame
709 configuration instead of a window configuration.  *Note Frame
710 Configurations::.
711
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.
719
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'.
725
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
729      the old one.)
730
731      Here is a way of using this function to get the same effect as
732      `save-window-excursion':
733
734           (let ((config (current-window-configuration)))
735             (unwind-protect
736                 (progn (split-window-vertically nil)
737                        ...)
738               (set-window-configuration config)))
739
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
747      preserve that.
748
749      Don't use this construct when `save-selected-window' is all you
750      need.
751
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.)
756
757      The return value is the value of the final form in FORMS.  For
758      example:
759
760           (split-window)
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")
767             'do-something)
768                => do-something
769                ;; The frame is now split again.
770
771  - Function: window-configuration-p OBJECT
772      This function returns `t' if OBJECT is a window configuration.
773
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
776 worth implementing.
777
778 \1f
779 File: lispref.info,  Node: Frames,  Next: Consoles and Devices,  Prev: Windows,  Up: Top
780
781 Frames
782 ******
783
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.
788
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.
792
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
796 window.
797
798  - Function: framep OBJECT
799      This predicate returns `t' if OBJECT is a frame, and `nil'
800      otherwise.
801
802 * Menu:
803
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.
818
819    *Note Display::, for related information.
820
821 \1f
822 File: lispref.info,  Node: Creating Frames,  Next: Frame Properties,  Up: Frames
823
824 Creating Frames
825 ===============
826
827    To create a new frame, call the function `make-frame'.
828
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::.
834
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'.
845
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.
850
851 \1f
852 File: lispref.info,  Node: Frame Properties,  Next: Frame Titles,  Prev: Creating Frames,  Up: Frames
853
854 Frame Properties
855 ================
856
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
859 uses.
860
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.
864
865 * Menu:
866
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).
872
873 \1f
874 File: lispref.info,  Node: Property Access,  Next: Initial Properties,  Up: Frame Properties
875
876 Access to Frame Properties
877 --------------------------
878
879    These functions let you read and change the properties of a frame.
880
881  - Function: frame-properties &optional FRAME
882      This function returns a plist listing all the properties of FRAME
883      and their values.
884
885  - Function: frame-property FRAME PROPERTY &optional DEFAULT
886      This function returns FRAME's value for the property PROPERTY.
887
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.
892
893  - Function: set-frame-property FRAME PROP VAL
894      This function sets the property PROP of frame FRAME to the value
895      VAL.
896
897 \1f
898 File: lispref.info,  Node: Initial Properties,  Next: X Frame Properties,  Prev: Property Access,  Up: Frame Properties
899
900 Initial Frame Properties
901 ------------------------
902
903    You can specify the properties for the initial startup frame by
904 setting `initial-frame-plist' in your `.emacs' file.
905
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.
909
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.
914
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
920      X.
921
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
929      resources.
930
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.
934
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.
939
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).
943
944    See also `special-display-frame-plist', in *Note Choosing Window::.
945
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.
951
952 \1f
953 File: lispref.info,  Node: X Frame Properties,  Next: Size and Position,  Prev: Initial Properties,  Up: Frame Properties
954
955 X Window Frame Properties
956 -------------------------
957
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.
962
963 `name'
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
968      window.
969
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.
973
974 `display'
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
977      variable.
978
979 `left'
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
983      negative POS value.
984
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!
990
991 `top'
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
995      negative POS value.
996
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!
1002
1003 `icon-left'
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.
1007
1008 `icon-top'
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.
1012
1013 `user-position'
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.
1019
1020 `height'
1021      The height of the frame contents, in characters.  (To get the
1022      height in pixels, call `frame-pixel-height'; see *Note Size and
1023      Position::.)
1024
1025 `width'
1026      The width of the frame contents, in characters.  (To get the
1027      height in pixels, call `frame-pixel-width'; see *Note Size and
1028      Position::.)
1029
1030 `window-id'
1031      The number of the X window for the frame.
1032
1033 `minibuffer'
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.)
1039
1040 `buffer-predicate'
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.
1047
1048 `scroll-bar-width'
1049      The width of the vertical scroll bar, in pixels.
1050
1051 `cursor-color'
1052      The color for the cursor that shows point.
1053
1054 `border-color'
1055      The color for the border of the frame.
1056
1057 `border-width'
1058      The width in pixels of the window border.
1059
1060 `internal-border-width'
1061      The distance in pixels between text and border.
1062
1063 `unsplittable'
1064      If non-`nil', this frame's window is never split automatically.
1065
1066 `inter-line-space'
1067      The space in pixels between adjacent lines of text. (Not currently
1068      implemented.)
1069
1070 `modeline'
1071      Whether the frame has a modeline.
1072
1073 \1f
1074 File: lispref.info,  Node: Size and Position,  Next: Frame Name,  Prev: X Frame Properties,  Up: Frame Properties
1075
1076 Frame Size And Position
1077 -----------------------
1078
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.
1083
1084    Here are some special features for working with sizes and positions:
1085
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.
1091
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
1096      selected frame.
1097
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.
1102
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.)
1109
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'.)
1115
1116 \1f
1117 File: lispref.info,  Node: Frame Name,  Prev: Size and Position,  Up: Frame Properties
1118
1119 The Name of a Frame (As Opposed to Its Title)
1120 ---------------------------------------------
1121
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.
1126
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::.
1131
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
1135      must be a string.
1136
1137 \1f
1138 File: lispref.info,  Node: Frame Titles,  Next: Deleting Frames,  Prev: Frame Properties,  Up: Frames
1139
1140 Frame Titles
1141 ============
1142
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.
1147
1148    XEmacs computes the frame title based on a template stored in the
1149 variable `frame-title-format'.
1150
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.
1154
1155      The variable's value is actually a modeline construct, just like
1156      `modeline-format'.  *Note Modeline Data::.
1157
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.
1162
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
1169      object.
1170
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.
1173
1174      The window manager is also not required to support color pixmaps,
1175      only bitmaps (one plane deep).
1176
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::.
1180
1181 \1f
1182 File: lispref.info,  Node: Deleting Frames,  Next: Finding All Frames,  Prev: Frame Titles,  Up: Frames
1183
1184 Deleting Frames
1185 ===============
1186
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.
1190
1191  - Command: delete-frame &optional FRAME
1192      This function deletes the frame FRAME.  By default, FRAME is the
1193      selected frame.
1194
1195  - Function: frame-live-p FRAME
1196      The function `frame-live-p' returns non-`nil' if the frame FRAME
1197      has not been deleted.
1198