diff options
| author | Martin Rudalics | 2012-11-23 15:39:07 +0100 |
|---|---|---|
| committer | Martin Rudalics | 2012-11-23 15:39:07 +0100 |
| commit | 0d4bb04f1a82acacdcfffa0bb1a42393365608db (patch) | |
| tree | 62ab484cebae08e300720556bf6a3ae28f14fdc2 | |
| parent | 90d99fdf02ce6494b7e004936e467da6edd2bf73 (diff) | |
| download | emacs-0d4bb04f1a82acacdcfffa0bb1a42393365608db.tar.gz emacs-0d4bb04f1a82acacdcfffa0bb1a42393365608db.zip | |
Correct and reword recent changes to window.texi.
* windows.texi (Basic Windows): Fix typo.
(Windows and Frames): Fix example. Move description of
window-in-direction here.
(Recombining Windows): Fix example.
(Buffers and Windows): Fix description of
replace-buffer-in-windows.
(Switching Buffers): Reword.
(Display Action Functions): Minor adjustments.
(Choosing Window Options): Minor fixes.
(Window History): Minor rewording.
(Dedicated Windows): Correct and reword part describing how
dedicatedness affects functions removing buffers or windows.
* buffers.texi (The Buffer List): Fix description of
bury-buffer.
| -rw-r--r-- | doc/lispref/ChangeLog | 17 | ||||
| -rw-r--r-- | doc/lispref/buffers.texi | 20 | ||||
| -rw-r--r-- | doc/lispref/windows.texi | 267 |
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 @@ | |||
| 1 | 2012-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 | |||
| 1 | 2012-11-23 Chong Yidong <cyd@gnu.org> | 18 | 2012-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 |
| 887 | itself or the name of one. | 887 | itself or the name of one. |
| 888 | 888 | ||
| 889 | This functions operates on each frame's @code{buffer-list} parameter as | 889 | This function operates on each frame's @code{buffer-list} parameter as |
| 890 | well as the fundamental buffer list; therefore, the buffer that you bury | 890 | well as the fundamental buffer list; therefore, the buffer that you bury |
| 891 | will come last in the value of @code{(buffer-list @var{frame})} and in | 891 | will come last in the value of @code{(buffer-list @var{frame})} and in |
| 892 | the value of @code{(buffer-list)}. In addition, it also puts the buffer | 892 | the value of @code{(buffer-list)}. In addition, it also puts the buffer |
| @@ -896,15 +896,15 @@ History}) provided it is shown in that window. | |||
| 896 | If @var{buffer-or-name} is @code{nil} or omitted, this means to bury the | 896 | If @var{buffer-or-name} is @code{nil} or omitted, this means to bury the |
| 897 | current buffer. In addition, if the current buffer is displayed in the | 897 | current buffer. In addition, if the current buffer is displayed in the |
| 898 | selected window, this makes sure that the window is either deleted or | 898 | selected window, this makes sure that the window is either deleted or |
| 899 | another buffer is shown in it. More precisely, if the window is | 899 | another buffer is shown in it. More precisely, if the selected window |
| 900 | dedicated (@pxref{Dedicated Windows}) and there are other windows on its | 900 | is dedicated (@pxref{Dedicated Windows}) and there are other windows on |
| 901 | frame, the window is deleted. If the window is both dedicated and the | 901 | its frame, the window is deleted. If it is the only window on its frame |
| 902 | only window on its frame's terminal, the function specified by | 902 | and 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 |
| 904 | with 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 | 905 | it calls @code{switch-to-prev-buffer} (@pxref{Window History}) to show |
| 906 | buffer in that window. If @var{buffer-or-name} is displayed in some | 906 | another buffer in that window. If @var{buffer-or-name} is displayed in |
| 907 | other window, it remains displayed there. | 907 | some other window, it remains displayed there. |
| 908 | 908 | ||
| 909 | To replace a buffer in all the windows that display it, use | 909 | To 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 | ||
| 54 | A @dfn{window} is a area of the screen that is used to display a | 54 | A @dfn{window} is an area of the screen that is used to display a buffer |
| 55 | buffer (@pxref{Buffers}). In Emacs Lisp, windows are represented by a | 55 | (@pxref{Buffers}). In Emacs Lisp, windows are represented by a special |
| 56 | special Lisp object type. | 56 | Lisp 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 |
| 250 | The root window of this frame is an internal window, @code{W1}. Its | 250 | The root window of this frame is an internal window, @var{W1}. Its |
| 251 | child windows form a horizontal combination, consisting of the live | 251 | child windows form a horizontal combination, consisting of the live |
| 252 | window @code{W2} and the internal window @code{W3}. The child windows | 252 | window @var{W2} and the internal window @var{W3}. The child windows |
| 253 | of @code{W3} form a vertical combination, consisting of the live | 253 | of @var{W3} form a vertical combination, consisting of the live |
| 254 | windows @code{W4} and @code{W5}. Hence, the live windows in this | 254 | windows @var{W4} and @var{W5}. Hence, the live windows in this |
| 255 | window tree are @code{W2} @code{W4}, and @code{W5}. | 255 | window 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 |
| 258 | internal window, and the siblings of a child window. | 258 | internal window, and the siblings of a child window. |
| @@ -308,8 +308,8 @@ The functions @code{window-next-sibling} and | |||
| 308 | and previous window, respectively, in the cyclic ordering of windows | 308 | and 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 |
| 312 | a frame, and to retrieve the entire window tree of a frame: | 312 | frame 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 |
| 315 | This function returns the live window at the upper left corner of the | 315 | This 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 | |||
| 318 | to the selected frame. If @var{frame-or-window} specifies a window, | 318 | to the selected frame. If @var{frame-or-window} specifies a window, |
| 319 | this function returns the first window on that window's frame. Under | 319 | this function returns the first window on that window's frame. Under |
| 320 | the assumption that the frame from our canonical example is selected | 320 | the 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 | ||
| 326 | This function returns the nearest live window in direction | ||
| 327 | @var{direction} as seen from the position of @code{window-point} in | ||
| 328 | window @var{window}. The argument @var{direction} must be one of | ||
| 329 | @code{above}, @code{below}, @code{left} or @code{right}. The optional | ||
| 330 | argument @var{window} must denote a live window and defaults to the | ||
| 331 | selected one. | ||
| 332 | |||
| 333 | This function does not return a window whose @code{no-other-window} | ||
| 334 | parameter is non-@code{nil} (@pxref{Window Parameters}). If the nearest | ||
| 335 | window's @code{no-other-window} parameter is non-@code{nil}, this | ||
| 336 | function tries to find another window in the indicated direction whose | ||
| 337 | @code{no-other-window} parameter is @code{nil}. If the optional | ||
| 338 | argument @var{ignore} is non-@code{nil}, a window may be returned even | ||
| 339 | if its @code{no-other-window} parameter is non-@code{nil}. | ||
| 340 | |||
| 341 | If it doesn't find a suitable window, this function returns @code{nil}. | ||
| 342 | @end defun | ||
| 343 | |||
| 344 | The following function allows to retrieve the entire window tree of a | ||
| 345 | frame: | ||
| 346 | |||
| 324 | @defun window-tree &optional frame | 347 | @defun window-tree &optional frame |
| 325 | This function returns a list representing the window tree for frame | 348 | This 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 | ||
| 928 | When deleting the last sibling of a window @code{W}, its parent window | 951 | When deleting the last sibling of a window @var{W}, its parent window |
| 929 | is deleted too, with @code{W} replacing it in the window tree. This | 952 | is deleted too, with @var{W} replacing it in the window tree. This |
| 930 | means that @code{W} must be recombined with its parent's siblings to | 953 | means that @var{W} must be recombined with its parent's siblings to |
| 931 | form a new window combination (@pxref{Windows and Frames}). In some | 954 | form a new window combination (@pxref{Windows and Frames}). In some |
| 932 | occasions, deleting a live window may even entail the deletion of two | 955 | occasions, deleting a live window may even entail the deletion of two |
| 933 | internal windows. | 956 | internal windows. |
| @@ -952,20 +975,20 @@ internal windows. | |||
| 952 | @end smallexample | 975 | @end smallexample |
| 953 | 976 | ||
| 954 | @noindent | 977 | @noindent |
| 955 | Deleting @code{W5} in this configuration normally causes the deletion of | 978 | Deleting @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 |
| 958 | combination with parent @code{W1}. | 981 | combination 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 |
| 962 | was used to preserve a combination embedded in a combination of the same | 985 | was used to preserve a combination embedded in a combination of the same |
| 963 | type. Such embeddings make sense to assure that when you split a window | 986 | type. Such embeddings make sense to assure that when you split a window |
| 964 | and subsequently delete the new window, Emacs reestablishes the layout | 987 | and subsequently delete the new window, Emacs reestablishes the layout |
| 965 | of the associated frame as it existed before the splitting. | 988 | of 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 |
| 991 | Split @code{W2} to make a new window @code{W4} as follows. | 1014 | Split @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 |
| 1014 | Now, when enlarging a window vertically, Emacs tries to obtain the | 1037 | Now, when enlarging a window vertically, Emacs tries to obtain the |
| 1015 | corresponding space from its lower sibling, provided such a window | 1038 | corresponding space from its lower sibling, provided such a window |
| 1016 | exists. In our scenario, enlarging @code{W4} will steal space from | 1039 | exists. 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 |
| 1040 | Deleting @code{W4} will now give its entire space to @code{W2}, | 1063 | Deleting @var{W4} will now give its entire space to @var{W2}, |
| 1041 | including the space earlier stolen from @code{W3}. | 1064 | including 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 |
| 1064 | This can be counterintutive, in particular if @code{W4} were used for | 1087 | This can be counterintutive, in particular if @var{W4} were used for |
| 1065 | displaying a buffer only temporarily (@pxref{Temporary Displays}), and | 1088 | displaying a buffer only temporarily (@pxref{Temporary Displays}), and |
| 1066 | you want to continue working with the initial layout. | 1089 | you want to continue working with the initial layout. |
| 1067 | 1090 | ||
| 1068 | The behavior can be fixed by making a new parent window when splitting | 1091 | The 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 |
| 1072 | This variable controls whether splitting a window shall make a new | 1095 | This 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 | |||
| 1108 | the child windows are deleted (see below). | 1131 | the 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 |
| 1112 | the initial configuration of our scenario would have produced this: | 1135 | the 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 |
| 1135 | A new internal window @code{W5} has been created; its children are | 1158 | A 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 |
| 1137 | sibling of @code{W4}, so enlarging @code{W4} will try to shrink | 1160 | sibling 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} |
| 1139 | represents a vertical combination of two windows embedded in the | 1162 | represents a vertical combination of two windows embedded in the |
| 1140 | vertical combination @code{W1}. | 1163 | vertical 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 | |||
| 1162 | siblings. | 1185 | siblings. |
| 1163 | 1186 | ||
| 1164 | If, in the configuration shown at the beginning of this section, the | 1187 | If, in the configuration shown at the beginning of this section, the |
| 1165 | combination limit of @code{W4} (the parent window of @code{W6} and | 1188 | combination 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 | ||
| 1170 | Alternatively, the problems sketched above can be avoided by always | 1193 | Alternatively, the problems sketched above can be avoided by always |
| @@ -1215,7 +1238,7 @@ the following frame layout. | |||
| 1215 | 1238 | ||
| 1216 | @noindent | 1239 | @noindent |
| 1217 | If @code{window-combination-resize} is @code{nil}, splitting window | 1240 | If @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 |
| 1241 | If @code{window-combination-resize} is @code{t}, splitting @code{W3} | 1264 | If @code{window-combination-resize} is @code{t}, splitting @var{W3} |
| 1242 | instead leaves all three live windows with approximately the same | 1265 | instead leaves all three live windows with approximately the same |
| 1243 | height: | 1266 | height: |
| 1244 | 1267 | ||
| @@ -1263,7 +1286,7 @@ height: | |||
| 1263 | @end smallexample | 1286 | @end smallexample |
| 1264 | 1287 | ||
| 1265 | @noindent | 1288 | @noindent |
| 1266 | Deleting any of the live windows @code{W2}, @code{W3} or @code{W4} will | 1289 | Deleting any of the live windows @var{W2}, @var{W3} or @var{W4} will |
| 1267 | distribute its space proportionally among the two remaining live | 1290 | distribute its space proportionally among the two remaining live |
| 1268 | windows. | 1291 | windows. |
| 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 | ||
| 1515 | This function returns the nearest window in direction @var{direction} as | ||
| 1516 | seen from the position of @code{window-point} in window @var{window}. | ||
| 1517 | The argument @var{direction} must be one of @code{above}, @code{below}, | ||
| 1518 | @code{left} or @code{right}. The optional argument @var{window} must | ||
| 1519 | denote a live window and defaults to the selected one. | ||
| 1520 | |||
| 1521 | This function does not return a window whose @code{no-other-window} | ||
| 1522 | parameter is non-@code{nil}. If the nearest window's | ||
| 1523 | @code{no-other-window} parameter is non-@code{nil}, this function tries | ||
| 1524 | to find another window in the indicated direction whose | ||
| 1525 | @code{no-other-window} parameter is @code{nil}. If the optional | ||
| 1526 | argument @var{ignore} is non-@code{nil}, a window may be returned even | ||
| 1527 | if its @code{no-other-window} parameter is non-@code{nil}. | ||
| 1528 | |||
| 1529 | If 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 |
| 1633 | This command replaces @var{buffer-or-name} with some other buffer, in | 1637 | This command replaces @var{buffer-or-name} with some other buffer, in |
| 1634 | all windows displaying it. @var{buffer-or-name} should be a buffer, | 1638 | all windows displaying it. @var{buffer-or-name} should be a buffer, or |
| 1635 | or the name of an existing buffer; if omitted or @code{nil}, it | 1639 | the name of an existing buffer; if omitted or @code{nil}, it defaults to |
| 1636 | defaults to the current buffer. | 1640 | the current buffer. |
| 1637 | 1641 | ||
| 1638 | The replacement buffer in each window is chosen via | 1642 | The 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 |
| 1640 | window displaying @var{buffer-or-name} is deleted (@pxref{Dedicated | 1644 | window displaying @var{buffer-or-name} is deleted if possible |
| 1641 | Windows}), 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 |
| 1642 | only window, and that frame is not the only frame on its terminal, the | 1646 | frame and there are other frames on the same terminal, the frame is |
| 1643 | frame is ``dismissed'' by calling the function specified by | 1647 | deleted as well. If the dedicated window is the only window on the only |
| 1644 | @code{frame-auto-hide-function} (@pxref{Quitting Windows}). If the | 1648 | frame on its terminal, the buffer is replaced anyway. |
| 1645 | dedicated window is the only window on the only frame on its terminal, | ||
| 1646 | the 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 | 1657 | This section describes high-level functions for switching to a specified |
| 1655 | specified buffer in some window. | 1658 | buffer 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 | ||
| 1660 | window (and its frame the selected frame), and (3) make the buffer the | ||
| 1661 | current 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 |
| 1658 | current just so a Lisp program can access or modify it. They have | 1664 | current 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 |
| 1666 | This command attempts to display @var{buffer-or-name} in the selected | 1672 | This command attempts to display @var{buffer-or-name} in the selected |
| 1667 | window, and makes it the current buffer. It is often used | 1673 | window and make it the current buffer. It is often used interactively |
| 1668 | interactively (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 |
| 1669 | programs. The return value is the buffer switched to. | 1675 | return value is the buffer switched to. |
| 1670 | 1676 | ||
| 1671 | If @var{buffer-or-name} is @code{nil}, it defaults to the buffer | 1677 | If @var{buffer-or-name} is @code{nil}, it defaults to the buffer |
| 1672 | returned by @code{other-buffer} (@pxref{The Buffer List}). If | 1678 | returned 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 | |||
| 1690 | instead. | 1696 | instead. |
| 1691 | @end deffn | 1697 | @end deffn |
| 1692 | 1698 | ||
| 1693 | By default, @code{switch-to-buffer} sets @code{window-point} of the | 1699 | By default, @code{switch-to-buffer} shows the buffer at its position of |
| 1694 | window used to the buffer's position of @code{point}. This behavior can | 1700 | @code{point}. This behavior can be tuned using the following option. |
| 1695 | be tuned using the following option. | ||
| 1696 | 1701 | ||
| 1697 | @defopt switch-to-buffer-preserve-window-point | 1702 | @defopt switch-to-buffer-preserve-window-point |
| 1698 | If this variable is @code{nil}, @code{switch-to-buffer} displays the | 1703 | If 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 | |||
| 1710 | buffer. | 1715 | buffer. |
| 1711 | @end defopt | 1716 | @end defopt |
| 1712 | 1717 | ||
| 1713 | The next two functions are similar to @code{switch-to-buffer}, except | 1718 | The next two commands are similar to @code{switch-to-buffer}, except for |
| 1714 | for the described features. | 1719 | the 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 |
| 1717 | This function makes the buffer specified by @var{buffer-or-name} | 1722 | This function displays the buffer specified by @var{buffer-or-name} in |
| 1718 | current and displays it in some window other than the selected window. | 1723 | some window other than the selected window. It uses the function |
| 1719 | It uses the function @code{pop-to-buffer} internally (see below). | 1724 | @code{pop-to-buffer} internally (see below). |
| 1720 | 1725 | ||
| 1721 | If the selected window already displays the specified buffer, it | 1726 | If the selected window already displays the specified buffer, it |
| 1722 | continues to do so, but another window is nonetheless found to display | 1727 | continues 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 |
| 1730 | This function makes the buffer specified by @var{buffer-or-name} | 1735 | This function displays the buffer specified by @var{buffer-or-name} in a |
| 1731 | current and displays it, usually in a new frame. It uses the function | 1736 | new frame. It uses the function @code{pop-to-buffer} internally (see |
| 1732 | @code{pop-to-buffer} (see below). | 1737 | below). |
| 1733 | 1738 | ||
| 1734 | If the specified buffer is already displayed in another window, in any | 1739 | If the specified buffer is already displayed in another window, in any |
| 1735 | frame on the current terminal, this switches to that window instead of | 1740 | frame 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 | ||
| 1989 | This function can fail if no window splitting can be performed for some | 1994 | This function can fail if no window splitting can be performed for some |
| 1990 | reason (e.g. if there is just one frame and it has an | 1995 | reason (e.g. if the selected frame has an @code{unsplittable} frame |
| 1991 | @code{unsplittable} frame parameter; @pxref{Buffer Parameters}). | 1996 | parameter; @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 |
| 2037 | Evaluating the form above will cause @code{display-buffer} to proceed as | 2042 | Evaluating the form above will cause @code{display-buffer} to proceed as |
| 2038 | follows: If `*foo*' already appears on a visible or iconified frame, it | 2043 | follows: If a buffer called *foo* already appears on a visible or |
| 2039 | will reuse its window. Otherwise, it will try to pop up a new window | 2044 | iconified frame, it will reuse its window. Otherwise, it will try to |
| 2040 | or, if that is impossible, a new frame. If all these steps fail, it | 2045 | pop up a new window or, if that is impossible, a new frame and show the |
| 2041 | will proceed using whatever @code{display-buffer-base-action} and | 2046 | buffer 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 |
| 2046 | popped-up window as follows: If the window is part of a vertical | 2052 | popped-up window as follows: If the window is part of a vertical |
| 2047 | combination, it will set its height to ten lines. Note that if, instead | 2053 | combination, it will set its height to ten lines. Note that if, instead |
| 2048 | of the number ``10'', we specified the function | 2054 | of 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 |
| 2080 | Evaluating this form will cause @code{display-buffer} to first try | 2086 | This form will have @code{display-buffer} first try reusing a window |
| 2081 | reusing a window showing @code{*foo*} on the selected frame. | 2087 | that shows *foo* on the selected frame. If there's no such window, it |
| 2082 | If no such window exists, it will try to split the selected window or, | 2088 | will try to split the selected window or, if that is impossible, use the |
| 2083 | if that is impossible, use the window below the selected window. | 2089 | window 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 |
| 2086 | selected one is dedicated to its buffer, @code{display-buffer} will | 2092 | selected 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 | |||
| 2119 | the window (@pxref{Display Action Functions}). | 2125 | the window (@pxref{Display Action Functions}). |
| 2120 | 2126 | ||
| 2121 | The default value is @code{split-window-sensibly}, which is documented | 2127 | The default value is @code{split-window-sensibly}, which is documented |
| 2122 | below. The value must be a function that takes one argument, a | 2128 | below. The value must be a function that takes one argument, a window, |
| 2123 | window, and return either a new window (which is used to display the | 2129 | and return either a new window (which will be used to display the |
| 2124 | desired buffer) or @code{nil} (which means the splitting failed). | 2130 | desired 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 |
| 2199 | A list of buffer names for buffers that should be displayed in the | 2205 | A list of buffer names for buffers that should be displayed in the |
| 2200 | selected window. If a buffer's name is in this list, | 2206 | selected 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 |
| 2202 | selected window. | 2208 | window. |
| 2203 | @end defopt | 2209 | @end defopt |
| 2204 | 2210 | ||
| 2205 | @defopt same-window-regexps | 2211 | @defopt same-window-regexps |
| 2206 | A list of regular expressions that specify buffers that should be | 2212 | A list of regular expressions that specify buffers that should be |
| 2207 | displayed in the selected window. If the buffer's name matches any of | 2213 | displayed in the selected window. If the buffer's name matches any of |
| 2208 | the regular expressions in this list, @code{display-buffer} handles the | 2214 | the regular expressions in this list, @code{display-buffer} handles the |
| 2209 | buffer by switching to it in the selected window. | 2215 | buffer 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 | ||
| 2222 | Each window remembers the buffers it has previously displayed, and the order | 2228 | Each window remembers in a list the buffers it has previously displayed, |
| 2223 | in which these buffers were removed from it. This history is used, | 2229 | and the order in which these buffers were removed from it. This history |
| 2224 | for example, by @code{replace-buffer-in-windows} (@pxref{Buffers and | 2230 | is used, for example, by @code{replace-buffer-in-windows} |
| 2225 | Windows}). This list is automatically maintained by Emacs, but you can | 2231 | (@pxref{Buffers and Windows}). The list is automatically maintained by |
| 2226 | use the following functions to explicitly inspect or alter it: | 2232 | Emacs, but you can use the following functions to explicitly inspect or |
| 2233 | alter it: | ||
| 2227 | 2234 | ||
| 2228 | @defun window-prev-buffers &optional window | 2235 | @defun window-prev-buffers &optional window |
| 2229 | This function returns a list specifying the previous contents of | 2236 | This 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 |
| 2231 | selected window. | 2238 | window and defaults to the selected one. |
| 2232 | 2239 | ||
| 2233 | Each list element has the form @code{(@var{buffer} @var{window-start} | 2240 | Each 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 |
| 2235 | the window, @var{window-start} is the window start position when that | 2242 | the window, @var{window-start} is the window start position when that |
| 2236 | buffer was last shown, and @var{window-pos} is the point position when | 2243 | buffer was last shown, and @var{window-pos} is the point position when |
| 2237 | that buffer was last shown. | 2244 | that buffer was last shown in @var{window}. |
| 2238 | 2245 | ||
| 2239 | The list is ordered so that earlier elements correspond to more | 2246 | The list is ordered so that earlier elements correspond to more |
| 2240 | recently-shown buffers, and the first element usually corresponds to the | 2247 | recently-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 | |||
| 2331 | windows by marking these windows as @dfn{dedicated} to their buffers. | 2338 | windows 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 |
| 2333 | window for displaying another buffer in it. @code{get-lru-window} and | 2340 | window 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 |
| 2335 | dedicated windows as candidates when their @var{dedicated} argument is | 2342 | consider dedicated windows as candidates when their @var{dedicated} |
| 2336 | non-@code{nil}. The behavior of @code{set-window-buffer} | 2343 | argument 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 |
| 2338 | slightly different, see below. | 2345 | slightly different, see below. |
| 2339 | 2346 | ||
| 2340 | When @code{delete-windows-on} (@pxref{Deleting Windows}) wants to | 2347 | Functions supposed to remove a buffer from a window or a window from |
| 2341 | delete a dedicated window and that window is the only window on its | 2348 | a frame can behave specially when a window they operate on is dedicated. |
| 2342 | frame, it deletes the window's frame too, provided there are other | 2349 | We will distinguish three basic cases, namely where (1) the window is |
| 2343 | frames left. @code{replace-buffer-in-windows} (@pxref{Switching | 2350 | not the only window on its frame, (2) the window is the only window on |
| 2344 | Buffers}) tries to delete all dedicated windows showing its buffer | 2351 | its frame but there are other frames on the same terminal left, and (3) |
| 2345 | argument. When such a window is the only window on its frame, that | 2352 | the window is the only window on the only frame on the same terminal. |
| 2346 | frame is deleted, provided there are other frames left. If there are | 2353 | |
| 2347 | no more frames left, some other buffer is displayed in the window, and | 2354 | In particular, @code{delete-windows-on} (@pxref{Deleting Windows}) |
| 2348 | the window is marked as non-dedicated. | 2355 | handles case (2) by deleting the associated frame and case (3) by |
| 2349 | 2356 | showing another buffer in that frame's only window. The function | |
| 2350 | When you kill a buffer (@pxref{Killing Buffers}) displayed in a | 2357 | @code{replace-buffer-in-windows} (@pxref{Buffers and Windows}) which is |
| 2351 | dedicated window, any such window usually gets deleted too, since | 2358 | called when a buffer gets killed, deletes the window in case (1) and |
| 2352 | @code{kill-buffer} calls @code{replace-buffer-in-windows} for cleaning | 2359 | behaves like @code{delete-windows-on} otherwise. |
| 2353 | up windows. Burying a buffer (@pxref{The Buffer List}) deletes the | 2360 | |
| 2354 | selected window if it is dedicated to that buffer. If, however, that | 2361 | When @code{bury-buffer} (@pxref{The Buffer List}) operates on the |
| 2355 | window is the only window on its frame, @code{bury-buffer} displays | 2362 | selected window (which shows the buffer that shall be buried), it |
| 2356 | another buffer in it and iconifies the frame. | 2363 | handles case (2) by calling @code{frame-auto-hide-function} |
| 2364 | (@pxref{Quitting Windows}) to deal with the selected frame. The other | ||
| 2365 | two 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 |
| 2359 | This function returns non-@code{nil} if @var{window} is dedicated to its | 2368 | This function returns non-@code{nil} if @var{window} is dedicated to its |