aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/lispref/ChangeLog17
-rw-r--r--doc/lispref/buffers.texi20
-rw-r--r--doc/lispref/windows.texi267
3 files changed, 165 insertions, 139 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 23da5634889..adb52dc7f2b 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,20 @@
12012-11-23 Martin Rudalics <rudalics@gmx.at>
2
3 * windows.texi (Basic Windows): Fix typo.
4 (Windows and Frames): Fix example. Move description of
5 window-in-direction here.
6 (Recombining Windows): Fix example.
7 (Buffers and Windows): Fix description of
8 replace-buffer-in-windows.
9 (Switching Buffers): Reword.
10 (Display Action Functions): Minor adjustments.
11 (Choosing Window Options): Minor fixes.
12 (Window History): Minor rewording.
13 (Dedicated Windows): Correct and reword part describing how
14 dedicatedness affects functions removing buffers or windows.
15 * buffers.texi (The Buffer List): Fix description of
16 bury-buffer.
17
12012-11-23 Chong Yidong <cyd@gnu.org> 182012-11-23 Chong Yidong <cyd@gnu.org>
2 19
3 * modes.texi (%-Constructs): Fix statement about mode construct 20 * modes.texi (%-Constructs): Fix statement about mode construct
diff --git a/doc/lispref/buffers.texi b/doc/lispref/buffers.texi
index 4a556895de7..6462788b34e 100644
--- a/doc/lispref/buffers.texi
+++ b/doc/lispref/buffers.texi
@@ -886,7 +886,7 @@ This buffer therefore becomes the least desirable candidate for
886@code{other-buffer} to return. The argument can be either a buffer 886@code{other-buffer} to return. The argument can be either a buffer
887itself or the name of one. 887itself or the name of one.
888 888
889This functions operates on each frame's @code{buffer-list} parameter as 889This function operates on each frame's @code{buffer-list} parameter as
890well as the fundamental buffer list; therefore, the buffer that you bury 890well as the fundamental buffer list; therefore, the buffer that you bury
891will come last in the value of @code{(buffer-list @var{frame})} and in 891will come last in the value of @code{(buffer-list @var{frame})} and in
892the value of @code{(buffer-list)}. In addition, it also puts the buffer 892the value of @code{(buffer-list)}. In addition, it also puts the buffer
@@ -896,15 +896,15 @@ History}) provided it is shown in that window.
896If @var{buffer-or-name} is @code{nil} or omitted, this means to bury the 896If @var{buffer-or-name} is @code{nil} or omitted, this means to bury the
897current buffer. In addition, if the current buffer is displayed in the 897current buffer. In addition, if the current buffer is displayed in the
898selected window, this makes sure that the window is either deleted or 898selected window, this makes sure that the window is either deleted or
899another buffer is shown in it. More precisely, if the window is 899another buffer is shown in it. More precisely, if the selected window
900dedicated (@pxref{Dedicated Windows}) and there are other windows on its 900is dedicated (@pxref{Dedicated Windows}) and there are other windows on
901frame, the window is deleted. If the window is both dedicated and the 901its frame, the window is deleted. If it is the only window on its frame
902only window on its frame's terminal, the function specified by 902and that frame is not the only frame on its terminal, the frame is
903@code{frame-auto-hide-function} (@pxref{Quitting Windows}) will deal 903``dismissed'' by calling the function specified by
904with the window. If the window is not dedicated to its buffer, it calls 904@code{frame-auto-hide-function} (@pxref{Quitting Windows}). Otherwise,
905@code{switch-to-prev-buffer} (@pxref{Window History}) to show another 905it calls @code{switch-to-prev-buffer} (@pxref{Window History}) to show
906buffer in that window. If @var{buffer-or-name} is displayed in some 906another buffer in that window. If @var{buffer-or-name} is displayed in
907other window, it remains displayed there. 907some other window, it remains displayed there.
908 908
909To replace a buffer in all the windows that display it, use 909To replace a buffer in all the windows that display it, use
910@code{replace-buffer-in-windows}, @xref{Buffers and Windows}. 910@code{replace-buffer-in-windows}, @xref{Buffers and Windows}.
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index 46b31ef0d9f..224c4736c92 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -51,9 +51,9 @@ is displayed in windows.
51@section Basic Concepts of Emacs Windows 51@section Basic Concepts of Emacs Windows
52@cindex window 52@cindex window
53 53
54A @dfn{window} is a area of the screen that is used to display a 54A @dfn{window} is an area of the screen that is used to display a buffer
55buffer (@pxref{Buffers}). In Emacs Lisp, windows are represented by a 55(@pxref{Buffers}). In Emacs Lisp, windows are represented by a special
56special Lisp object type. 56Lisp object type.
57 57
58@cindex multiple windows 58@cindex multiple windows
59 Windows are grouped into frames (@pxref{Frames}). Each frame 59 Windows are grouped into frames (@pxref{Frames}). Each frame
@@ -247,12 +247,12 @@ following example:
247@end smallexample 247@end smallexample
248 248
249@noindent 249@noindent
250The root window of this frame is an internal window, @code{W1}. Its 250The root window of this frame is an internal window, @var{W1}. Its
251child windows form a horizontal combination, consisting of the live 251child windows form a horizontal combination, consisting of the live
252window @code{W2} and the internal window @code{W3}. The child windows 252window @var{W2} and the internal window @var{W3}. The child windows
253of @code{W3} form a vertical combination, consisting of the live 253of @var{W3} form a vertical combination, consisting of the live
254windows @code{W4} and @code{W5}. Hence, the live windows in this 254windows @var{W4} and @var{W5}. Hence, the live windows in this
255window tree are @code{W2} @code{W4}, and @code{W5}. 255window tree are @var{W2} @var{W4}, and @var{W5}.
256 256
257 The following functions can be used to retrieve a child window of an 257 The following functions can be used to retrieve a child window of an
258internal window, and the siblings of a child window. 258internal window, and the siblings of a child window.
@@ -308,8 +308,8 @@ The functions @code{window-next-sibling} and
308and previous window, respectively, in the cyclic ordering of windows 308and previous window, respectively, in the cyclic ordering of windows
309(@pxref{Cyclic Window Ordering}). 309(@pxref{Cyclic Window Ordering}).
310 310
311 You can use the following functions to find the first live window on 311 You can use the following functions to find the first live window on a
312a frame, and to retrieve the entire window tree of a frame: 312frame and the window nearest to a given window.
313 313
314@defun frame-first-window &optional frame-or-window 314@defun frame-first-window &optional frame-or-window
315This function returns the live window at the upper left corner of the 315This function returns the live window at the upper left corner of the
@@ -318,9 +318,32 @@ frame specified by @var{frame-or-window}. The argument
318to the selected frame. If @var{frame-or-window} specifies a window, 318to the selected frame. If @var{frame-or-window} specifies a window,
319this function returns the first window on that window's frame. Under 319this function returns the first window on that window's frame. Under
320the assumption that the frame from our canonical example is selected 320the assumption that the frame from our canonical example is selected
321@code{(frame-first-window)} returns @code{W2}. 321@code{(frame-first-window)} returns @var{W2}.
322@end defun 322@end defun
323 323
324@cindex window in direction
325@defun window-in-direction direction &optional window ignore
326This function returns the nearest live window in direction
327@var{direction} as seen from the position of @code{window-point} in
328window @var{window}. The argument @var{direction} must be one of
329@code{above}, @code{below}, @code{left} or @code{right}. The optional
330argument @var{window} must denote a live window and defaults to the
331selected one.
332
333This function does not return a window whose @code{no-other-window}
334parameter is non-@code{nil} (@pxref{Window Parameters}). If the nearest
335window's @code{no-other-window} parameter is non-@code{nil}, this
336function tries to find another window in the indicated direction whose
337@code{no-other-window} parameter is @code{nil}. If the optional
338argument @var{ignore} is non-@code{nil}, a window may be returned even
339if its @code{no-other-window} parameter is non-@code{nil}.
340
341If it doesn't find a suitable window, this function returns @code{nil}.
342@end defun
343
344The following function allows to retrieve the entire window tree of a
345frame:
346
324@defun window-tree &optional frame 347@defun window-tree &optional frame
325This function returns a list representing the window tree for frame 348This function returns a list representing the window tree for frame
326@var{frame}. If @var{frame} is omitted or @code{nil}, it defaults to 349@var{frame}. If @var{frame} is omitted or @code{nil}, it defaults to
@@ -925,9 +948,9 @@ are the opposite of what they are in those other functions.
925@node Recombining Windows 948@node Recombining Windows
926@section Recombining Windows 949@section Recombining Windows
927 950
928When deleting the last sibling of a window @code{W}, its parent window 951When deleting the last sibling of a window @var{W}, its parent window
929is deleted too, with @code{W} replacing it in the window tree. This 952is deleted too, with @var{W} replacing it in the window tree. This
930means that @code{W} must be recombined with its parent's siblings to 953means that @var{W} must be recombined with its parent's siblings to
931form a new window combination (@pxref{Windows and Frames}). In some 954form a new window combination (@pxref{Windows and Frames}). In some
932occasions, deleting a live window may even entail the deletion of two 955occasions, deleting a live window may even entail the deletion of two
933internal windows. 956internal windows.
@@ -952,20 +975,20 @@ internal windows.
952@end smallexample 975@end smallexample
953 976
954@noindent 977@noindent
955Deleting @code{W5} in this configuration normally causes the deletion of 978Deleting @var{W5} in this configuration normally causes the deletion of
956@code{W3} and @code{W4}. The remaining live windows @code{W2}, 979@var{W3} and @var{W4}. The remaining live windows @var{W2},
957@code{W6} and @code{W7} are recombined to form a new horizontal 980@var{W6} and @var{W7} are recombined to form a new horizontal
958combination with parent @code{W1}. 981combination with parent @var{W1}.
959 982
960 Sometimes, however, it makes sense to not delete a parent window like 983 Sometimes, however, it makes sense to not delete a parent window like
961@code{W4}. In particular, a parent window should not be removed when it 984@var{W4}. In particular, a parent window should not be removed when it
962was used to preserve a combination embedded in a combination of the same 985was used to preserve a combination embedded in a combination of the same
963type. Such embeddings make sense to assure that when you split a window 986type. Such embeddings make sense to assure that when you split a window
964and subsequently delete the new window, Emacs reestablishes the layout 987and subsequently delete the new window, Emacs reestablishes the layout
965of the associated frame as it existed before the splitting. 988of the associated frame as it existed before the splitting.
966 989
967 Consider a scenario starting with two live windows @code{W2} and 990 Consider a scenario starting with two live windows @var{W2} and
968@code{W3} and their parent @code{W1}. 991@var{W3} and their parent @var{W1}.
969 992
970@smallexample 993@smallexample
971@group 994@group
@@ -988,7 +1011,7 @@ of the associated frame as it existed before the splitting.
988@end smallexample 1011@end smallexample
989 1012
990@noindent 1013@noindent
991Split @code{W2} to make a new window @code{W4} as follows. 1014Split @var{W2} to make a new window @var{W4} as follows.
992 1015
993@smallexample 1016@smallexample
994@group 1017@group
@@ -1013,8 +1036,8 @@ Split @code{W2} to make a new window @code{W4} as follows.
1013@noindent 1036@noindent
1014Now, when enlarging a window vertically, Emacs tries to obtain the 1037Now, when enlarging a window vertically, Emacs tries to obtain the
1015corresponding space from its lower sibling, provided such a window 1038corresponding space from its lower sibling, provided such a window
1016exists. In our scenario, enlarging @code{W4} will steal space from 1039exists. In our scenario, enlarging @var{W4} will steal space from
1017@code{W3}. 1040@var{W3}.
1018 1041
1019@smallexample 1042@smallexample
1020@group 1043@group
@@ -1037,8 +1060,8 @@ exists. In our scenario, enlarging @code{W4} will steal space from
1037@end smallexample 1060@end smallexample
1038 1061
1039@noindent 1062@noindent
1040Deleting @code{W4} will now give its entire space to @code{W2}, 1063Deleting @var{W4} will now give its entire space to @var{W2},
1041including the space earlier stolen from @code{W3}. 1064including the space earlier stolen from @var{W3}.
1042 1065
1043@smallexample 1066@smallexample
1044@group 1067@group
@@ -1061,12 +1084,12 @@ including the space earlier stolen from @code{W3}.
1061@end smallexample 1084@end smallexample
1062 1085
1063@noindent 1086@noindent
1064This can be counterintutive, in particular if @code{W4} were used for 1087This can be counterintutive, in particular if @var{W4} were used for
1065displaying a buffer only temporarily (@pxref{Temporary Displays}), and 1088displaying a buffer only temporarily (@pxref{Temporary Displays}), and
1066you want to continue working with the initial layout. 1089you want to continue working with the initial layout.
1067 1090
1068The behavior can be fixed by making a new parent window when splitting 1091The behavior can be fixed by making a new parent window when splitting
1069@code{W2}. The variable described next allows to do that. 1092@var{W2}. The variable described next allows to do that.
1070 1093
1071@defopt window-combination-limit 1094@defopt window-combination-limit
1072This variable controls whether splitting a window shall make a new 1095This variable controls whether splitting a window shall make a new
@@ -1108,7 +1131,7 @@ internal window. This affects how the window tree is rearranged when
1108the child windows are deleted (see below). 1131the child windows are deleted (see below).
1109@end defopt 1132@end defopt
1110 1133
1111 If @code{window-combination-limit} is @code{t}, splitting @code{W2} in 1134 If @code{window-combination-limit} is @code{t}, splitting @var{W2} in
1112the initial configuration of our scenario would have produced this: 1135the initial configuration of our scenario would have produced this:
1113 1136
1114@smallexample 1137@smallexample
@@ -1132,12 +1155,12 @@ the initial configuration of our scenario would have produced this:
1132@end smallexample 1155@end smallexample
1133 1156
1134@noindent 1157@noindent
1135A new internal window @code{W5} has been created; its children are 1158A new internal window @var{W5} has been created; its children are
1136@code{W2} and the new live window @code{W4}. Now, @code{W2} is the only 1159@var{W2} and the new live window @var{W4}. Now, @var{W2} is the only
1137sibling of @code{W4}, so enlarging @code{W4} will try to shrink 1160sibling of @var{W4}, so enlarging @var{W4} will try to shrink
1138@code{W2}, leaving @code{W3} unaffected. Observe that @code{W5} 1161@var{W2}, leaving @var{W3} unaffected. Observe that @var{W5}
1139represents a vertical combination of two windows embedded in the 1162represents a vertical combination of two windows embedded in the
1140vertical combination @code{W1}. 1163vertical combination @var{W1}.
1141 1164
1142@cindex window combination limit 1165@cindex window combination limit
1143@defun set-window-combination-limit window limit 1166@defun set-window-combination-limit window limit
@@ -1162,9 +1185,9 @@ windows of @var{window} are never automatically recombined with its
1162siblings. 1185siblings.
1163 1186
1164If, in the configuration shown at the beginning of this section, the 1187If, in the configuration shown at the beginning of this section, the
1165combination limit of @code{W4} (the parent window of @code{W6} and 1188combination limit of @var{W4} (the parent window of @var{W6} and
1166@code{W7}) is @code{t}, deleting @code{W5} will not implicitly delete 1189@var{W7}) is @code{t}, deleting @var{W5} will not implicitly delete
1167@code{W4} too. 1190@var{W4} too.
1168@end defun 1191@end defun
1169 1192
1170Alternatively, the problems sketched above can be avoided by always 1193Alternatively, the problems sketched above can be avoided by always
@@ -1215,7 +1238,7 @@ the following frame layout.
1215 1238
1216@noindent 1239@noindent
1217If @code{window-combination-resize} is @code{nil}, splitting window 1240If @code{window-combination-resize} is @code{nil}, splitting window
1218@code{W3} leaves the size of @code{W2} unchanged: 1241@var{W3} leaves the size of @var{W2} unchanged:
1219 1242
1220@smallexample 1243@smallexample
1221@group 1244@group
@@ -1238,7 +1261,7 @@ If @code{window-combination-resize} is @code{nil}, splitting window
1238@end smallexample 1261@end smallexample
1239 1262
1240@noindent 1263@noindent
1241If @code{window-combination-resize} is @code{t}, splitting @code{W3} 1264If @code{window-combination-resize} is @code{t}, splitting @var{W3}
1242instead leaves all three live windows with approximately the same 1265instead leaves all three live windows with approximately the same
1243height: 1266height:
1244 1267
@@ -1263,7 +1286,7 @@ height:
1263@end smallexample 1286@end smallexample
1264 1287
1265@noindent 1288@noindent
1266Deleting any of the live windows @code{W2}, @code{W3} or @code{W4} will 1289Deleting any of the live windows @var{W2}, @var{W3} or @var{W4} will
1267distribute its space proportionally among the two remaining live 1290distribute its space proportionally among the two remaining live
1268windows. 1291windows.
1269 1292
@@ -1510,25 +1533,6 @@ windows to search, and have the same meanings as in
1510@code{next-window}. 1533@code{next-window}.
1511@end defun 1534@end defun
1512 1535
1513@cindex window in direction
1514@defun window-in-direction direction &optional window ignore
1515This function returns the nearest window in direction @var{direction} as
1516seen from the position of @code{window-point} in window @var{window}.
1517The argument @var{direction} must be one of @code{above}, @code{below},
1518@code{left} or @code{right}. The optional argument @var{window} must
1519denote a live window and defaults to the selected one.
1520
1521This function does not return a window whose @code{no-other-window}
1522parameter is non-@code{nil}. If the nearest window's
1523@code{no-other-window} parameter is non-@code{nil}, this function tries
1524to find another window in the indicated direction whose
1525@code{no-other-window} parameter is @code{nil}. If the optional
1526argument @var{ignore} is non-@code{nil}, a window may be returned even
1527if its @code{no-other-window} parameter is non-@code{nil}.
1528
1529If it doesn't find a suitable window, this function returns @code{nil}.
1530@end defun
1531
1532 1536
1533@node Buffers and Windows 1537@node Buffers and Windows
1534@section Buffers and Windows 1538@section Buffers and Windows
@@ -1631,28 +1635,30 @@ behave exactly like in @code{get-buffer-window}.
1631 1635
1632@deffn Command replace-buffer-in-windows &optional buffer-or-name 1636@deffn Command replace-buffer-in-windows &optional buffer-or-name
1633This command replaces @var{buffer-or-name} with some other buffer, in 1637This command replaces @var{buffer-or-name} with some other buffer, in
1634all windows displaying it. @var{buffer-or-name} should be a buffer, 1638all windows displaying it. @var{buffer-or-name} should be a buffer, or
1635or the name of an existing buffer; if omitted or @code{nil}, it 1639the name of an existing buffer; if omitted or @code{nil}, it defaults to
1636defaults to the current buffer. 1640the current buffer.
1637 1641
1638The replacement buffer in each window is chosen via 1642The replacement buffer in each window is chosen via
1639@code{switch-to-prev-buffer} (@pxref{Window History}). Any dedicated 1643@code{switch-to-prev-buffer} (@pxref{Window History}). Any dedicated
1640window displaying @var{buffer-or-name} is deleted (@pxref{Dedicated 1644window displaying @var{buffer-or-name} is deleted if possible
1641Windows}), unless it is the only window on its frame---if it is the 1645(@pxref{Dedicated Windows}). If such a window is the only window on its
1642only window, and that frame is not the only frame on its terminal, the 1646frame and there are other frames on the same terminal, the frame is
1643frame is ``dismissed'' by calling the function specified by 1647deleted as well. If the dedicated window is the only window on the only
1644@code{frame-auto-hide-function} (@pxref{Quitting Windows}). If the 1648frame on its terminal, the buffer is replaced anyway.
1645dedicated window is the only window on the only frame on its terminal,
1646the buffer is replaced anyway.
1647@end deffn 1649@end deffn
1648 1650
1651
1649@node Switching Buffers 1652@node Switching Buffers
1650@section Switching to a Buffer in a Window 1653@section Switching to a Buffer in a Window
1651@cindex switching to a buffer 1654@cindex switching to a buffer
1652@cindex displaying a buffer 1655@cindex displaying a buffer
1653 1656
1654 This section describes high-level functions for switching to a 1657This section describes high-level functions for switching to a specified
1655specified buffer in some window. 1658buffer in some window. In general, ``switching to a buffer'' means to
1659(1) show the buffer in some window, (2) make that window the selected
1660window (and its frame the selected frame), and (3) make the buffer the
1661current buffer.
1656 1662
1657 Do @emph{not} use these functions to make a buffer temporarily 1663 Do @emph{not} use these functions to make a buffer temporarily
1658current just so a Lisp program can access or modify it. They have 1664current just so a Lisp program can access or modify it. They have
@@ -1664,9 +1670,9 @@ to make a buffer current to modify it in Lisp, use
1664 1670
1665@deffn Command switch-to-buffer buffer-or-name &optional norecord force-same-window 1671@deffn Command switch-to-buffer buffer-or-name &optional norecord force-same-window
1666This command attempts to display @var{buffer-or-name} in the selected 1672This command attempts to display @var{buffer-or-name} in the selected
1667window, and makes it the current buffer. It is often used 1673window and make it the current buffer. It is often used interactively
1668interactively (as the binding of @kbd{C-x b}), as well as in Lisp 1674(as the binding of @kbd{C-x b}), as well as in Lisp programs. The
1669programs. The return value is the buffer switched to. 1675return value is the buffer switched to.
1670 1676
1671If @var{buffer-or-name} is @code{nil}, it defaults to the buffer 1677If @var{buffer-or-name} is @code{nil}, it defaults to the buffer
1672returned by @code{other-buffer} (@pxref{The Buffer List}). If 1678returned by @code{other-buffer} (@pxref{The Buffer List}). If
@@ -1690,9 +1696,8 @@ normally tries to display the buffer in some other window, by invoking
1690instead. 1696instead.
1691@end deffn 1697@end deffn
1692 1698
1693By default, @code{switch-to-buffer} sets @code{window-point} of the 1699By default, @code{switch-to-buffer} shows the buffer at its position of
1694window used to the buffer's position of @code{point}. This behavior can 1700@code{point}. This behavior can be tuned using the following option.
1695be tuned using the following option.
1696 1701
1697@defopt switch-to-buffer-preserve-window-point 1702@defopt switch-to-buffer-preserve-window-point
1698If this variable is @code{nil}, @code{switch-to-buffer} displays the 1703If this variable is @code{nil}, @code{switch-to-buffer} displays the
@@ -1710,13 +1715,13 @@ selected window or never appeared in it before, or if
1710buffer. 1715buffer.
1711@end defopt 1716@end defopt
1712 1717
1713The next two functions are similar to @code{switch-to-buffer}, except 1718The next two commands are similar to @code{switch-to-buffer}, except for
1714for the described features. 1719the described features.
1715 1720
1716@deffn Command switch-to-buffer-other-window buffer-or-name &optional norecord 1721@deffn Command switch-to-buffer-other-window buffer-or-name &optional norecord
1717This function makes the buffer specified by @var{buffer-or-name} 1722This function displays the buffer specified by @var{buffer-or-name} in
1718current and displays it in some window other than the selected window. 1723some window other than the selected window. It uses the function
1719It uses the function @code{pop-to-buffer} internally (see below). 1724@code{pop-to-buffer} internally (see below).
1720 1725
1721If the selected window already displays the specified buffer, it 1726If the selected window already displays the specified buffer, it
1722continues to do so, but another window is nonetheless found to display 1727continues to do so, but another window is nonetheless found to display
@@ -1727,9 +1732,9 @@ meanings as in @code{switch-to-buffer}.
1727@end deffn 1732@end deffn
1728 1733
1729@deffn Command switch-to-buffer-other-frame buffer-or-name &optional norecord 1734@deffn Command switch-to-buffer-other-frame buffer-or-name &optional norecord
1730This function makes the buffer specified by @var{buffer-or-name} 1735This function displays the buffer specified by @var{buffer-or-name} in a
1731current and displays it, usually in a new frame. It uses the function 1736new frame. It uses the function @code{pop-to-buffer} internally (see
1732@code{pop-to-buffer} (see below). 1737below).
1733 1738
1734If the specified buffer is already displayed in another window, in any 1739If the specified buffer is already displayed in another window, in any
1735frame on the current terminal, this switches to that window instead of 1740frame on the current terminal, this switches to that window instead of
@@ -1987,8 +1992,8 @@ of the window; its return value is ignored.
1987@end itemize 1992@end itemize
1988 1993
1989This function can fail if no window splitting can be performed for some 1994This function can fail if no window splitting can be performed for some
1990reason (e.g. if there is just one frame and it has an 1995reason (e.g. if the selected frame has an @code{unsplittable} frame
1991@code{unsplittable} frame parameter; @pxref{Buffer Parameters}). 1996parameter; @pxref{Buffer Parameters}).
1992@end defun 1997@end defun
1993 1998
1994@defun display-buffer-below-selected buffer alist 1999@defun display-buffer-below-selected buffer alist
@@ -2035,14 +2040,15 @@ example.
2035 2040
2036@noindent 2041@noindent
2037Evaluating the form above will cause @code{display-buffer} to proceed as 2042Evaluating the form above will cause @code{display-buffer} to proceed as
2038follows: If `*foo*' already appears on a visible or iconified frame, it 2043follows: If a buffer called *foo* already appears on a visible or
2039will reuse its window. Otherwise, it will try to pop up a new window 2044iconified frame, it will reuse its window. Otherwise, it will try to
2040or, if that is impossible, a new frame. If all these steps fail, it 2045pop up a new window or, if that is impossible, a new frame and show the
2041will proceed using whatever @code{display-buffer-base-action} and 2046buffer there. If all these steps fail, it will proceed using whatever
2047@code{display-buffer-base-action} and
2042@code{display-buffer-fallback-action} prescribe. 2048@code{display-buffer-fallback-action} prescribe.
2043 2049
2044 Furthermore, @code{display-buffer} will try to adjust a reused window 2050 Furthermore, @code{display-buffer} will try to adjust a reused window
2045(provided `*foo*' was put by @code{display-buffer} there before) or a 2051(provided *foo* was put by @code{display-buffer} there before) or a
2046popped-up window as follows: If the window is part of a vertical 2052popped-up window as follows: If the window is part of a vertical
2047combination, it will set its height to ten lines. Note that if, instead 2053combination, it will set its height to ten lines. Note that if, instead
2048of the number ``10'', we specified the function 2054of the number ``10'', we specified the function
@@ -2077,10 +2083,10 @@ and @code{split-width-threshold} (@pxref{Choosing Window Options}).
2077@end example 2083@end example
2078 2084
2079@noindent 2085@noindent
2080Evaluating this form will cause @code{display-buffer} to first try 2086This form will have @code{display-buffer} first try reusing a window
2081reusing a window showing @code{*foo*} on the selected frame. 2087that shows *foo* on the selected frame. If there's no such window, it
2082If no such window exists, it will try to split the selected window or, 2088will try to split the selected window or, if that is impossible, use the
2083if that is impossible, use the window below the selected window. 2089window below the selected window.
2084 2090
2085 If there's no window below the selected one, or the window below the 2091 If there's no window below the selected one, or the window below the
2086selected one is dedicated to its buffer, @code{display-buffer} will 2092selected one is dedicated to its buffer, @code{display-buffer} will
@@ -2119,8 +2125,8 @@ make a new window for displaying a buffer. It is used by the
2119the window (@pxref{Display Action Functions}). 2125the window (@pxref{Display Action Functions}).
2120 2126
2121The default value is @code{split-window-sensibly}, which is documented 2127The default value is @code{split-window-sensibly}, which is documented
2122below. The value must be a function that takes one argument, a 2128below. The value must be a function that takes one argument, a window,
2123window, and return either a new window (which is used to display the 2129and return either a new window (which will be used to display the
2124desired buffer) or @code{nil} (which means the splitting failed). 2130desired buffer) or @code{nil} (which means the splitting failed).
2125@end defopt 2131@end defopt
2126 2132
@@ -2198,15 +2204,15 @@ Parameters}), which is used by the default function in
2198@defopt same-window-buffer-names 2204@defopt same-window-buffer-names
2199A list of buffer names for buffers that should be displayed in the 2205A list of buffer names for buffers that should be displayed in the
2200selected window. If a buffer's name is in this list, 2206selected window. If a buffer's name is in this list,
2201@code{display-buffer} handles the buffer by switching to it in the 2207@code{display-buffer} handles the buffer by showing it in the selected
2202selected window. 2208window.
2203@end defopt 2209@end defopt
2204 2210
2205@defopt same-window-regexps 2211@defopt same-window-regexps
2206A list of regular expressions that specify buffers that should be 2212A list of regular expressions that specify buffers that should be
2207displayed in the selected window. If the buffer's name matches any of 2213displayed in the selected window. If the buffer's name matches any of
2208the regular expressions in this list, @code{display-buffer} handles the 2214the regular expressions in this list, @code{display-buffer} handles the
2209buffer by switching to it in the selected window. 2215buffer by showing it in the selected window.
2210@end defopt 2216@end defopt
2211 2217
2212@defun same-window-p buffer-name 2218@defun same-window-p buffer-name
@@ -2219,22 +2225,23 @@ put it in the selected window.
2219@section Window History 2225@section Window History
2220@cindex window history 2226@cindex window history
2221 2227
2222Each window remembers the buffers it has previously displayed, and the order 2228Each window remembers in a list the buffers it has previously displayed,
2223in which these buffers were removed from it. This history is used, 2229and the order in which these buffers were removed from it. This history
2224for example, by @code{replace-buffer-in-windows} (@pxref{Buffers and 2230is used, for example, by @code{replace-buffer-in-windows}
2225Windows}). This list is automatically maintained by Emacs, but you can 2231(@pxref{Buffers and Windows}). The list is automatically maintained by
2226use the following functions to explicitly inspect or alter it: 2232Emacs, but you can use the following functions to explicitly inspect or
2233alter it:
2227 2234
2228@defun window-prev-buffers &optional window 2235@defun window-prev-buffers &optional window
2229This function returns a list specifying the previous contents of 2236This function returns a list specifying the previous contents of
2230@var{window}, which should be a live window and defaults to the 2237@var{window}. The optional argument @var{window} should be a live
2231selected window. 2238window and defaults to the selected one.
2232 2239
2233Each list element has the form @code{(@var{buffer} @var{window-start} 2240Each list element has the form @code{(@var{buffer} @var{window-start}
2234@var{window-pos})}, where @var{buffer} is a buffer previously shown in 2241@var{window-pos})}, where @var{buffer} is a buffer previously shown in
2235the window, @var{window-start} is the window start position when that 2242the window, @var{window-start} is the window start position when that
2236buffer was last shown, and @var{window-pos} is the point position when 2243buffer was last shown, and @var{window-pos} is the point position when
2237that buffer was last shown. 2244that buffer was last shown in @var{window}.
2238 2245
2239The list is ordered so that earlier elements correspond to more 2246The list is ordered so that earlier elements correspond to more
2240recently-shown buffers, and the first element usually corresponds to the 2247recently-shown buffers, and the first element usually corresponds to the
@@ -2331,29 +2338,31 @@ Functions for displaying a buffer can be told to not use specific
2331windows by marking these windows as @dfn{dedicated} to their buffers. 2338windows by marking these windows as @dfn{dedicated} to their buffers.
2332@code{display-buffer} (@pxref{Choosing Window}) never uses a dedicated 2339@code{display-buffer} (@pxref{Choosing Window}) never uses a dedicated
2333window for displaying another buffer in it. @code{get-lru-window} and 2340window for displaying another buffer in it. @code{get-lru-window} and
2334@code{get-largest-window} (@pxref{Selecting Windows}) do not consider 2341@code{get-largest-window} (@pxref{Cyclic Window Ordering}) do not
2335dedicated windows as candidates when their @var{dedicated} argument is 2342consider dedicated windows as candidates when their @var{dedicated}
2336non-@code{nil}. The behavior of @code{set-window-buffer} 2343argument is non-@code{nil}. The behavior of @code{set-window-buffer}
2337(@pxref{Buffers and Windows}) with respect to dedicated windows is 2344(@pxref{Buffers and Windows}) with respect to dedicated windows is
2338slightly different, see below. 2345slightly different, see below.
2339 2346
2340When @code{delete-windows-on} (@pxref{Deleting Windows}) wants to 2347 Functions supposed to remove a buffer from a window or a window from
2341delete a dedicated window and that window is the only window on its 2348a frame can behave specially when a window they operate on is dedicated.
2342frame, it deletes the window's frame too, provided there are other 2349We will distinguish three basic cases, namely where (1) the window is
2343frames left. @code{replace-buffer-in-windows} (@pxref{Switching 2350not the only window on its frame, (2) the window is the only window on
2344Buffers}) tries to delete all dedicated windows showing its buffer 2351its frame but there are other frames on the same terminal left, and (3)
2345argument. When such a window is the only window on its frame, that 2352the window is the only window on the only frame on the same terminal.
2346frame is deleted, provided there are other frames left. If there are 2353
2347no more frames left, some other buffer is displayed in the window, and 2354 In particular, @code{delete-windows-on} (@pxref{Deleting Windows})
2348the window is marked as non-dedicated. 2355handles case (2) by deleting the associated frame and case (3) by
2349 2356showing another buffer in that frame's only window. The function
2350When you kill a buffer (@pxref{Killing Buffers}) displayed in a 2357@code{replace-buffer-in-windows} (@pxref{Buffers and Windows}) which is
2351dedicated window, any such window usually gets deleted too, since 2358called when a buffer gets killed, deletes the window in case (1) and
2352@code{kill-buffer} calls @code{replace-buffer-in-windows} for cleaning 2359behaves like @code{delete-windows-on} otherwise.
2353up windows. Burying a buffer (@pxref{The Buffer List}) deletes the 2360
2354selected window if it is dedicated to that buffer. If, however, that 2361 When @code{bury-buffer} (@pxref{The Buffer List}) operates on the
2355window is the only window on its frame, @code{bury-buffer} displays 2362selected window (which shows the buffer that shall be buried), it
2356another buffer in it and iconifies the frame. 2363handles case (2) by calling @code{frame-auto-hide-function}
2364(@pxref{Quitting Windows}) to deal with the selected frame. The other
2365two cases are handled as with @code{replace-buffer-in-windows}.
2357 2366
2358@defun window-dedicated-p &optional window 2367@defun window-dedicated-p &optional window
2359This function returns non-@code{nil} if @var{window} is dedicated to its 2368This function returns non-@code{nil} if @var{window} is dedicated to its