aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2011-11-19 19:11:38 +0800
committerChong Yidong2011-11-19 19:11:38 +0800
commit7bf54975caf75e4ad83d8cc2eb62709cf5598022 (patch)
treed7bebe193f182fa76fd8377f3be07dc8c16bcbac
parentdf05a53c61885a7d11265e36723742c12ab1a061 (diff)
downloademacs-7bf54975caf75e4ad83d8cc2eb62709cf5598022.tar.gz
emacs-7bf54975caf75e4ad83d8cc2eb62709cf5598022.zip
More updates to Window chapter of Lisp manual.
* doc/lispref/windows.texi (Splitting Windows): Clarify role of window parameters in split-window. Shorten the example. (Deleting Windows): Rewrite intro to handle internal windows. Fix delete-windows-on doc. (Selecting Windows): Copyedits.
-rw-r--r--doc/lispref/ChangeLog8
-rw-r--r--doc/lispref/windows.texi478
2 files changed, 209 insertions, 277 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 0fa50492481..232ddff6d3f 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,11 @@
12011-11-19 Chong Yidong <cyd@gnu.org>
2
3 * windows.texi (Splitting Windows): Clarify role of window
4 parameters in split-window. Shorten the example.
5 (Deleting Windows): Rewrite intro to handle internal windows. Fix
6 delete-windows-on doc.
7 (Selecting Windows): Copyedits.
8
12011-11-17 Martin Rudalics <rudalics@gmx.at> 92011-11-17 Martin Rudalics <rudalics@gmx.at>
2 10
3 * windows.texi (Resizing Windows, Splitting Windows) 11 * windows.texi (Resizing Windows, Splitting Windows)
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index 8c99a06909b..4e67fa6d740 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -110,6 +110,7 @@ including for the case where @var{object} is a deleted window.
110@end defun 110@end defun
111 111
112@cindex selected window 112@cindex selected window
113@cindex window selected within a frame
113 In each frame, at any time, exactly one Emacs window is designated 114 In each frame, at any time, exactly one Emacs window is designated
114as @dfn{selected within the frame}. For the selected frame, that 115as @dfn{selected within the frame}. For the selected frame, that
115window is called the @dfn{selected window}---the one in which most 116window is called the @dfn{selected window}---the one in which most
@@ -774,22 +775,24 @@ properties from it, including margins and scroll bars. If
774@var{window} is an internal window, the new window inherits the 775@var{window} is an internal window, the new window inherits the
775properties of the window selected within @var{window}'s frame. 776properties of the window selected within @var{window}'s frame.
776 777
777If the variable @code{ignore-window-parameters} is non-@code{nil} 778The behavior of this function may be altered by the window parameters
778(@pxref{Window Parameters}), this function ignores window parameters. 779of @var{window}, so long as the variable
779Otherwise, it consults the @code{split-window} parameter of 780@code{ignore-window-parameters} is non-@code{nil}. If the value of
780@var{window}; if this is @code{t}, it splits the window disregarding 781the @code{split-window} window parameter is @code{t}, this function
781any other window parameters. If the @code{split-window} parameter 782ignores all other window parameters. Otherwise, if the value of the
782specifies a function, that function is called with the arguments 783@code{split-window} window parameter is a function, that function is
783@var{window}, @var{size}, and @var{side} to split @var{window}, in 784called with the arguments @var{window}, @var{size}, and @var{side}, in
784lieu of the usual action of @code{split-window}. 785lieu of the usual action of @code{split-window}. Otherwise, this
786function obeys the @code{window-atom} or @code{window-side} window
787parameter, if any. @xref{Window Parameters}.
785@end deffn 788@end deffn
786 789
787 As an example, we show a combination of @code{split-window} calls 790 As an example, here is a sequence of @code{split-window} calls that
788that yields the window configuration discussed in @ref{Windows and 791yields the window configuration discussed in @ref{Windows and Frames}.
789Frames}. This example demonstrates splitting a live window as well as 792This example demonstrates splitting a live window as well as splitting
790splitting an internal window. We begin with a frame containing a 793an internal window. We begin with a frame containing a single window
791single window (a live root window), which we denote by @var{W4}. 794(a live root window), which we denote by @var{W4}. Calling
792Calling @code{(split-window W3)} yields this window configuration: 795@code{(split-window W3)} yields this window configuration:
793 796
794@smallexample 797@smallexample
795@group 798@group
@@ -841,9 +844,6 @@ A new live window @var{W2} is created, to the left of the internal
841window @var{W3}. A new internal window @var{W1} is created, becoming 844window @var{W3}. A new internal window @var{W1} is created, becoming
842the new root window. 845the new root window.
843 846
844 The following two options can be used to modify the operation of
845@code{split-window}.
846
847@defopt window-combination-resize 847@defopt window-combination-resize
848If this variable is @code{nil}, @code{split-window} can only split a 848If this variable is @code{nil}, @code{split-window} can only split a
849window (denoted by @var{window}) if @var{window}'s screen area is 849window (denoted by @var{window}) if @var{window}'s screen area is
@@ -854,18 +854,17 @@ If this variable is non-@code{nil}, @code{split-window} tries to
854resize all windows that are part of the same combination as 854resize all windows that are part of the same combination as
855@var{window}, in order to accommodate the new window. In particular, 855@var{window}, in order to accommodate the new window. In particular,
856this may allow @code{split-window} to succeed even if @var{window} is 856this may allow @code{split-window} to succeed even if @var{window} is
857a fixed-size window or too small to ordinarily split. 857a fixed-size window or too small to ordinarily split. Furthermore,
858 858subsequently resizing or deleting @var{window} may resize all other
859Also if this variable is non-@code{nil}, subsequent resizing and 859windows in its combination.
860deleting @var{window} will usually affect @emph{all} windows in
861@var{window}'s combination.
862 860
863The setting of this variable has no effect if 861This variable has no effect if @code{window-combination-limit} is
864@code{window-combination-limit} (see below) is non-@code{nil}. 862non-@code{nil} (see below).
865@end defopt 863@end defopt
866 864
867To illustrate the use of @code{window-combination-resize} consider the 865 To illustrate the effect of @code{window-combination-resize},
868following window configuration: 866consider the following window configuration:
867
869@smallexample 868@smallexample
870@group 869@group
871 ______________________________________ 870 ______________________________________
@@ -886,9 +885,10 @@ following window configuration:
886@end group 885@end group
887@end smallexample 886@end smallexample
888 887
889Splitting window @code{W3} with @code{window-combination-resize} 888@noindent
890@code{nil} produces a configuration where the size of @code{W2} remains 889If @code{window-combination-resize} is @code{nil}, splitting window
891unchanged: 890@code{W3} leaves the size of @code{W2} unchanged:
891
892@smallexample 892@smallexample
893@group 893@group
894 ______________________________________ 894 ______________________________________
@@ -909,8 +909,11 @@ unchanged:
909@end group 909@end group
910@end smallexample 910@end smallexample
911 911
912Splitting @code{W3} with @code{window-combination-resize} non-@code{nil} 912@noindent
913instead steals the space for @code{W4} from both @code{W2} and @code{W3}: 913If @code{window-combination-resize} is non-@code{nil}, splitting
914@code{W3} instead leaves all three live windows with approximately the
915same height:
916
914@smallexample 917@smallexample
915@group 918@group
916 ______________________________________ 919 ______________________________________
@@ -932,53 +935,51 @@ instead steals the space for @code{W4} from both @code{W2} and @code{W3}:
932@end smallexample 935@end smallexample
933 936
934@defopt window-combination-limit 937@defopt window-combination-limit
935If this variable is @code{nil}, @code{split-window} creates a new parent 938If the value of this variable is @code{t}, the @code{split-window}
936window if and only if the old window has no parent window or shall be 939function always creates a new internal window. If the value is
937split orthogonally to the combination it is part of. If this variable 940@code{nil}, the new live window is allowed to share the existing
938is @code{t}, @code{split-window} always creates a new parent window. If 941parent window, if one exists, provided the split occurs in the same
939this variable is always @code{t}, a frame's window tree is a binary tree 942direction as the existing window combination (otherwise, a new
940so every window but the frame's root window has exactly one sibling. 943internal window is created anyway). The default is @code{nil}. Other
941Other values are reserved for future use. 944values are reserved for future use.
942 945
943The value of this variable is also assigned to the combination-limit 946Thus, if the value is always @code{t}, each window tree is a binary
944status of the new parent window. The combination-limit status of any 947tree: each window except the root window has exactly one sibling.
945window can be retrieved via the function @code{window-combination-limit} 948
946and altered by the function @code{set-window-combination-limit}, see 949Furthermore, @code{split-window} calls
947below. 950@code{set-window-combination-limit} on the newly-created internal
951window, recording the current value of this variable. This affects
952how the window tree is rearranged when the child windows are deleted
953(see below).
948@end defopt 954@end defopt
949 955
950@defun window-combination-limit &optional window 956@cindex window combination limit
951This function returns the combination-limit status of @var{window}. The 957@defun set-window-combination-limit window status
952argument @var{window} can be any window and defaults to the selected 958This functions sets the @dfn{combination limit} of the window
953one. Note, however, that the combination-limit status is currently 959@var{window} to @var{status}. This value can be retrieved via the
954meaningful for internal windows only. 960function @code{window-combination-limit}. See below for its effects;
955 961note that it is only meaningful for internal windows. The
956@cindex combination-limit status 962@code{split-window} function automatically calls this function,
957The @dfn{combination-limit status} of a window specifies whether that 963passing the value of the variable @code{window-combination-limit} as
958window may be removed and its child windows recombined with that 964@var{status}.
959window's siblings when such a sibling's child window is deleted. The 965@end defun
960combination-limit status is initially assigned by @code{split-window} 966
961from the current value of the variable @code{window-combination-limit} 967@defun window-combination-limit window
962(see above) and can be reset by the function 968This function returns the combination limit for @var{window}.
963@code{set-window-combination-limit} (see below). 969
964 970The combination limit is meaningful only for an internal window. If
965If the return value is @code{nil}, child windows of @var{window} may be 971it is @code{nil}, then Emacs is allowed to automatically delete
966recombined with @var{window}'s siblings when a window gets deleted. A 972@var{window}, in response to a window deletion, in order to group the
967return value of @code{nil} means that child windows of @var{window} are 973child windows of @var{window} with the child windows of one of its
968never (re-)combined with @var{window}'s siblings in such a case. 974siblings to form a new window combination. If the combination limit
969@end defun 975is @code{t}, the child windows of @var{window} are never automatically
970 976re-combined with its siblings'.
971@defun set-window-combination-limit window &optional status 977@end defun
972This functions sets the combination-limit status (see above) of 978
973@var{window} to @var{status}. The argument @var{window} can be any 979 To illustrate the effect of @code{window-combination-limit},
974window and defaults to the selected one. Note that setting the 980consider the following configuration (throughout this example, we will
975combination-limit status is meaningful for internal windows only. The 981assume that @code{window-combination-resize} is @code{nil}):
976return value is @var{status}. 982
977@end defun
978
979To illustrate the use of @code{window-combination-limit} consider the
980following configuration (throughout the following examples we shall
981assume that @code{window-combination-resize} invariantly is @code{nil}).
982@smallexample 983@smallexample
983@group 984@group
984 ______________________________________ 985 ______________________________________
@@ -999,31 +1000,10 @@ assume that @code{window-combination-resize} invariantly is @code{nil}).
999@end group 1000@end group
1000@end smallexample 1001@end smallexample
1001 1002
1002Splitting @code{W2} into two windows above each other with 1003@noindent
1003@code{window-combination-limit} equal @code{nil} will get you a 1004If @code{window-combination-limit} is @code{nil}, splitting @code{W2}
1004configuration like: 1005into two windows, one above the other, yields
1005@smallexample
1006@group
1007 ______________________________________
1008 | ____________________________________ |
1009 || ||
1010 || ||
1011 ||_________________W2_________________||
1012 | ____________________________________ |
1013 || ||
1014 || ||
1015 ||_________________W4_________________||
1016 | ____________________________________ |
1017 || ||
1018 || ||
1019 ||_________________W3_________________||
1020 |__________________W1__________________|
1021
1022@end group
1023@end smallexample
1024 1006
1025If you now enlarge window @code{W4}, Emacs steals the necessary space
1026from window @code{W3} resulting in a configuration like:
1027@smallexample 1007@smallexample
1028@group 1008@group
1029 ______________________________________ 1009 ______________________________________
@@ -1034,43 +1014,24 @@ from window @code{W3} resulting in a configuration like:
1034 | ____________________________________ | 1014 | ____________________________________ |
1035 || || 1015 || ||
1036 || || 1016 || ||
1037 || ||
1038 ||_________________W4_________________|| 1017 ||_________________W4_________________||
1039 | ____________________________________ | 1018 | ____________________________________ |
1040 || || 1019 || ||
1020 || ||
1041 ||_________________W3_________________|| 1021 ||_________________W3_________________||
1042 |__________________W1__________________| 1022 |__________________W1__________________|
1043 1023
1044@end group 1024@end group
1045@end smallexample 1025@end smallexample
1046 1026
1047Deleting window @code{W4}, will return its space to @code{W2} as 1027@noindent
1048follows: 1028The newly-created window, @code{W4}, shares the same internal window
1049@smallexample 1029@code{W1}. If @code{W4} is resized, it is allowed to resize the other
1050@group 1030live window, @code{W3}.
1051 ______________________________________
1052 | ____________________________________ |
1053 || ||
1054 || ||
1055 || ||
1056 || ||
1057 || ||
1058 || ||
1059 || ||
1060 ||_________________W2_________________||
1061 | ____________________________________ |
1062 || ||
1063 ||_________________W3_________________||
1064 |__________________W1__________________|
1065 1031
1066@end group 1032 If @code{window-combination-limit} is @code{t}, splitting @code{W2}
1067@end smallexample 1033in the initial configuration would instead have produced this:
1068 1034
1069Hence, with respect to the initial configuration, window @code{W2} has
1070grown at the expense of window @code{W3}. If, however, in the initial
1071configuration you had split @code{W2} with
1072@code{window-combination-limit} bound to @code{t}, a new internal window
1073@code{W5} would have been created as depicted below.
1074@smallexample 1035@smallexample
1075@group 1036@group
1076 ______________________________________ 1037 ______________________________________
@@ -1091,143 +1052,110 @@ configuration you had split @code{W2} with
1091@end group 1052@end group
1092@end smallexample 1053@end smallexample
1093 1054
1094Enlarging @code{W4} would now have stolen the necessary space from 1055@noindent
1095@code{W2} instead of @code{W3} as 1056A new internal window @code{W5} has been created; its children are
1096@smallexample 1057@code{W2} and the new live window @code{W4}. Now, @code{W2} is the
1097@group 1058only sibling of @code{W4}, so resizing @code{W4} will resize
1098 ______________________________________ 1059@code{W2}, leaving @code{W3} unaffected.
1099 | ____________________________________ |
1100 || __________________________________ ||
1101 |||________________W2________________|||
1102 || __________________________________ ||
1103 ||| |||
1104 ||| |||
1105 |||________________W4________________|||
1106 ||_________________W5_________________||
1107 | ____________________________________ |
1108 || ||
1109 || ||
1110 ||_________________W3_________________||
1111 |__________________W1__________________|
1112
1113@end group
1114@end smallexample
1115 1060
1116and the subsequent deletion of @code{W4} would have restored the initial 1061 For interactive use, Emacs provides two commands which always split
1117configuration. 1062the selected window. These call @code{split-window} internally.
1118 1063
1119For interactive use, Emacs provides two commands which always split the 1064@deffn Command split-window-right &optional size
1120selected window. 1065This function splits the selected window into two side-by-side
1066windows, putting the selected window on the left. If @var{size} is
1067positive, the left window gets @var{size} columns; if @var{size} is
1068negative, the right window gets @minus{}@var{size} columns.
1069@end deffn
1121 1070
1122@deffn Command split-window-below &optional size 1071@deffn Command split-window-below &optional size
1123This function splits the selected window into two windows, one above the 1072This function splits the selected window into two windows, one above
1124other, leaving the upper of the two windows selected, with @var{size} 1073the other, leaving the upper window selected. If @var{size} is
1125lines. (If @var{size} is negative, then the lower of the two windows 1074positive, the upper window gets @var{size} lines; if @var{size} is
1126gets @minus{}@var{size} lines and the upper window gets the rest, but 1075negative, the lower window gets @minus{}@var{size} lines.
1127the upper window is still the one selected.) However, if
1128@code{split-window-keep-point} (see below) is @code{nil}, then either
1129window can be selected.
1130
1131 In other respects, this function is similar to @code{split-window}.
1132In particular, the upper window is the original one and the return value
1133is the new, lower window.
1134@end deffn 1076@end deffn
1135 1077
1136@defopt split-window-keep-point 1078@defopt split-window-keep-point
1137If this variable is non-@code{nil} (the default), then 1079If the value of this variable is non-@code{nil} (the default),
1138@code{split-window-below} behaves as described above. 1080@code{split-window-below} behaves as described above.
1139 1081
1140 If it is @code{nil}, then @code{split-window-below} adjusts point 1082If it is @code{nil}, @code{split-window-below} adjusts point in each
1141in each of the two windows to avoid scrolling. (This is useful on 1083of the two windows to minimize redisplay. (This is useful on slow
1142slow terminals.) It selects whichever window contains the screen line 1084terminals.) It selects whichever window contains the screen line that
1143that point was previously on. Other functions are not affected by 1085point was previously on. Note that this only affects
1144this variable. 1086@code{split-window-below}, not the lower-level @code{split-window}
1087function.
1145@end defopt 1088@end defopt
1146 1089
1147@deffn Command split-window-right &optional size
1148This function splits the selected window into two windows
1149side-by-side, leaving the selected window on the left with @var{size}
1150columns. If @var{size} is negative, the rightmost window gets
1151@minus{}@var{size} columns, but the leftmost window still remains
1152selected.
1153@end deffn
1154
1155
1156@node Deleting Windows 1090@node Deleting Windows
1157@section Deleting Windows 1091@section Deleting Windows
1158@cindex deleting windows 1092@cindex deleting windows
1159 1093
1160A window remains visible on its frame unless you @dfn{delete} it by 1094 @dfn{Deleting} a window removes it from the frame's window tree. If
1161calling certain functions that delete windows. A deleted window cannot 1095the window is a live window, it disappears from the screen. If the
1162appear on the screen, but continues to exist as a Lisp object until 1096window is an internal window, its child windows are deleted too.
1163there are no references to it. There is no way to cancel the deletion 1097
1164of a window aside from restoring a saved window configuration 1098 Even after a window is deleted, it continues to exist as a Lisp
1165(@pxref{Window Configurations}). Restoring a window configuration also 1099object, until there are no more references to it. Window deletion can
1166deletes any windows that aren't part of that configuration. Erroneous 1100be reversed, by restoring a saved window configuration (@pxref{Window
1167information may result from using a deleted window as if it were live. 1101Configurations}).
1168 1102
1169@deffn Command delete-window &optional window 1103@deffn Command delete-window &optional window
1170This function removes @var{window} from display and returns @code{nil}. 1104This function removes @var{window} from display and returns
1171The argument @var{window} can denote any window and defaults to the 1105@code{nil}. If @var{window} is omitted or @code{nil}, it defaults to
1172selected one. An error is signaled if @var{window} is the only window 1106the selected window. If deleting the window would leave no more
1173on its frame. Hence @var{window} must have at least one sibling window 1107windows in the window tree (e.g. if it is the only live window in the
1174(@pxref{Windows and Frames}) in order to get deleted. If @var{window} 1108frame), an error is signaled.
1175is the selected window on its frame, this function selects the most 1109
1176recently selected live window on that frame instead. 1110By default, the space taken up by @var{window} is given to one of its
1177 1111adjacent sibling windows, if any. However, if the variable
1178If the variable @code{ignore-window-parameters} (@pxref{Window 1112@code{window-combination-resize} is non-@code{nil}, the space is
1179Parameters}) is non-@code{nil}, this function ignores all parameters of 1113proportionally distributed among any remaining windows in the window
1180@var{window}. Otherwise, if the @code{delete-window} parameter of 1114combination. @xref{Splitting Windows}.
1181@var{window} is @code{t}, it deletes the window disregarding other 1115
1182window parameters. If the @code{delete-window} parameter specifies a 1116The behavior of this function may be altered by the window parameters
1183function, that function is called with @var{window} as its sole 1117of @var{window}, so long as the variable
1184argument. 1118@code{ignore-window-parameters} is non-@code{nil}. If the value of
1185 1119the @code{delete-window} window parameter is @code{t}, this function
1186If @code{window-combination-resize} (@pxref{Splitting Windows}) is 1120ignores all other window parameters. Otherwise, if the value of the
1187@code{nil}, the space @var{window} took up is given to its left sibling 1121@code{delete-window} window parameter is a function, that function is
1188if such a window exists and to its right sibling otherwise. If 1122called with the argument @var{window}, in lieu of the usual action of
1189@code{window-combination-resize} is non-@code{nil}, the space of 1123@code{delete-window}. Otherwise, this function obeys the
1190@var{window} is proportionally distributed among the remaining windows 1124@code{window-atom} or @code{window-side} window parameter, if any.
1191in the same combination. 1125@xref{Window Parameters}.
1192@end deffn 1126@end deffn
1193 1127
1194@deffn Command delete-other-windows &optional window 1128@deffn Command delete-other-windows &optional window
1195This function makes @var{window} fill its frame and returns @code{nil}. 1129This function makes @var{window} fill its frame, by deleting other
1196The argument @var{window} can denote an arbitrary window and defaults to 1130windows as necessary. If @var{window} is omitted or @code{nil}, it
1197the selected one. Upon exit, @var{window} will be the selected window 1131defaults to the selected window. The return value is @code{nil}.
1198on its frame. 1132
1199 1133The behavior of this function may be altered by the window parameters
1200If the variable @code{ignore-window-parameters} (@pxref{Window 1134of @var{window}, so long as the variable
1201Parameters}) is non-@code{nil}, this function ignores all parameters of 1135@code{ignore-window-parameters} is non-@code{nil}. If the value of
1202@var{window}. Otherwise, if the @code{delete-other-windows} parameter 1136the @code{delete-other-windows} window parameter is @code{t}, this
1203of @var{window} equals @code{t}, it deletes all other windows 1137function ignores all other window parameters. Otherwise, if the value
1204disregarding any remaining window parameters. If the 1138of the @code{delete-other-windows} window parameter is a function,
1205@code{delete-other-windows} parameter of @var{window} specifies a 1139that function is called with the argument @var{window}, in lieu of the
1206function, it calls that function with @var{window} as its sole argument. 1140usual action of @code{delete-other-windows}. Otherwise, this function
1141obeys the @code{window-atom} or @code{window-side} window parameter,
1142if any. @xref{Window Parameters}.
1207@end deffn 1143@end deffn
1208 1144
1209@deffn Command delete-windows-on &optional buffer-or-name frame 1145@deffn Command delete-windows-on &optional buffer-or-name frame
1210This function deletes all windows showing @var{buffer-or-name}. If 1146This function deletes all windows showing @var{buffer-or-name}, by
1211there are no windows showing @var{buffer-or-name}, it does nothing. 1147calling @code{delete-window} on those windows. @var{buffer-or-name}
1212The optional argument @var{buffer-or-name} may be a buffer or the name 1148should be a buffer, or the name of a buffer; if omitted or @code{nil},
1213of an existing buffer and defaults to the current buffer. Invoking 1149it defaults to the current buffer. If there are no windows showing
1214this command on a minibuffer signals an error. 1150the specified buffer, this function does nothing. If the specified
1215 1151buffer is a minibuffer, an error is signaled.
1216The function @code{delete-windows-on} operates by calling 1152
1217@code{delete-window} for each window showing @var{buffer-or-name}. If a 1153If there is a dedicated window showing the buffer, and that window is
1218frame has several windows showing different buffers, then those showing 1154the only one on its frame, this function also deletes that frame if it
1219@var{buffer-or-name} are removed, and the other windows expand to fill 1155is not the only frame on the terminal.
1220the space. 1156
1221 1157The optional argument @var{frame} specifies which frames to operate
1222If all windows in some frame are showing @var{buffer-or-name} (including 1158on:
1223the case where there is only one window), then that frame is deleted
1224provided there are other frames left.
1225
1226The optional argument @var{frame} specifies which frames to operate on.
1227This function does not use it in quite the same way as the other
1228functions which scan all live windows (@pxref{Cyclic Window Ordering});
1229specifically, the values @code{t} and @code{nil} have the opposite of
1230their meanings in the other functions. Here are the full details:
1231 1159
1232@itemize @bullet 1160@itemize @bullet
1233@item @code{nil} 1161@item @code{nil}
@@ -1241,34 +1169,37 @@ means operate on all visible or iconified frames.
1241@item A frame 1169@item A frame
1242means operate on that frame. 1170means operate on that frame.
1243@end itemize 1171@end itemize
1244@end deffn
1245 1172
1173Note that this argument does not have the same meaning as in other
1174functions which scan all live windows (@pxref{Cyclic Window
1175Ordering}). Specifically, the values @code{t} and @code{nil} have the
1176opposite of their meanings in those other functions.
1177@end deffn
1246 1178
1247@node Selecting Windows 1179@node Selecting Windows
1248@section Selecting Windows 1180@section Selecting Windows
1249@cindex selecting a window 1181@cindex selecting a window
1250 1182
1251@defun select-window window &optional norecord 1183@defun select-window window &optional norecord
1252This function makes @var{window} the selected window, see @ref{Basic 1184This function makes @var{window} the selected window, as well as the
1253Windows}. Unless @var{window} already is the selected window, this also 1185window selected within its frame (@pxref{Basic Windows}).
1254makes @var{window}'s buffer (@pxref{Buffers and Windows}) the current 1186@var{window} must be a live winow. Unless @var{window} already is the
1255buffer. Moreover, the cursor for selected windows will be displayed in 1187selected window, its buffer becomes the current buffer (@pxref{Buffers
1256@var{window} after the next redisplay. This function returns 1188and Windows}). The return value is @var{window}.
1257@var{window}.
1258 1189
1259Normally, @var{window}'s selected buffer is moved to the front of the 1190By default, this function also moves @var{window}'s selected buffer to
1260buffer list (@pxref{The Buffer List}) and @var{window} becomes the most 1191the front of the buffer list (@pxref{The Buffer List}), and makes
1261recently selected window. But if the optional argument @var{norecord} 1192@var{window} the most recently selected window. However, if the
1262is non-@code{nil}, the buffer list remains unchanged and @var{window} 1193optional argument @var{norecord} is non-@code{nil}, these additional
1263does not become the most recently selected one. 1194actions are omitted.
1264@end defun 1195@end defun
1265 1196
1266@cindex most recently selected windows 1197@cindex most recently selected windows
1267The sequence of calls to @code{select-window} with a non-@code{nil} 1198 The sequence of calls to @code{select-window} with a non-@code{nil}
1268@var{norecord} argument determines an ordering of windows by their 1199@var{norecord} argument determines an ordering of windows by their
1269selection time. The function @code{get-lru-window} can be used to 1200selection time. The function @code{get-lru-window} can be used to
1270retrieve the least recently selected live window in this ordering, see 1201retrieve the least recently selected live window (@pxref{Cyclic Window
1271@ref{Cyclic Window Ordering}. 1202Ordering}).
1272 1203
1273@defmac save-selected-window forms@dots{} 1204@defmac save-selected-window forms@dots{}
1274This macro records the selected frame, as well as the selected window 1205This macro records the selected frame, as well as the selected window
@@ -1300,33 +1231,26 @@ The order of recently selected windows and the buffer list are not
1300changed by this macro. 1231changed by this macro.
1301@end defmac 1232@end defmac
1302 1233
1303@cindex frame selected window 1234@defun frame-selected-window &optional frame
1304@cindex window selected within frame 1235This function returns the window on @var{frame} that is selected
1305Earlier (@pxref{Basic Windows}) we mentioned that at any time, exactly 1236within that frame. @var{frame} should be a live frame; if omitted or
1306one window on any frame is selected within the frame. The significance 1237@code{nil}, it defaults to the selected frame.
1307of this designation is that selecting the frame also selects this
1308window. Conversely, selecting a window for Emacs with
1309@code{select-window} also makes that window selected within its frame.
1310
1311@defun frame-selected-window &optional frame
1312This function returns the window on @var{frame} that is selected within
1313@var{frame}. The optional argument @var{frame} must denote a live frame
1314and defaults to the selected one.
1315@end defun 1238@end defun
1316 1239
1317@defun set-frame-selected-window frame window &optional norecord 1240@defun set-frame-selected-window frame window &optional norecord
1318This function sets the selected window of frame @var{frame} to 1241This function makes @code{window} the window selected within the frame
1319@var{window}. The argument @var{frame} must denote a live frame and 1242@var{frame}. @var{frame} should be a live frame; if omitted or
1320defaults to the selected one. If @var{frame} is the selected frame, 1243@code{nil}, it defaults to the selected frame. @var{window} should be
1321this also makes @var{window} the selected window. The argument 1244a live window; if omitted or @code{nil}, it defaults to the selected
1322@var{window} must denote a live window. This function returns 1245window.
1323@var{window}.
1324 1246
1325Optional argument @var{norecord} non-@code{nil} means to neither change 1247If @var{frame} is the selected frame, this makes @var{window} the
1326the list of most recently selected windows (@pxref{Selecting Windows}) 1248selected window.
1327nor the buffer list (@pxref{The Buffer List}).
1328@end defun
1329 1249
1250If the optional argument @var{norecord} is non-@code{nil}, this
1251function does not alter the list of most recently selected windows,
1252nor the buffer list.
1253@end defun
1330 1254
1331@node Cyclic Window Ordering 1255@node Cyclic Window Ordering
1332@section Cyclic Ordering of Windows 1256@section Cyclic Ordering of Windows