annotate man/lispref/windows.texi @ 50:ee648375d8d6 r19-16b91

Import from CVS: tag r19-16b91
author cvs
date Mon, 13 Aug 2007 08:56:41 +0200
parents 376386a54a3c
children 05472e90ae02
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 @c -*-texinfo-*-
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 @c This is part of the XEmacs Lisp Reference Manual.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 @c Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 @c See the file lispref.texi for copying conditions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 @setfilename ../../info/windows.info
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 @node Windows, Frames, Buffers, Top
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 @chapter Windows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 This chapter describes most of the functions and variables related to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 Emacs windows. See @ref{Display}, for information on how text is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 displayed in windows.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 @menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 * Basic Windows:: Basic information on using windows.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 * Splitting Windows:: Splitting one window into two windows.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 * Deleting Windows:: Deleting a window gives its space to other windows.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 * Selecting Windows:: The selected window is the one that you edit in.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 * Cyclic Window Ordering:: Moving around the existing windows.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 * Buffers and Windows:: Each window displays the contents of a buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 * Displaying Buffers:: Higher-lever functions for displaying a buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 and choosing a window for it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 * Choosing Window:: How to choose a window for displaying a buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 * Window Point:: Each window has its own location of point.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 * Window Start:: The display-start position controls which text
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 is on-screen in the window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 * Vertical Scrolling:: Moving text up and down in the window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 * Horizontal Scrolling:: Moving text sideways on the window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 * Size of Window:: Accessing the size of a window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 * Position of Window:: Accessing the position of a window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 * Resizing Windows:: Changing the size of a window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 * Window Configurations:: Saving and restoring the state of the screen.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 @end menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 @node Basic Windows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 @section Basic Concepts of Emacs Windows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 @cindex window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 @cindex selected window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 A @dfn{window} in XEmacs is the physical area of the screen in which a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 buffer is displayed. The term is also used to refer to a Lisp object that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 represents that screen area in XEmacs Lisp. It should be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 clear from the context which is meant.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 XEmacs groups windows into frames. A frame represents an area of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 screen available for XEmacs to use. Each frame always contains at least
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 one window, but you can subdivide it vertically or horizontally into
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 multiple nonoverlapping Emacs windows.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 In each frame, at any time, one and only one window is designated as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 @dfn{selected within the frame}. The frame's cursor appears in that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 window. At ant time, one frame is the selected frame; and the window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 selected within that frame is @dfn{the selected window}. The selected
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 window's buffer is usually the current buffer (except when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 @code{set-buffer} has been used). @xref{Current Buffer}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 For practical purposes, a window exists only while it is displayed in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 a frame. Once removed from the frame, the window is effectively deleted
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 and should not be used, @emph{even though there may still be references
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 to it} from other Lisp objects. Restoring a saved window configuration
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 is the only way for a window no longer on the screen to come back to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 life. (@xref{Deleting Windows}.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 Each window has the following attributes:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 containing frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 window height
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 window width
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 window edges with respect to the frame or screen
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 the buffer it displays
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 position within the buffer at the upper left of the window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 amount of horizontal scrolling, in columns
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 point
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 the mark
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 how recently the window was selected
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 @cindex multiple windows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 Users create multiple windows so they can look at several buffers at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 once. Lisp libraries use multiple windows for a variety of reasons, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 most often to display related information. In Rmail, for example, you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 can move through a summary buffer in one window while the other window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 shows messages one at a time as they are reached.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 The meaning of ``window'' in XEmacs is similar to what it means in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 context of general-purpose window systems such as X, but not identical.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 The X Window System places X windows on the screen; XEmacs uses one or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 more X windows as frames, and subdivides them into
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 Emacs windows. When you use XEmacs on a character-only terminal, XEmacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 treats the whole terminal screen as one frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 @cindex terminal frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 @cindex frame of terminal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 @cindex tiled windows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 Most window systems support arbitrarily located overlapping windows.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 In contrast, Emacs windows are @dfn{tiled}; they never overlap, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 together they fill the whole screen or frame. Because of the way
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 in which XEmacs creates new windows and resizes them, you can't create
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 every conceivable tiling of windows on an Emacs frame. @xref{Splitting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 Windows}, and @ref{Size of Window}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 @xref{Display}, for information on how the contents of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 window's buffer are displayed in the window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 @defun windowp object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 This function returns @code{t} if @var{object} is a window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 @node Splitting Windows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 @section Splitting Windows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 @cindex splitting windows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 @cindex window splitting
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 The functions described here are the primitives used to split a window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 into two windows. Two higher level functions sometimes split a window,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 but not always: @code{pop-to-buffer} and @code{display-buffer}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 (@pxref{Displaying Buffers}).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 The functions described here do not accept a buffer as an argument.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 The two ``halves'' of the split window initially display the same buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 previously visible in the window that was split.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 @defun one-window-p &optional no-mini all-frames
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 This function returns non-@code{nil} if there is only one window. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 argument @var{no-mini}, if non-@code{nil}, means don't count the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 minibuffer even if it is active; otherwise, the minibuffer window is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 included, if active, in the total number of windows which is compared
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 against one.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 The argument @var{all-frame} controls which set of windows are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 counted.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 If it is @code{nil} or omitted, then count only the selected frame, plus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 the minibuffer it uses (which may be on another frame).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 If it is @code{t}, then windows on all frames that currently exist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 (including invisible and iconified frames) are counted.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 If it is the symbol @code{visible}, then windows on all visible frames
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 are counted.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 If it is the number 0, then windows on all visible and iconified frames
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 are counted.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 If it is any other value, then precisely the windows in @var{window}'s
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 frame are counted, excluding the minibuffer in use if it lies in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 some other frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 @deffn Command split-window &optional window size horizontal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 This function splits @var{window} into two windows. The original
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 window @var{window} remains the selected window, but occupies only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 part of its former screen area. The rest is occupied by a newly created
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 window which is returned as the value of this function.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 If @var{horizontal} is non-@code{nil}, then @var{window} splits into
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 two side by side windows. The original window @var{window} keeps the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 leftmost @var{size} columns, and gives the rest of the columns to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 new window. Otherwise, it splits into windows one above the other, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 @var{window} keeps the upper @var{size} lines and gives the rest of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 lines to the new window. The original window is therefore the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 left-hand or upper of the two, and the new window is the right-hand or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 lower.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 If @var{window} is omitted or @code{nil}, then the selected window is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 split. If @var{size} is omitted or @code{nil}, then @var{window} is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 divided evenly into two parts. (If there is an odd line, it is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 allocated to the new window.) When @code{split-window} is called
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 interactively, all its arguments are @code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 The following example starts with one window on a frame that is 50
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 lines high by 80 columns wide; then the window is split.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 (setq w (selected-window))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 @result{} #<window 8 on windows.texi>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 (window-edges) ; @r{Edges in order:}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 @result{} (0 0 80 50) ; @r{left--top--right--bottom}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 ;; @r{Returns window created}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 (setq w2 (split-window w 15))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 @result{} #<window 28 on windows.texi>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 (window-edges w2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 @result{} (0 15 80 50) ; @r{Bottom window;}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 ; @r{top is line 15}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 (window-edges w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 @result{} (0 0 80 15) ; @r{Top window}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 The frame looks like this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 __________
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 | | line 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 | w |
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 |__________|
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 | | line 15
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 | w2 |
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 |__________|
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 line 50
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 column 0 column 80
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 Next, the top window is split horizontally:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 (setq w3 (split-window w 35 t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 @result{} #<window 32 on windows.texi>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 (window-edges w3)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 @result{} (35 0 80 15) ; @r{Left edge at column 35}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 (window-edges w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 @result{} (0 0 35 15) ; @r{Right edge at column 35}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 (window-edges w2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 @result{} (0 15 80 50) ; @r{Bottom window unchanged}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 @need 3000
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 Now, the screen looks like this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 column 35
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 __________
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 | | | line 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 | w | w3 |
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 |___|______|
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 | | line 15
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 | w2 |
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 |__________|
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 line 50
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 column 0 column 80
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 Normally, Emacs indicates the border between two side-by-side windows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 with a scroll bar (@pxref{X Frame Parameters,Scroll Bars}) or @samp{|}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 characters. The display table can specify alternative border
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 characters; see @ref{Display Tables}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 @end deffn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 @deffn Command split-window-vertically &optional size
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 This function splits the selected window into two windows, one above
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 the other, leaving the selected window with @var{size} lines.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 This function is simply an interface to @code{split-windows}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 Here is the complete function definition for it:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 (defun split-window-vertically (&optional arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 "Split current window into two windows, one above the other."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 (split-window nil (and arg (prefix-numeric-value arg))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 @end deffn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 @deffn Command split-window-horizontally &optional size
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 This function splits the selected window into two windows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 side-by-side, leaving the selected window with @var{size} columns.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 This function is simply an interface to @code{split-windows}. Here is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 the complete definition for @code{split-window-horizontally} (except for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 part of the documentation string):
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 @smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 (defun split-window-horizontally (&optional arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 "Split selected window into two windows, side by side..."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 (split-window nil (and arg (prefix-numeric-value arg)) t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 @end smallexample
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 @end deffn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 @defun one-window-p &optional no-mini all-frames
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 This function returns non-@code{nil} if there is only one window. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 argument @var{no-mini}, if non-@code{nil}, means don't count the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 minibuffer even if it is active; otherwise, the minibuffer window is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 included, if active, in the total number of windows, which is compared
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 against one.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 The argument @var{all-frames} specifies which frames to consider. Here
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 are the possible values and their meanings:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 @table @asis
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 @item @code{nil}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 Count the windows in the selected frame, plus the minibuffer used
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 by that frame even if it lies in some other frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 @item @code{t}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 Count all windows in all existing frames.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 @item @code{visible}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 Count all windows in all visible frames.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 @item 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 Count all windows in all visible or iconified frames.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 @item anything else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 Count precisely the windows in the selected frame, and no others.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 @node Deleting Windows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 @section Deleting Windows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 @cindex deleting windows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 A window remains visible on its frame unless you @dfn{delete} it by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 calling certain functions that delete windows. A deleted window cannot
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 appear on the screen, but continues to exist as a Lisp object until
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 there are no references to it. There is no way to cancel the deletion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 of a window aside from restoring a saved window configuration
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 (@pxref{Window Configurations}). Restoring a window configuration also
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 deletes any windows that aren't part of that configuration.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 When you delete a window, the space it took up is given to one
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 adjacent sibling. (In Emacs version 18, the space was divided evenly
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 among all the siblings.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 @c Emacs 19 feature
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 @defun window-live-p window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 This function returns @code{nil} if @var{window} is deleted, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 @code{t} otherwise.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 @strong{Warning:} Erroneous information or fatal errors may result from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 using a deleted window as if it were live.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 @deffn Command delete-window &optional window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 This function removes @var{window} from the display. If @var{window}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 is omitted, then the selected window is deleted. An error is signaled
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 if there is only one window when @code{delete-window} is called.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 This function returns @code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 When @code{delete-window} is called interactively, @var{window}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 defaults to the selected window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 @end deffn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 @deffn Command delete-other-windows &optional window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 This function makes @var{window} the only window on its frame, by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 deleting the other windows in that frame. If @var{window} is omitted or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 @code{nil}, then the selected window is used by default.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 The result is @code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 @end deffn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 @deffn Command delete-windows-on buffer &optional frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 This function deletes all windows showing @var{buffer}. If there are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 no windows showing @var{buffer}, it does nothing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 @code{delete-windows-on} operates frame by frame. If a frame has
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 several windows showing different buffers, then those showing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 @var{buffer} are removed, and the others expand to fill the space. If
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 all windows in some frame are showing @var{buffer} (including the case
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 where there is only one window), then the frame reverts to having a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 single window showing another buffer chosen with @code{other-buffer}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 @xref{The Buffer List}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 The argument @var{frame} controls which frames to operate on:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 If it is @code{nil}, operate on the selected frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 If it is @code{t}, operate on all frames.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 If it is @code{visible}, operate on all visible frames.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 @item 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 If it is 0, operate on all visible or iconified frames.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 If it is a frame, operate on that frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 This function always returns @code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 @end deffn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 @node Selecting Windows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 @section Selecting Windows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 @cindex selecting windows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 When a window is selected, the buffer in the window becomes the current
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 buffer, and the cursor will appear in it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 @defun selected-window &optional device
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 This function returns the selected window. This is the window in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 which the cursor appears and to which many commands apply. Each
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 separate device can have its own selected window, which is remembered
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 as focus changes from device to device. Optional argument @var{device}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 specifies which device to return the selected window for, and defaults
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 to the selected device.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 @defun select-window window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 This function makes @var{window} the selected window. The cursor then
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 appears in @var{window} (on redisplay). The buffer being displayed in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 @var{window} is immediately designated the current buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 The return value is @var{window}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 (setq w (next-window))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 (select-window w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 @result{} #<window 65 on windows.texi>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 @defmac save-selected-window forms@dots{}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 This macro records the selected window, executes @var{forms}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 in sequence, then restores the earlier selected window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 It does not save or restore anything about the sizes, arrangement
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 or contents of windows; therefore, if the @var{forms} change them,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 the changes are permanent.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 @end defmac
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 @cindex finding windows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 The following functions choose one of the windows on the screen,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 offering various criteria for the choice.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 @defun get-lru-window &optional frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 This function returns the window least recently ``used'' (that is,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 selected). The selected window is always the most recently used window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 The selected window can be the least recently used window if it is the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 only window. A newly created window becomes the least recently used
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 window until it is selected. A minibuffer window is never a candidate.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 The argument @var{frame} controls which windows are considered.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 If it is @code{nil}, consider windows on the selected frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 If it is @code{t}, consider windows on all frames.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 If it is @code{visible}, consider windows on all visible frames.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 If it is 0, consider windows on all visible or iconified frames.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 If it is a frame, consider windows on that frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 @defun get-largest-window &optional frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 This function returns the window with the largest area (height times
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 width). If there are no side-by-side windows, then this is the window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 with the most lines. A minibuffer window is never a candidate.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 If there are two windows of the same size, then the function returns
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 the window that is first in the cyclic ordering of windows (see
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 following section), starting from the selected window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 The argument @var{frame} controls which set of windows are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 considered. See @code{get-lru-window}, above.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 @node Cyclic Window Ordering
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 @section Cyclic Ordering of Windows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 @cindex cyclic ordering of windows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 @cindex ordering of windows, cyclic
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 @cindex window ordering, cyclic
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 When you use the command @kbd{C-x o} (@code{other-window}) to select
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 the next window, it moves through all the windows on the screen in a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 specific cyclic order. For any given configuration of windows, this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 order never varies. It is called the @dfn{cyclic ordering of windows}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 This ordering generally goes from top to bottom, and from left to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 right. But it may go down first or go right first, depending on the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 order in which the windows were split.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 If the first split was vertical (into windows one above each other),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 and then the subwindows were split horizontally, then the ordering is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 left to right in the top of the frame, and then left to right in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 next lower part of the frame, and so on. If the first split was
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 horizontal, the ordering is top to bottom in the left part, and so on.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 In general, within each set of siblings at any level in the window tree,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 the order is left to right, or top to bottom.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 @defun next-window &optional window minibuf all-frames
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 @cindex minibuffer window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 This function returns the window following @var{window} in the cyclic
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 ordering of windows. This is the window that @kbd{C-x o} would select
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 if typed when @var{window} is selected. If @var{window} is the only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 window visible, then this function returns @var{window}. If omitted,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 @var{window} defaults to the selected window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 The value of the argument @var{minibuf} determines whether the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 minibuffer is included in the window order. Normally, when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 @var{minibuf} is @code{nil}, the minibuffer is included if it is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 currently active; this is the behavior of @kbd{C-x o}. (The minibuffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 window is active while the minibuffer is in use. @xref{Minibuffers}.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 If @var{minibuf} is @code{t}, then the cyclic ordering includes the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 minibuffer window even if it is not active.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 If @var{minibuf} is neither @code{t} nor @code{nil}, then the minibuffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 window is not included even if it is active.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 The argument @var{all-frames} specifies which frames to consider. Here
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 are the possible values and their meanings:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 @table @asis
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 @item @code{nil}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 Consider all the windows in @var{window}'s frame, plus the minibuffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 used by that frame even if it lies in some other frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 @item @code{t}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 Consider all windows in all existing frames.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 @item @code{visible}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 Consider all windows in all visible frames. (To get useful results, you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 must ensure @var{window} is in a visible frame.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 @item 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 Consider all windows in all visible or iconified frames.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 @item anything else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 Consider precisely the windows in @var{window}'s frame, and no others.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 @end table
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 This example assumes there are two windows, both displaying the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 buffer @samp{windows.texi}:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 (selected-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 @result{} #<window 56 on windows.texi>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 (next-window (selected-window))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 @result{} #<window 52 on windows.texi>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 (next-window (next-window (selected-window)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 @result{} #<window 56 on windows.texi>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 @defun previous-window &optional window minibuf all-frames
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 This function returns the window preceding @var{window} in the cyclic
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 ordering of windows. The other arguments specify which windows to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 include in the cycle, as in @code{next-window}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 @deffn Command other-window count &optional frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 This function selects the @var{count}th following window in the cyclic
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 order. If count is negative, then it selects the @minus{}@var{count}th
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 preceding window. It returns @code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 In an interactive call, @var{count} is the numeric prefix argument.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 The argument @var{frame} controls which set of windows are considered.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 If it is @code{nil} or omitted, then windows on the selected frame are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 considered.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 If it is a frame, then windows on that frame are considered.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 If it is @code{t}, then windows on all frames that currently exist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 (including invisible and iconified frames) are considered.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 If it is the symbol @code{visible}, then windows on all visible frames
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 are considered.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 If it is the number 0, then windows on all visible and iconified frames
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 are considered.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 If it is any other value, then the behavior is undefined.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 @end deffn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 @c Emacs 19 feature
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 @defun walk-windows proc &optional minibuf all-frames
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 This function cycles through all windows, calling @code{proc}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 once for each window with the window as its sole argument.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 The optional arguments @var{minibuf} and @var{all-frames} specify the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 set of windows to include in the scan. See @code{next-window}, above,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 for details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 @node Buffers and Windows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 @section Buffers and Windows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 @cindex examining windows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 @cindex windows, controlling precisely
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 @cindex buffers, controlled in windows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633 This section describes low-level functions to examine windows or to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634 display buffers in windows in a precisely controlled fashion.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 @iftex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 See the following section for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637 @end iftex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 @ifinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 @xref{Displaying Buffers}, for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 @end ifinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 related functions that find a window to use and specify a buffer for it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 The functions described there are easier to use than these, but they
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 employ heuristics in choosing or creating a window; use these functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 when you need complete control.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 @defun set-window-buffer window buffer-or-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 This function makes @var{window} display @var{buffer-or-name} as its
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 contents. It returns @code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 (set-window-buffer (selected-window) "foo")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 @result{} nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
658 @defun window-buffer &optional window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
659 This function returns the buffer that @var{window} is displaying. If
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
660 @var{window} is omitted, this function returns the buffer for the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
661 selected window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
662
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
663 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
664 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
665 (window-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
666 @result{} #<buffer windows.texi>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
667 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
668 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
669 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
670
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
671 @defun get-buffer-window buffer-or-name &optional frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
672 This function returns a window currently displaying
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
673 @var{buffer-or-name}, or @code{nil} if there is none. If there are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
674 several such windows, then the function returns the first one in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
675 cyclic ordering of windows, starting from the selected window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
676 @xref{Cyclic Window Ordering}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
677
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
678 The argument @var{all-frames} controls which windows to consider.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
679
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
680 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
681 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
682 If it is @code{nil}, consider windows on the selected frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
683 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
684 If it is @code{t}, consider windows on all frames.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
685 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
686 If it is @code{visible}, consider windows on all visible frames.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
687 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
688 If it is 0, consider windows on all visible or iconified frames.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
689 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
690 If it is a frame, consider windows on that frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
691 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
692 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
693
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
694 @node Displaying Buffers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
695 @section Displaying Buffers in Windows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
696 @cindex switching to a buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
697 @cindex displaying a buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
698
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
699 In this section we describe convenient functions that choose a window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
700 automatically and use it to display a specified buffer. These functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
701 can also split an existing window in certain circumstances. We also
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
702 describe variables that parameterize the heuristics used for choosing a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
703 window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
704 @iftex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
705 See the preceding section for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
706 @end iftex
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
707 @ifinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
708 @xref{Buffers and Windows}, for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
709 @end ifinfo
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
710 low-level functions that give you more precise control.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
711
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
712 Do not use the functions in this section in order to make a buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
713 current so that a Lisp program can access or modify it; they are too
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
714 drastic for that purpose, since they change the display of buffers in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
715 windows, which is gratuitous and will surprise the user. Instead, use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
716 @code{set-buffer} (@pxref{Current Buffer}) and @code{save-excursion}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
717 (@pxref{Excursions}), which designate buffers as current for programmed
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
718 access without affecting the display of buffers in windows.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
719
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
720 @deffn Command switch-to-buffer buffer-or-name &optional norecord
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
721 This function makes @var{buffer-or-name} the current buffer, and also
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
722 displays the buffer in the selected window. This means that a human can
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
723 see the buffer and subsequent keyboard commands will apply to it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
724 Contrast this with @code{set-buffer}, which makes @var{buffer-or-name}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
725 the current buffer but does not display it in the selected window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
726 @xref{Current Buffer}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
727
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
728 If @var{buffer-or-name} does not identify an existing buffer, then a new
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
729 buffer by that name is created. The major mode for the new buffer is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
730 set according to the variable @code{default-major-mode}. @xref{Auto
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
731 Major Mode}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
732
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
733 Normally the specified buffer is put at the front of the buffer list.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
734 This affects the operation of @code{other-buffer}. However, if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
735 @var{norecord} is non-@code{nil}, this is not done. @xref{The Buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
736 List}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
737
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
738 The @code{switch-to-buffer} function is often used interactively, as
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
739 the binding of @kbd{C-x b}. It is also used frequently in programs. It
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
740 always returns @code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
741 @end deffn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
742
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
743 @deffn Command switch-to-buffer-other-window buffer-or-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
744 This function makes @var{buffer-or-name} the current buffer and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
745 displays it in a window not currently selected. It then selects that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
746 window. The handling of the buffer is the same as in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
747 @code{switch-to-buffer}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
748
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
749 The currently selected window is absolutely never used to do the job.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
750 If it is the only window, then it is split to make a distinct window for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
751 this purpose. If the selected window is already displaying the buffer,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
752 then it continues to do so, but another window is nonetheless found to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
753 display it in as well.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
754 @end deffn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
755
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
756 @defun pop-to-buffer buffer-or-name &optional other-window on-frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
757 This function makes @var{buffer-or-name} the current buffer and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
758 switches to it in some window, preferably not the window previously
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
759 selected. The ``popped-to'' window becomes the selected window within
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
760 its frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
761
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
762 If the variable @code{pop-up-frames} is non-@code{nil},
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
763 @code{pop-to-buffer} looks for a window in any visible frame already
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
764 displaying the buffer; if there is one, it returns that window and makes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
765 it be selected within its frame. If there is none, it creates a new
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
766 frame and displays the buffer in it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
767
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
768 If @code{pop-up-frames} is @code{nil}, then @code{pop-to-buffer}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
769 operates entirely within the selected frame. (If the selected frame has
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
770 just a minibuffer, @code{pop-to-buffer} operates within the most
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
771 recently selected frame that was not just a minibuffer.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
772
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
773 If the variable @code{pop-up-windows} is non-@code{nil}, windows may
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
774 be split to create a new window that is different from the original
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
775 window. For details, see @ref{Choosing Window}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
776
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
777 If @var{other-window} is non-@code{nil}, @code{pop-to-buffer} finds or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
778 creates another window even if @var{buffer-or-name} is already visible
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
779 in the selected window. Thus @var{buffer-or-name} could end up
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
780 displayed in two windows. On the other hand, if @var{buffer-or-name} is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
781 already displayed in the selected window and @var{other-window} is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
782 @code{nil}, then the selected window is considered sufficient display
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
783 for @var{buffer-or-name}, so that nothing needs to be done.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
784
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
785 All the variables that affect @code{display-buffer} affect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
786 @code{pop-to-buffer} as well. @xref{Choosing Window}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
787
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
788 If @var{buffer-or-name} is a string that does not name an existing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
789 buffer, a buffer by that name is created. The major mode for the new
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
790 buffer is set according to the variable @code{default-major-mode}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
791 @xref{Auto Major Mode}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
792
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
793 If @var{on-frame} is non-@code{nil}, it is the frame to pop to this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
794 buffer on.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
795
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
796 An example use of this function is found at the end of @ref{Filter
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
797 Functions}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
798 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
799
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
800 @deffn Command replace-buffer-in-windows buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
801 This function replaces @var{buffer} with some other buffer in all
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
802 windows displaying it. The other buffer used is chosen with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
803 @code{other-buffer}. In the usual applications of this function, you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
804 don't care which other buffer is used; you just want to make sure that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
805 @var{buffer} is no longer displayed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
806
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
807 This function returns @code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
808 @end deffn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
809
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
810 @node Choosing Window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
811 @section Choosing a Window for Display
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
812
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
813 This section describes the basic facility that chooses a window to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
814 display a buffer in---@code{display-buffer}. All the higher-level
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
815 functions and commands use this subroutine. Here we describe how to use
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
816 @code{display-buffer} and how to customize it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
817
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
818 @deffn Command display-buffer buffer-or-name &optional not-this-window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
819 This command makes @var{buffer-or-name} appear in some window, like
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
820 @code{pop-to-buffer}, but it does not select that window and does not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
821 make the buffer current. The identity of the selected window is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
822 unaltered by this function.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
823
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
824 If @var{not-this-window} is non-@code{nil}, it means to display the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
825 specified buffer in a window other than the selected one, even if it is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
826 already on display in the selected window. This can cause the buffer to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
827 appear in two windows at once. Otherwise, if @var{buffer-or-name} is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
828 already being displayed in any window, that is good enough, so this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
829 function does nothing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
830
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
831 @code{display-buffer} returns the window chosen to display
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
832 @var{buffer-or-name}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
833
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
834 Precisely how @code{display-buffer} finds or creates a window depends on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
835 the variables described below.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
836 @end deffn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
837
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
838 @c Emacs 19 feature
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
839 @cindex dedicated window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
840 A window can be marked as ``dedicated'' to a particular buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
841 Then XEmacs will not automatically change which buffer appears in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
842 window, such as @code{display-buffer} might normally do.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
843
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
844 @defun window-dedicated-p window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
845 This function returns @var{window}'s dedicated object, usually @code{t}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
846 or @code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
847 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
848
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
849 @defun set-window-buffer-dedicated window buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
850 This function makes @var{window} display @var{buffer} and be dedicated
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
851 to that buffer. Then XEmacs will not automatically change which buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
852 appears in @var{window}. If @var{buffer} is @code{nil}, this function makes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
853 @var{window} not be dedicated (but doesn't change which buffer appears
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
854 in it currently).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
855 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
856
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
857 @defopt pop-up-windows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
858 This variable controls whether @code{display-buffer} makes new windows.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
859 If it is non-@code{nil} and there is only one window, then that window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
860 is split. If it is @code{nil}, then @code{display-buffer} does not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
861 split the single window, but uses it whole.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
862 @end defopt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
863
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
864 @defopt split-height-threshold
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
865 This variable determines when @code{display-buffer} may split a window,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
866 if there are multiple windows. @code{display-buffer} always splits the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
867 largest window if it has at least this many lines. If the largest
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
868 window is not this tall, it is split only if it is the sole window and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
869 @code{pop-up-windows} is non-@code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
870 @end defopt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
871
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
872 @c Emacs 19 feature
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
873 @defopt pop-up-frames
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
874 This variable controls whether @code{display-buffer} makes new frames.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
875 If it is non-@code{nil}, @code{display-buffer} looks for an existing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
876 window already displaying the desired buffer, on any visible frame. If
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
877 it finds one, it returns that window. Otherwise it makes a new frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
878 The variables @code{pop-up-windows} and @code{split-height-threshold} do
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
879 not matter if @code{pop-up-frames} is non-@code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
880
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
881 If @code{pop-up-frames} is @code{nil}, then @code{display-buffer} either
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
882 splits a window or reuses one.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
883
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
884 @xref{Frames}, for more information.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
885 @end defopt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
886
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
887 @c Emacs 19 feature
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
888 @defvar pop-up-frame-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
889 This variable specifies how to make a new frame if @code{pop-up-frames}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
890 is non-@code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
891
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
892 Its value should be a function of no arguments. When
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
893 @code{display-buffer} makes a new frame, it does so by calling that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
894 function, which should return a frame. The default value of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
895 variable is a function that creates a frame using parameters from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
896 @code{pop-up-frame-alist}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
897 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
898
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
899 @defvar pop-up-frame-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
900 This variable holds an alist specifying frame parameters used when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
901 @code{display-buffer} makes a new frame. @xref{Frame Parameters}, for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
902 more information about frame parameters.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
903 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
904
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
905 @defvar special-display-buffer-names
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
906 A list of buffer names for buffers that should be displayed specially.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
907 If the buffer's name is in this list, @code{display-buffer} handles the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
908 buffer specially.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
909
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
910 By default, special display means to give the buffer a dedicated frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
911
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
912 If an element is a list, instead of a string, then the @sc{car} of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
913 list is the buffer name, and the rest of the list says how to create the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
914 frame. There are two possibilities for the rest of the list. It can be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
915 an alist, specifying frame parameters, or it can contain a function and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
916 arguments to give to it. (The function's first argument is always the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
917 buffer to be displayed; the arguments from the list come after that.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
918 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
919
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
920 @defvar special-display-regexps
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
921 A list of regular expressions that specify buffers that should be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
922 displayed specially. If the buffer's name matches any of the regular
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
923 expressions in this list, @code{display-buffer} handles the buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
924 specially.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
925
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
926 By default, special display means to give the buffer a dedicated frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
927
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
928 If an element is a list, instead of a string, then the @sc{car} of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
929 list is the regular expression, and the rest of the list says how to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
930 create the frame. See above, under @code{special-display-buffer-names}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
931 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
932
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
933 @defvar special-display-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
934 This variable holds the function to call to display a buffer specially.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
935 It receives the buffer as an argument, and should return the window in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
936 which it is displayed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
937
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
938 The default value of this variable is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
939 @code{special-display-popup-frame}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
940 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
941
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
942 @defun special-display-popup-frame buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
943 This function makes @var{buffer} visible in a frame of its own. If
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
944 @var{buffer} is already displayed in a window in some frame, it makes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
945 the frame visible and raises it, to use that window. Otherwise, it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
946 creates a frame that will be dedicated to @var{buffer}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
947
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
948 This function uses an existing window displaying @var{buffer} whether or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
949 not it is in a frame of its own; but if you set up the above variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
950 in your init file, before @var{buffer} was created, then presumably the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
951 window was previously made by this function.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
952 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
953
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
954 @defopt special-display-frame-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
955 This variable holds frame parameters for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
956 @code{special-display-popup-frame} to use when it creates a frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
957 @end defopt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
958
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
959 @defvar same-window-buffer-names
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
960 A list of buffer names for buffers that should be displayed in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
961 selected window. If the buffer's name is in this list,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
962 @code{display-buffer} handles the buffer by switching to it in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
963 selected window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
964 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
965
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
966 @defvar same-window-regexps
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
967 A list of regular expressions that specify buffers that should be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
968 displayed in the selected window. If the buffer's name matches any of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
969 the regular expressions in this list, @code{display-buffer} handles the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
970 buffer by switching to it in the selected window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
971 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
972
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
973 @c Emacs 19 feature
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
974 @defvar display-buffer-function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
975 This variable is the most flexible way to customize the behavior of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
976 @code{display-buffer}. If it is non-@code{nil}, it should be a function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
977 that @code{display-buffer} calls to do the work. The function should
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
978 accept two arguments, the same two arguments that @code{display-buffer}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
979 received. It should choose or create a window, display the specified
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
980 buffer, and then return the window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
981
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
982 This hook takes precedence over all the other options and hooks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
983 described above.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
984 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
985
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
986 @c Emacs 19 feature
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
987 @cindex dedicated window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
988 A window can be marked as ``dedicated'' to its buffer. Then
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
989 @code{display-buffer} does not try to use that window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
990
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
991 @defun window-dedicated-p window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
992 This function returns @code{t} if @var{window} is marked as dedicated;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
993 otherwise @code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
994 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
995
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
996 @defun set-window-dedicated-p window flag
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
997 This function marks @var{window} as dedicated if @var{flag} is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
998 non-@code{nil}, and nondedicated otherwise.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
999 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1000
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1001 @node Window Point
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1002 @section Windows and Point
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1003 @cindex window position
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1004 @cindex window point
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1005 @cindex position in window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1006 @cindex point in window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1007
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1008 Each window has its own value of point, independent of the value of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1009 point in other windows displaying the same buffer. This makes it useful
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1010 to have multiple windows showing one buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1011
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1012 @itemize @bullet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1013 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1014 The window point is established when a window is first created; it is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1015 initialized from the buffer's point, or from the window point of another
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1016 window opened on the buffer if such a window exists.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1017
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1018 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1019 Selecting a window sets the value of point in its buffer to the window's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1020 value of point. Conversely, deselecting a window sets the window's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1021 value of point from that of the buffer. Thus, when you switch between
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1022 windows that display a given buffer, the point value for the selected
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1023 window is in effect in the buffer, while the point values for the other
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1024 windows are stored in those windows.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1025
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1026 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1027 As long as the selected window displays the current buffer, the window's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1028 point and the buffer's point always move together; they remain equal.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1029
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1030 @item
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1031 @xref{Positions}, for more details on buffer positions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1032 @end itemize
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1033
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1034 As far as the user is concerned, point is where the cursor is, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1035 when the user switches to another buffer, the cursor jumps to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1036 position of point in that buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1037
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1038 @defun window-point window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1039 This function returns the current position of point in @var{window}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1040 For a nonselected window, this is the value point would have (in that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1041 window's buffer) if that window were selected.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1042
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1043 When @var{window} is the selected window and its buffer is also the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1044 current buffer, the value returned is the same as point in that buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1045
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1046 Strictly speaking, it would be more correct to return the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1047 ``top-level'' value of point, outside of any @code{save-excursion}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1048 forms. But that value is hard to find.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1049 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1050
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1051 @defun set-window-point window position
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1052 This function positions point in @var{window} at position
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1053 @var{position} in @var{window}'s buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1054 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1055
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1056 @node Window Start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1057 @section The Window Start Position
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1058
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1059 Each window contains a marker used to keep track of a buffer position
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1060 that specifies where in the buffer display should start. This position
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1061 is called the @dfn{display-start} position of the window (or just the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1062 @dfn{start}). The character after this position is the one that appears
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1063 at the upper left corner of the window. It is usually, but not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1064 inevitably, at the beginning of a text line.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1065
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1066 @defun window-start &optional window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1067 @cindex window top line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1068 This function returns the display-start position of window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1069 @var{window}. If @var{window} is @code{nil}, the selected window is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1070 used. For example,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1071
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1072 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1073 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1074 (window-start)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1075 @result{} 7058
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1076 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1077 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1078
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1079 When you create a window, or display a different buffer in it, the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1080 display-start position is set to a display-start position recently used
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1081 for the same buffer, or 1 if the buffer doesn't have any.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1082
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1083 For a realistic example, see the description of @code{count-lines} in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1084 @ref{Text Lines}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1085 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1086
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1087 @defun window-end &optional window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1088 This function returns the position of the end of the display in window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1089 @var{window}. If @var{window} is @code{nil}, the selected window is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1090 used.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1091
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1092 Simply changing the buffer text or moving point does not update the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1093 value that @code{window-end} returns. The value is updated only when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1094 Emacs redisplays and redisplay actually finishes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1095
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1096 If the last redisplay of @var{window} was preempted, and did not finish,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1097 Emacs does not know the position of the end of display in that window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1098 In that case, this function returns a value that is not correct. In a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1099 future version, @code{window-end} will return @code{nil} in that case.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1100 @ignore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1101 in that case, this function returns @code{nil}. You can compute where
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1102 the end of the window @emph{would} have been, if redisplay had finished,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1103 like this:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1104
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1105 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1106 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1107 (goto-char (window-start window))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1108 (vertical-motion (1- (window-height window))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1109 window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1110 (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1111 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1112 @end ignore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1113 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1114
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1115 @defun set-window-start window position &optional noforce
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1116 This function sets the display-start position of @var{window} to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1117 @var{position} in @var{window}'s buffer. It returns @var{position}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1118
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1119 The display routines insist that the position of point be visible when a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1120 buffer is displayed. Normally, they change the display-start position
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1121 (that is, scroll the window) whenever necessary to make point visible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1122 However, if you specify the start position with this function using
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1123 @code{nil} for @var{noforce}, it means you want display to start at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1124 @var{position} even if that would put the location of point off the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1125 screen. If this does place point off screen, the display routines move
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1126 point to the left margin on the middle line in the window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1127
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1128 For example, if point @w{is 1} and you set the start of the window @w{to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1129 2}, then point would be ``above'' the top of the window. The display
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1130 routines will automatically move point if it is still 1 when redisplay
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1131 occurs. Here is an example:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1132
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1133 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1134 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1135 ;; @r{Here is what @samp{foo} looks like before executing}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1136 ;; @r{the @code{set-window-start} expression.}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1137 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1138
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1139 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1140 ---------- Buffer: foo ----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1141 @point{}This is the contents of buffer foo.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1142 2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1143 3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1144 4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1145 5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1146 6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1147 ---------- Buffer: foo ----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1148 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1149
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1150 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1151 (set-window-start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1152 (selected-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1153 (1+ (window-start)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1154 @result{} 2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1155 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1156
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1157 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1158 ;; @r{Here is what @samp{foo} looks like after executing}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1159 ;; @r{the @code{set-window-start} expression.}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1160 ---------- Buffer: foo ----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1161 his is the contents of buffer foo.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1162 2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1163 3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1164 @point{}4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1165 5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1166 6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1167 ---------- Buffer: foo ----------
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1168 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1169 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1170
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1171 If @var{noforce} is non-@code{nil}, and @var{position} would place point
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1172 off screen at the next redisplay, then redisplay computes a new window-start
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1173 position that works well with point, and thus @var{position} is not used.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1174 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1175
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1176 @defun pos-visible-in-window-p &optional position window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1177 This function returns @code{t} if @var{position} is within the range
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1178 of text currently visible on the screen in @var{window}. It returns
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1179 @code{nil} if @var{position} is scrolled vertically out of view. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1180 argument @var{position} defaults to the current position of point;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1181 @var{window}, to the selected window. Here is an example:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1182
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1183 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1184 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1185 (or (pos-visible-in-window-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1186 (point) (selected-window))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1187 (recenter 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1188 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1189 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1190
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1191 The @code{pos-visible-in-window-p} function considers only vertical
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1192 scrolling. If @var{position} is out of view only because @var{window}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1193 has been scrolled horizontally, @code{pos-visible-in-window-p} returns
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1194 @code{t}. @xref{Horizontal Scrolling}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1195 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1196
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1197 @node Vertical Scrolling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1198 @section Vertical Scrolling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1199 @cindex vertical scrolling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1200 @cindex scrolling vertically
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1201
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1202 Vertical scrolling means moving the text up or down in a window. It
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1203 works by changing the value of the window's display-start location. It
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1204 may also change the value of @code{window-point} to keep it on the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1205 screen.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1206
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1207 In the commands @code{scroll-up} and @code{scroll-down}, the directions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1208 ``up'' and ``down'' refer to the motion of the text in the buffer at which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1209 you are looking through the window. Imagine that the text is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1210 written on a long roll of paper and that the scrolling commands move the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1211 paper up and down. Thus, if you are looking at text in the middle of a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1212 buffer and repeatedly call @code{scroll-down}, you will eventually see
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1213 the beginning of the buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1214
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1215 Some people have urged that the opposite convention be used: they
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1216 imagine that the window moves over text that remains in place. Then
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1217 ``down'' commands would take you to the end of the buffer. This view is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1218 more consistent with the actual relationship between windows and the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1219 text in the buffer, but it is less like what the user sees. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1220 position of a window on the terminal does not move, and short scrolling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1221 commands clearly move the text up or down on the screen. We have chosen
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1222 names that fit the user's point of view.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1223
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1224 The scrolling functions (aside from @code{scroll-other-window}) have
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1225 unpredictable results if the current buffer is different from the buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1226 that is displayed in the selected window. @xref{Current Buffer}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1227
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1228 @deffn Command scroll-up &optional count
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1229 This function scrolls the text in the selected window upward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1230 @var{count} lines. If @var{count} is negative, scrolling is actually
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1231 downward.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1232
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1233 If @var{count} is @code{nil} (or omitted), then the length of scroll
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1234 is @code{next-screen-context-lines} lines less than the usable height of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1235 the window (not counting its modeline).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1236
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1237 @code{scroll-up} returns @code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1238 @end deffn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1239
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1240 @deffn Command scroll-down &optional count
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1241 This function scrolls the text in the selected window downward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1242 @var{count} lines. If @var{count} is negative, scrolling is actually
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1243 upward.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1244
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1245 If @var{count} is omitted or @code{nil}, then the length of the scroll
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1246 is @code{next-screen-context-lines} lines less than the usable height of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1247 the window (not counting its mode line).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1248
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1249 @code{scroll-down} returns @code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1250 @end deffn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1251
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1252 @deffn Command scroll-other-window &optional count
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1253 This function scrolls the text in another window upward @var{count}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1254 lines. Negative values of @var{count}, or @code{nil}, are handled
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1255 as in @code{scroll-up}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1256
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1257 You can specify a buffer to scroll with the variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1258 @code{other-window-scroll-buffer}. When the selected window is the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1259 minibuffer, the next window is normally the one at the top left corner.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1260 You can specify a different window to scroll with the variable
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1261 @code{minibuffer-scroll-window}. This variable has no effect when any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1262 other window is selected. @xref{Minibuffer Misc}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1263
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1264 When the minibuffer is active, it is the next window if the selected
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1265 window is the one at the bottom right corner. In this case,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1266 @code{scroll-other-window} attempts to scroll the minibuffer. If the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1267 minibuffer contains just one line, it has nowhere to scroll to, so the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1268 line reappears after the echo area momentarily displays the message
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1269 ``Beginning of buffer''.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1270 @end deffn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1271
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1272 @c Emacs 19 feature
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1273 @defvar other-window-scroll-buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1274 If this variable is non-@code{nil}, it tells @code{scroll-other-window}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1275 which buffer to scroll.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1276 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1277
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1278 @defopt scroll-step
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1279 This variable controls how scrolling is done automatically when point
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1280 moves off the screen. If the value is zero, then redisplay scrolls the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1281 text to center point vertically in the window. If the value is a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1282 positive integer @var{n}, then redisplay brings point back on screen by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1283 scrolling @var{n} lines in either direction, if possible; otherwise, it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1284 centers point. The default value is zero.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1285 @end defopt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1286
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1287 @defopt next-screen-context-lines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1288 The value of this variable is the number of lines of continuity to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1289 retain when scrolling by full screens. For example, @code{scroll-up}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1290 with an argument of @code{nil} scrolls so that this many lines at the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1291 bottom of the window appear instead at the top. The default value is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1292 @code{2}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1293 @end defopt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1294
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1295 @deffn Command recenter &optional count
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1296 @cindex centering point
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1297 This function scrolls the selected window to put the text where point
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1298 is located at a specified vertical position within the window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1299
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1300 If @var{count} is a nonnegative number, it puts the line containing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1301 point @var{count} lines down from the top of the window. If @var{count}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1302 is a negative number, then it counts upward from the bottom of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1303 window, so that @minus{}1 stands for the last usable line in the window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1304 If @var{count} is a non-@code{nil} list, then it stands for the line in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1305 the middle of the window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1306
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1307 If @var{count} is @code{nil}, @code{recenter} puts the line containing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1308 point in the middle of the window, then clears and redisplays the entire
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1309 selected frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1310
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1311 When @code{recenter} is called interactively, @var{count} is the raw
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1312 prefix argument. Thus, typing @kbd{C-u} as the prefix sets the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1313 @var{count} to a non-@code{nil} list, while typing @kbd{C-u 4} sets
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1314 @var{count} to 4, which positions the current line four lines from the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1315 top.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1316
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1317 With an argument of zero, @code{recenter} positions the current line at
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1318 the top of the window. This action is so handy that some people make a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1319 separate key binding to do this. For example,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1320
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1321 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1322 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1323 (defun line-to-top-of-window ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1324 "Scroll current line to top of window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1325 Replaces three keystroke sequence C-u 0 C-l."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1326 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1327 (recenter 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1328
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1329 (global-set-key [kp-multiply] 'line-to-top-of-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1330 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1331 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1332 @end deffn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1333
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1334 @node Horizontal Scrolling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1335 @section Horizontal Scrolling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1336 @cindex horizontal scrolling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1337
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1338 Because we read English first from top to bottom and second from left
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1339 to right, horizontal scrolling is not like vertical scrolling. Vertical
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1340 scrolling involves selection of a contiguous portion of text to display.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1341 Horizontal scrolling causes part of each line to go off screen. The
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1342 amount of horizontal scrolling is therefore specified as a number of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1343 columns rather than as a position in the buffer. It has nothing to do
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1344 with the display-start position returned by @code{window-start}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1345
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1346 Usually, no horizontal scrolling is in effect; then the leftmost
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1347 column is at the left edge of the window. In this state, scrolling to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1348 the right is meaningless, since there is no data to the left of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1349 screen to be revealed by it; so this is not allowed. Scrolling to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1350 left is allowed; it scrolls the first columns of text off the edge of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1351 the window and can reveal additional columns on the right that were
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1352 truncated before. Once a window has a nonzero amount of leftward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1353 horizontal scrolling, you can scroll it back to the right, but only so
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1354 far as to reduce the net horizontal scroll to zero. There is no limit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1355 to how far left you can scroll, but eventually all the text will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1356 disappear off the left edge.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1357
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1358 @deffn Command scroll-left count
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1359 This function scrolls the selected window @var{count} columns to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1360 left (or to the right if @var{count} is negative). The return value is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1361 the total amount of leftward horizontal scrolling in effect after the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1362 change---just like the value returned by @code{window-hscroll} (below).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1363 @end deffn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1364
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1365 @deffn Command scroll-right count
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1366 This function scrolls the selected window @var{count} columns to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1367 right (or to the left if @var{count} is negative). The return value is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1368 the total amount of leftward horizontal scrolling in effect after the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1369 change---just like the value returned by @code{window-hscroll} (below).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1370
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1371 Once you scroll a window as far right as it can go, back to its normal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1372 position where the total leftward scrolling is zero, attempts to scroll
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1373 any farther right have no effect.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1374 @end deffn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1375
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1376 @defun window-hscroll &optional window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1377 This function returns the total leftward horizontal scrolling of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1378 @var{window}---the number of columns by which the text in @var{window}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1379 is scrolled left past the left margin.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1380
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1381 The value is never negative. It is zero when no horizontal scrolling
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1382 has been done in @var{window} (which is usually the case).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1383
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1384 If @var{window} is @code{nil}, the selected window is used.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1385
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1386 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1387 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1388 (window-hscroll)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1389 @result{} 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1390 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1391 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1392 (scroll-left 5)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1393 @result{} 5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1394 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1395 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1396 (window-hscroll)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1397 @result{} 5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1398 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1399 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1400 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1401
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1402 @defun set-window-hscroll window columns
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1403 This function sets the number of columns from the left margin that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1404 @var{window} is scrolled to the value of @var{columns}. The argument
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1405 @var{columns} should be zero or positive; if not, it is taken as zero.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1406
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1407 The value returned is @var{columns}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1408
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1409 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1410 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1411 (set-window-hscroll (selected-window) 10)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1412 @result{} 10
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1413 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1414 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1415 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1416
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1417 Here is how you can determine whether a given position @var{position}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1418 is off the screen due to horizontal scrolling:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1419
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1420 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1421 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1422 (defun hscroll-on-screen (window position)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1423 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1424 (goto-char position)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1425 (and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1426 (>= (- (current-column) (window-hscroll window)) 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1427 (< (- (current-column) (window-hscroll window))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1428 (window-width window)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1429 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1430 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1431 @node Size of Window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1432 @section The Size of a Window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1433 @cindex window size
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1434 @cindex size of window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1435
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1436 An Emacs window is rectangular, and its size information consists of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1437 the height (in lines or pixels) and the width (in character positions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1438 or pixels). The modeline is included in the height. The pixel
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1439 width and height values include scrollbars and margins, while the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1440 line/character-position values do not.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1441
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1442 Note that the height in lines, and the width in characters, are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1443 determined by dividing the corresponding pixel value by the height or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1444 width of the default font in that window (if this is a variable-width
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1445 font, the average width is used). The resulting values may or may not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1446 represent the actual number of lines in the window, or the actual number
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1447 of character positions in any particular line, esp. if there are pixmaps
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1448 or various different fonts in the window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1449
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1450 The following functions return size information about a window:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1451
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1452 @defun window-height &optional window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1453 This function returns the number of lines in @var{window}, including
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1454 its modeline but not including the horizontal scrollbar, if any (this
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1455 is different from @code{window-pixel-height}). If @var{window} is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1456 @code{nil}, the function uses the selected window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1457
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1458 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1459 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1460 (window-height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1461 @result{} 40
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1462 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1463 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1464 (split-window-vertically)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1465 @result{} #<window on "windows.texi" 0x679b>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1466 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1467 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1468 (window-height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1469 @result{} 20
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1470 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1471 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1472 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1473
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1474 @defun window-width &optional window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1475 This function returns the number of columns in @var{window}, not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1476 including any left margin, right margin, or vertical scrollbar (this is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1477 different from @code{window-pixel-width}). If @var{window} is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1478 @code{nil}, the function uses the selected window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1479
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1480 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1481 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1482 (window-width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1483 @result{} 80
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1484 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1485 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1486 (window-height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1487 @result{} 40
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1488 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1489 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1490 (split-window-horizontally)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1491 @result{} #<window on "windows.texi" 0x7538>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1492 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1493 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1494 (window-width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1495 @result{} 39
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1496 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1497 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1498 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1499
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1500 Note that after splitting the window into two side-by-side windows,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1501 the width of each window is less the half the width of the original
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1502 window because a vertical scrollbar appeared between the windows,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1503 occupying two columns worth of space. Also, the height shrunk by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1504 one because horizontal scrollbars appeared that weren't there
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1505 before. (Horizontal scrollbars appear only when lines are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1506 truncated, not when they wrap. This is usually the case for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1507 horizontally split windows but not for full-frame windows. You
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1508 can change this using the variables @code{truncate-lines} and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1509 @code{truncate-partial-width-windows}.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1510
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1511 @defun window-pixel-height &optional window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1512 This function returns the height of @var{window} in pixels, including
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1513 its modeline and horizontal scrollbar, if any. If @var{window} is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1514 @code{nil}, the function uses the selected window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1515
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1516 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1517 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1518 (window-pixel-height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1519 @result{} 600
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1520 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1521 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1522 (split-window-vertically)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1523 @result{} #<window on "windows.texi" 0x68a6>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1524 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1525 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1526 (window-pixel-height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1527 @result{} 300
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1528 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1529 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1530 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1531
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1532 @defun window-pixel-width &optional window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1533 This function returns the width of @var{window} in pixels, including
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1534 any left margin, right margin, or vertical scrollbar that may be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1535 displayed alongside it. If @var{window} is @code{nil}, the function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1536 uses the selected window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1537
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1538 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1539 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1540 (window-pixel-width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1541 @result{} 735
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1542 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1543 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1544 (window-pixel-height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1545 @result{} 600
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1546 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1547 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1548 (split-window-horizontally)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1549 @result{} #<window on "windows.texi" 0x7538>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1550 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1551 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1552 (window-pixel-width)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1553 @result{} 367
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1554 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1555 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1556 (window-pixel-height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1557 @result{} 600
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1558 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1559 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1560 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1561
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1562 @node Position of Window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1563 @section The Position of a Window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1564 @cindex window position
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1565 @cindex position of window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1566
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1567 XEmacs provides functions to determine the absolute location of windows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1568 within a frame, and the relative location of a window in comparison to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1569 other windows in the same frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1570
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1571 @defun window-pixel-edges &optional window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1572 This function returns a list of the pixel edge coordinates of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1573 @var{window}. If @var{window} is @code{nil}, the selected window is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1574 used.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1575
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1576 The order of the list is @code{(@var{left} @var{top} @var{right}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1577 @var{bottom})}, all elements relative to 0, 0 at the top left corner of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1578 the frame. The element @var{right} of the value is one more than the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1579 rightmost pixel used by @var{window} (including any left margin, right
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1580 margin, or vertical scrollbar displayed alongside it), and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1581 @var{bottom} is one more than the bottommost pixel used by @var{window}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1582 (including any modeline or horizontal scrollbar displayed above
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1583 or below it). The frame area does not include any frame menubars or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1584 toolbars that may be displayed; thus, for example, if there is only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1585 one window on the frame, the values for @var{left} and @var{top} will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1586 always be 0.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1587
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1588 If @var{window} is at the upper left corner of its frame, @var{right}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1589 and @var{bottom} are the same as the values returned by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1590 @code{(window-pixel-width)} and @code{(window-pixel-height)}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1591 respectively, and @var{top} and @var{bottom} are zero.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1592 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1593
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1594 There is no longer a function @code{window-edges} because it does not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1595 make sense in a world with variable-width and variable-height lines,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1596 as are allowed in XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1597
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1598 @defun window-highest-p window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1599 This function returns non-@code{nil} if @var{window} is along the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1600 top of its frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1601 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1602
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1603 @defun window-lowest-p window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1604 This function returns non-@code{nil} if @var{window} is along the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1605 bottom of its frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1606 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1607
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1608 @node Resizing Windows
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1609 @section Changing the Size of a Window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1610 @cindex window resizing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1611 @cindex changing window size
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1612 @cindex window size, changing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1613
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1614 The window size functions fall into two classes: high-level commands
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1615 that change the size of windows and low-level functions that access
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1616 window size. XEmacs does not permit overlapping windows or gaps between
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1617 windows, so resizing one window affects other windows.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1618
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1619 @deffn Command enlarge-window size &optional horizontal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1620 This function makes the selected window @var{size} lines taller,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1621 stealing lines from neighboring windows. It takes the lines from one
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1622 window at a time until that window is used up, then takes from another.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1623 If a window from which lines are stolen shrinks below
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1624 @code{window-min-height} lines, that window disappears.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1625
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1626 If @var{horizontal} is non-@code{nil}, this function makes
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1627 @var{window} wider by @var{size} columns, stealing columns instead of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1628 lines. If a window from which columns are stolen shrinks below
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1629 @code{window-min-width} columns, that window disappears.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1630
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1631 If the requested size would exceed that of the window's frame, then the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1632 function makes the window occupy the entire height (or width) of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1633 frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1634
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1635 If @var{size} is negative, this function shrinks the window by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1636 @minus{}@var{size} lines or columns. If that makes the window smaller
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1637 than the minimum size (@code{window-min-height} and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1638 @code{window-min-width}), @code{enlarge-window} deletes the window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1639
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1640 @code{enlarge-window} returns @code{nil}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1641 @end deffn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1642
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1643 @deffn Command enlarge-window-horizontally columns
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1644 This function makes the selected window @var{columns} wider.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1645 It could be defined as follows:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1646
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1647 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1648 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1649 (defun enlarge-window-horizontally (columns)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1650 (enlarge-window columns t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1651 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1652 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1653 @end deffn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1654
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1655 @deffn Command shrink-window size &optional horizontal
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1656 This function is like @code{enlarge-window} but negates the argument
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1657 @var{size}, making the selected window smaller by giving lines (or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1658 columns) to the other windows. If the window shrinks below
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1659 @code{window-min-height} or @code{window-min-width}, then it disappears.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1660
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1661 If @var{size} is negative, the window is enlarged by @minus{}@var{size}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1662 lines or columns.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1663 @end deffn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1664
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1665 @deffn Command shrink-window-horizontally columns
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1666 This function makes the selected window @var{columns} narrower.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1667 It could be defined as follows:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1668
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1669 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1670 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1671 (defun shrink-window-horizontally (columns)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1672 (shrink-window columns t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1673 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1674 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1675 @end deffn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1676
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1677 @cindex minimum window size
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1678 The following two variables constrain the window-size-changing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1679 functions to a minimum height and width.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1680
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1681 @defopt window-min-height
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1682 The value of this variable determines how short a window may become
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1683 before it is automatically deleted. Making a window smaller than
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1684 @code{window-min-height} automatically deletes it, and no window may be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1685 created shorter than this. The absolute minimum height is two (allowing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1686 one line for the mode line, and one line for the buffer display).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1687 Actions that change window sizes reset this variable to two if it is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1688 less than two. The default value is 4.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1689 @end defopt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1690
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1691 @defopt window-min-width
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1692 The value of this variable determines how narrow a window may become
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1693 before it automatically deleted. Making a window smaller than
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1694 @code{window-min-width} automatically deletes it, and no window may be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1695 created narrower than this. The absolute minimum width is one; any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1696 value below that is ignored. The default value is 10.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1697 @end defopt
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1698
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1699 @defvar window-size-change-functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1700 This variable holds a list of functions to be called if the size of any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1701 window changes for any reason. The functions are called just once per
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1702 redisplay, and just once for each frame on which size changes have
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1703 occurred.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1704
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1705 Each function receives the frame as its sole argument. There is no
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1706 direct way to find out which windows changed size, or precisely how;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1707 however, if your size-change function keeps track, after each change, of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1708 the windows that interest you, you can figure out what has changed by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1709 comparing the old size data with the new.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1710
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1711 Creating or deleting windows counts as a size change, and therefore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1712 causes these functions to be called. Changing the frame size also
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1713 counts, because it changes the sizes of the existing windows.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1714
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1715 It is not a good idea to use @code{save-window-excursion} in these
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1716 functions, because that always counts as a size change, and it would
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1717 cause these functions to be called over and over. In most cases,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1718 @code{save-selected-window} is what you need here.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1719 @end defvar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1720
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1721 @node Window Configurations
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1722 @section Window Configurations
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1723 @cindex window configurations
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1724 @cindex saving window information
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1725
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1726 A @dfn{window configuration} records the entire layout of a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1727 frame---all windows, their sizes, which buffers they contain, what part
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1728 of each buffer is displayed, and the values of point and the mark. You
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1729 can bring back an entire previous layout by restoring a window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1730 configuration previously saved.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1731
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1732 If you want to record all frames instead of just one, use a frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1733 configuration instead of a window configuration. @xref{Frame
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1734 Configurations}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1735
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1736 @defun current-window-configuration
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1737 This function returns a new object representing XEmacs's current window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1738 configuration, namely the number of windows, their sizes and current
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1739 buffers, which window is the selected window, and for each window the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1740 displayed buffer, the display-start position, and the positions of point
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1741 and the mark. An exception is made for point in the current buffer,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1742 whose value is not saved.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1743 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1744
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1745 @defun set-window-configuration configuration
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1746 This function restores the configuration of XEmacs's windows and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1747 buffers to the state specified by @var{configuration}. The argument
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1748 @var{configuration} must be a value that was previously returned by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1749 @code{current-window-configuration}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1750
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1751 This function always counts as a window size change and triggers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1752 execution of the @code{window-size-change-functions}. (It doesn't know
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1753 how to tell whether the new configuration actually differs from the old
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1754 one.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1755
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1756 Here is a way of using this function to get the same effect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1757 as @code{save-window-excursion}:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1758
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1759 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1760 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1761 (let ((config (current-window-configuration)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1762 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1763 (progn (split-window-vertically nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1764 @dots{})
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1765 (set-window-configuration config)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1766 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1767 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1768 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1769
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1770 @defspec save-window-excursion forms@dots{}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1771 This special form records the window configuration, executes @var{forms}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1772 in sequence, then restores the earlier window configuration. The window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1773 configuration includes the value of point and the portion of the buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1774 that is visible. It also includes the choice of selected window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1775 However, it does not include the value of point in the current buffer;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1776 use @code{save-excursion} if you wish to preserve that.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1777
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1778 Don't use this construct when @code{save-selected-window} is all you need.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1779
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1780 Exit from @code{save-window-excursion} always triggers execution of the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1781 @code{window-size-change-functions}. (It doesn't know how to tell
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1782 whether the restored configuration actually differs from the one in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1783 effect at the end of the @var{forms}.)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1784
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1785 The return value is the value of the final form in @var{forms}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1786 For example:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1787
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1788 @example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1789 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1790 (split-window)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1791 @result{} #<window 25 on control.texi>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1792 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1793 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1794 (setq w (selected-window))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1795 @result{} #<window 19 on control.texi>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1796 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1797 @group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1798 (save-window-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1799 (delete-other-windows w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1800 (switch-to-buffer "foo")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1801 'do-something)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1802 @result{} do-something
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1803 ;; @r{The frame is now split again.}
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1804 @end group
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1805 @end example
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1806 @end defspec
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1807
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1808 @defun window-configuration-p object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1809 This function returns @code{t} if @var{object} is a window configuration.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1810 @end defun
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1811
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1812 Primitives to look inside of window configurations would make sense,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1813 but none are implemented. It is not clear they are useful enough to be
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1814 worth implementing.