aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Hagerty1996-07-14 01:59:42 +0000
committerDaniel Hagerty1996-07-14 01:59:42 +0000
commit3c29caa89ce1481405e526a335941d6a4bf1367f (patch)
treefd8cdd9fb03e42b4aa65d08036351a66f745c00f
parentc36bcf1b4a142fb5a1396ad0bb681a5349c8fe50 (diff)
downloademacs-3c29caa89ce1481405e526a335941d6a4bf1367f.tar.gz
emacs-3c29caa89ce1481405e526a335941d6a4bf1367f.zip
Added Richard's diffs to this file, fixed a couple of small bugs
texinfo related bugs.
-rw-r--r--lispref/windows.texi212
1 files changed, 137 insertions, 75 deletions
diff --git a/lispref/windows.texi b/lispref/windows.texi
index 1a8093384b6..5b2c9c9cd6b 100644
--- a/lispref/windows.texi
+++ b/lispref/windows.texi
@@ -1,6 +1,6 @@
1@c -*-texinfo-*- 1@c -*-texinfo-*-
2@c This is part of the GNU Emacs Lisp Reference Manual. 2@c This is part of the GNU Emacs Lisp Reference Manual.
3@c Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc. 3@c Copyright (C) 1990, 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
4@c See the file elisp.texi for copying conditions. 4@c See the file elisp.texi for copying conditions.
5@setfilename ../info/windows 5@setfilename ../info/windows
6@node Windows, Frames, Buffers, Top 6@node Windows, Frames, Buffers, Top
@@ -11,24 +11,25 @@ Emacs windows. See @ref{Display}, for information on how text is
11displayed in windows. 11displayed in windows.
12 12
13@menu 13@menu
14* Basic Windows:: Basic information on using windows. 14* Basic Windows:: Basic information on using windows.
15* Splitting Windows:: Splitting one window into two windows. 15* Splitting Windows:: Splitting one window into two windows.
16* Deleting Windows:: Deleting a window gives its space to other windows. 16* Deleting Windows:: Deleting a window gives its space to other windows.
17* Selecting Windows:: The selected window is the one that you edit in. 17* Selecting Windows:: The selected window is the one that you edit in.
18* Cyclic Window Ordering:: Moving around the existing windows. 18* Cyclic Window Ordering:: Moving around the existing windows.
19* Buffers and Windows:: Each window displays the contents of a buffer. 19* Buffers and Windows:: Each window displays the contents of a buffer.
20* Displaying Buffers:: Higher-lever functions for displaying a buffer 20* Displaying Buffers:: Higher-lever functions for displaying a buffer
21 and choosing a window for it. 21 and choosing a window for it.
22* Choosing Window:: How to choose a window for displaying a buffer. 22* Choosing Window:: How to choose a window for displaying a buffer.
23* Window Point:: Each window has its own location of point. 23* Window Point:: Each window has its own location of point.
24* Window Start:: The display-start position controls which text 24* Window Start:: The display-start position controls which text
25 is on-screen in the window. 25 is on-screen in the window.
26* Vertical Scrolling:: Moving text up and down in the window. 26* Vertical Scrolling:: Moving text up and down in the window.
27* Horizontal Scrolling:: Moving text sideways on the window. 27* Scrolling Hooks:: Hooks that run when you scroll a window.
28* Size of Window:: Accessing the size of a window. 28* Horizontal Scrolling:: Moving text sideways on the window.
29* Resizing Windows:: Changing the size of a window. 29* Size of Window:: Accessing the size of a window.
30* Coordinates and Windows::Converting coordinates to windows. 30* Resizing Windows:: Changing the size of a window.
31* Window Configurations:: Saving and restoring the state of the screen. 31* Coordinates and Windows:: Converting coordinates to windows.
32* Window Configurations:: Saving and restoring the state of the screen.
32@end menu 33@end menu
33 34
34@node Basic Windows 35@node Basic Windows
@@ -66,31 +67,31 @@ life. (@xref{Deleting Windows}.)
66@item 67@item
67containing frame 68containing frame
68 69
69@item 70@item
70window height 71window height
71 72
72@item 73@item
73window width 74window width
74 75
75@item 76@item
76window edges with respect to the screen or frame 77window edges with respect to the screen or frame
77 78
78@item 79@item
79the buffer it displays 80the buffer it displays
80 81
81@item 82@item
82position within the buffer at the upper left of the window 83position within the buffer at the upper left of the window
83 84
84@item 85@item
85amount of horizontal scrolling, in columns 86amount of horizontal scrolling, in columns
86 87
87@item 88@item
88point 89point
89 90
90@item 91@item
91the mark 92the mark
92 93
93@item 94@item
94how recently the window was selected 95how recently the window was selected
95@end itemize 96@end itemize
96 97
@@ -173,7 +174,7 @@ lines high by 80 columns wide; then the window is split.
173 174
174@group 175@group
175;; @r{Returns window created} 176;; @r{Returns window created}
176(setq w2 (split-window w 15)) 177(setq w2 (split-window w 15))
177 @result{} #<window 28 on windows.texi> 178 @result{} #<window 28 on windows.texi>
178@end group 179@end group
179@group 180@group
@@ -191,8 +192,8 @@ The screen looks like this:
191 192
192@smallexample 193@smallexample
193@group 194@group
194 __________ 195 __________
195 | | line 0 196 | | line 0
196 | w | 197 | w |
197 |__________| 198 |__________|
198 | | line 15 199 | | line 15
@@ -230,8 +231,8 @@ Now, the screen looks like this:
230@smallexample 231@smallexample
231@group 232@group
232 column 35 233 column 35
233 __________ 234 __________
234 | | | line 0 235 | | | line 0
235 | w | w3 | 236 | w | w3 |
236 |___|______| 237 |___|______|
237 | | line 15 238 | | line 15
@@ -417,9 +418,15 @@ The return value is @var{window}.
417@defmac save-selected-window forms@dots{} 418@defmac save-selected-window forms@dots{}
418This macro records the selected window, executes @var{forms} 419This macro records the selected window, executes @var{forms}
419in sequence, then restores the earlier selected window. 420in sequence, then restores the earlier selected window.
420It does not save or restore anything about the sizes, arrangement 421
422This macro does not save or restore anything about the sizes, arrangement
421or contents of windows; therefore, if the @var{forms} change them, 423or contents of windows; therefore, if the @var{forms} change them,
422the changes are permanent. 424the change persists.
425
426Each frame, at any time, has a window selected within the frame. This
427macro only saves @emph{the} selected window; it does not save anything
428about other frames. If the @var{forms} select some other frame and
429alter the window selected within it, the change persists.
423@end defmac 430@end defmac
424 431
425@cindex finding windows 432@cindex finding windows
@@ -468,7 +475,7 @@ considered. See @code{get-lru-window}, above.
468@section Cyclic Ordering of Windows 475@section Cyclic Ordering of Windows
469@cindex cyclic ordering of windows 476@cindex cyclic ordering of windows
470@cindex ordering of windows, cyclic 477@cindex ordering of windows, cyclic
471@cindex window ordering, cyclic 478@cindex window ordering, cyclic
472 479
473 When you use the command @kbd{C-x o} (@code{other-window}) to select 480 When you use the command @kbd{C-x o} (@code{other-window}) to select
474the next window, it moves through all the windows on the screen in a 481the next window, it moves through all the windows on the screen in a
@@ -529,7 +536,7 @@ Consider all windows in all visible or iconified frames.
529Consider precisely the windows in @var{window}'s frame, and no others. 536Consider precisely the windows in @var{window}'s frame, and no others.
530@end table 537@end table
531 538
532This example assumes there are two windows, both displaying the 539This example assumes there are two windows, both displaying the
533buffer @samp{windows.texi}: 540buffer @samp{windows.texi}:
534 541
535@example 542@example
@@ -639,6 +646,32 @@ If it is a frame, consider windows on that frame.
639@end itemize 646@end itemize
640@end defun 647@end defun
641 648
649@defun get-buffer-window-list buffer-or-name &optional minibuf all-frames
650This function returns a list of all the windows currently displaying
651@var{buffer-or-name}.
652
653The two optional arguments work like the optional arguments of
654@code{next-window} (@pxref{Cyclic Window Ordering}); they are @emph{not}
655like the single optional argument of @code{get-buffer-window}. Perhaps
656we should change @code{get-buffer-window} in the future to make it
657compatible with the other functions.
658
659The argument @var{all-frames} controls which windows to consider.
660
661@itemize @bullet
662@item
663If it is @code{nil}, consider windows on the selected frame.
664@item
665If it is @code{t}, consider windows on all frames.
666@item
667If it is @code{visible}, consider windows on all visible frames.
668@item
669If it is 0, consider windows on all visible or iconified frames.
670@item
671If it is a frame, consider windows on that frame.
672@end itemize
673@end defun
674
642@node Displaying Buffers 675@node Displaying Buffers
643@section Displaying Buffers in Windows 676@section Displaying Buffers in Windows
644@cindex switching to a buffer 677@cindex switching to a buffer
@@ -990,7 +1023,7 @@ inevitably, at the beginning of a text line.
990@cindex window top line 1023@cindex window top line
991This function returns the display-start position of window 1024This function returns the display-start position of window
992@var{window}. If @var{window} is @code{nil}, the selected window is 1025@var{window}. If @var{window} is @code{nil}, the selected window is
993used. For example, 1026used. For example,
994 1027
995@example 1028@example
996@group 1029@group
@@ -1252,14 +1285,65 @@ separate key binding to do this. For example,
1252(defun line-to-top-of-window () 1285(defun line-to-top-of-window ()
1253 "Scroll current line to top of window. 1286 "Scroll current line to top of window.
1254Replaces three keystroke sequence C-u 0 C-l." 1287Replaces three keystroke sequence C-u 0 C-l."
1255 (interactive) 1288 (interactive)
1256 (recenter 0)) 1289 (recenter 0))
1257 1290
1258(global-set-key [kp-multiply] 'line-to-top-of-window) 1291(global-set-key [kp-multiply] 'line-to-top-of-window)
1259@end group 1292@end group
1260@end example 1293@end example
1261@end deffn 1294@end deffn
1262 1295
1296@node Scrolling Hooks
1297@section Hooks for Vertical Scrolling
1298
1299This section describes how a Lisp program can take action whenever a
1300window displays a different part of its buffer or a different buffer.
1301There are three actions that can change this: scrolling the window,
1302switching buffers in the window, and changing the size of the window.
1303The first two actions run @code{window-scroll-functions}; the last runs
1304@code{window-size-change-functions}. The paradigmatic use of these
1305hooks is Lazy Lock mode; see @ref{Support Modes, Lazy Lock, Font Lock
1306Support Modes, emacs, The GNU Emacs Manual}.
1307
1308@defvar window-scroll-functions
1309This variable holds a list of functions that Emacs should call before
1310redisplaying a window with scrolling. It is not a normal hook, because
1311each function is called with two arguments: the window, and its new
1312display-start position.
1313
1314Displaying a different buffer in the window also runs these functions.
1315
1316These functions cannot expect @code{window-end} (@pxref{Window Start})
1317to return a meaningful value, because that value is updated only by
1318redisplaying the buffer. So if one of these functions needs to know the
1319last character that will fit in the window with its current
1320display-start position, it has to find that character using
1321@code{vertical-motion} (@pxref{Screen Lines}).
1322@end defvar
1323
1324@defvar window-size-change-functions
1325This variable holds a list of functions to be called if the size of any
1326window changes for any reason. The functions are called just once per
1327redisplay, and just once for each frame on which size changes have
1328occurred.
1329
1330Each function receives the frame as its sole argument. There is no
1331direct way to find out which windows on that frame have changed size, or
1332precisely how. However, if a size-change function records, at each
1333call, the existing windows and their sizes, it can also compare the
1334present sizes and the previous sizes.
1335
1336Creating or deleting windows counts as a size change, and therefore
1337causes these functions to be called. Changing the frame size also
1338counts, because it changes the sizes of the existing windows.
1339
1340It is not a good idea to use @code{save-window-excursion} (@pxref{Window
1341Configurations}) in these functions, because that always counts as a
1342size change, and it would cause these functions to be called over and
1343over. In most cases, @code{save-selected-window} (@pxref{Selecting
1344Windows}) is what you need here.
1345@end defvar
1346
1263@node Horizontal Scrolling 1347@node Horizontal Scrolling
1264@section Horizontal Scrolling 1348@section Horizontal Scrolling
1265@cindex horizontal scrolling 1349@cindex horizontal scrolling
@@ -1349,9 +1433,9 @@ is off the screen due to horizontal scrolling:
1349@example 1433@example
1350@group 1434@group
1351(defun hscroll-on-screen (window position) 1435(defun hscroll-on-screen (window position)
1352 (save-excursion 1436 (save-excursion
1353 (goto-char position) 1437 (goto-char position)
1354 (and 1438 (and
1355 (>= (- (current-column) (window-hscroll window)) 0) 1439 (>= (- (current-column) (window-hscroll window)) 0)
1356 (< (- (current-column) (window-hscroll window)) 1440 (< (- (current-column) (window-hscroll window))
1357 (window-width window))))) 1441 (window-width window)))))
@@ -1455,15 +1539,15 @@ holds the mode line, shown here with @samp{xxxxxxxxx}.
1455 1539
1456@example 1540@example
1457@group 1541@group
1458 0 1542 0
1459 _______ 1543 _______
1460 0 | | 1544 0 | |
1461 | | 1545 | |
1462 | | 1546 | |
1463 | | 1547 | |
1464 xxxxxxxxx 4 1548 xxxxxxxxx 4
1465 1549
1466 7 1550 7
1467@end group 1551@end group
1468@end example 1552@end example
1469 1553
@@ -1480,9 +1564,9 @@ and the edges of the right window are @w{@samp{4 0 7 3}}.
1480@example 1564@example
1481@group 1565@group
1482 ___ ___ 1566 ___ ___
1483 | | | 1567 | | |
1484 | | | 1568 | | |
1485 xxxxxxxxx 1569 xxxxxxxxx
1486 1570
1487 0 34 7 1571 0 34 7
1488@end group 1572@end group
@@ -1521,7 +1605,7 @@ If @var{size} is negative, this function shrinks the window by
1521than the minimum size (@code{window-min-height} and 1605than the minimum size (@code{window-min-height} and
1522@code{window-min-width}), @code{enlarge-window} deletes the window. 1606@code{window-min-width}), @code{enlarge-window} deletes the window.
1523 1607
1524@code{enlarge-window} returns @code{nil}. 1608@code{enlarge-window} returns @code{nil}.
1525@end deffn 1609@end deffn
1526 1610
1527@deffn Command enlarge-window-horizontally columns 1611@deffn Command enlarge-window-horizontally columns
@@ -1580,28 +1664,6 @@ created narrower than this. The absolute minimum width is one; any
1580value below that is ignored. The default value is 10. 1664value below that is ignored. The default value is 10.
1581@end defopt 1665@end defopt
1582 1666
1583@defvar window-size-change-functions
1584This variable holds a list of functions to be called if the size of any
1585window changes for any reason. The functions are called just once per
1586redisplay, and just once for each frame on which size changes have
1587occurred.
1588
1589Each function receives the frame as its sole argument. There is no
1590direct way to find out which windows changed size, or precisely how;
1591however, if your size-change function keeps track, after each change, of
1592the windows that interest you, you can figure out what has changed by
1593comparing the old size data with the new.
1594
1595Creating or deleting windows counts as a size change, and therefore
1596causes these functions to be called. Changing the frame size also
1597counts, because it changes the sizes of the existing windows.
1598
1599It is not a good idea to use @code{save-window-excursion} in these
1600functions, because that always counts as a size change, and it would
1601cause these functions to be called over and over. In most cases,
1602@code{save-selected-window} is what you need here.
1603@end defvar
1604
1605@node Coordinates and Windows 1667@node Coordinates and Windows
1606@section Coordinates and Windows 1668@section Coordinates and Windows
1607 1669
@@ -1647,7 +1709,7 @@ The coordinates are in the mode line of @var{window}.
1647 1709
1648@item vertical-split 1710@item vertical-split
1649The coordinates are in the vertical line between @var{window} and its 1711The coordinates are in the vertical line between @var{window} and its
1650neighbor to the right. This value occurs only if the window doesn't 1712neighbor to the right. This value occurs only if the window doesn't
1651have a scroll bar; positions in a scroll bar are considered outside the 1713have a scroll bar; positions in a scroll bar are considered outside the
1652window. 1714window.
1653 1715