annotate man/lispref/windows.texi @ 5686:c6b1500299a7

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