diff options
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/emacs/ChangeLog | 14 | ||||
| -rw-r--r-- | doc/emacs/buffers.texi | 42 | ||||
| -rw-r--r-- | doc/emacs/emacs.texi | 3 | ||||
| -rw-r--r-- | doc/emacs/emacsver.texi | 2 | ||||
| -rw-r--r-- | doc/emacs/frames.texi | 18 | ||||
| -rw-r--r-- | doc/emacs/windows.texi | 205 | ||||
| -rw-r--r-- | doc/lispref/ChangeLog | 36 | ||||
| -rw-r--r-- | doc/lispref/buffers.texi | 41 | ||||
| -rw-r--r-- | doc/lispref/display.texi | 13 | ||||
| -rw-r--r-- | doc/lispref/elisp.texi | 10 | ||||
| -rw-r--r-- | doc/lispref/files.texi | 7 | ||||
| -rw-r--r-- | doc/lispref/vol1.texi | 8 | ||||
| -rw-r--r-- | doc/lispref/vol2.texi | 8 | ||||
| -rw-r--r-- | doc/lispref/windows.texi | 811 | ||||
| -rw-r--r-- | doc/man/emacs.1 | 2 | ||||
| -rw-r--r-- | doc/misc/texinfo.tex | 314 |
16 files changed, 1042 insertions, 492 deletions
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index 163eabed2a6..ac913fc3264 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog | |||
| @@ -1,3 +1,17 @@ | |||
| 1 | 2011-09-24 Chong Yidong <cyd@stupidchicken.com> | ||
| 2 | |||
| 3 | * windows.texi (Pop Up Window): Defer discussion of window | ||
| 4 | splitting to the Window Choice node. Add index entries. | ||
| 5 | (Force Same Window): Node deleted. | ||
| 6 | (Displaying Buffers, Window Choice): New nodes. | ||
| 7 | |||
| 8 | * buffers.texi (Select Buffer): Clarify description of | ||
| 9 | buffer-switching commands. Add xref to Window Display node. | ||
| 10 | Don't repeat confirm-nonexistent-file-or-buffer description from | ||
| 11 | Visiting node. Remove even-window-heights. | ||
| 12 | |||
| 13 | * frames.texi (Special Buffer Frames): Add xref to Window Choice. | ||
| 14 | |||
| 1 | 2011-09-18 Chong Yidong <cyd@stupidchicken.com> | 15 | 2011-09-18 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 16 | ||
| 3 | * cmdargs.texi (Icons X): Fix description of Emacs icon. | 17 | * cmdargs.texi (Icons X): Fix description of Emacs icon. |
diff --git a/doc/emacs/buffers.texi b/doc/emacs/buffers.texi index c4880af2b5d..b82f3fac7d4 100644 --- a/doc/emacs/buffers.texi +++ b/doc/emacs/buffers.texi | |||
| @@ -91,9 +91,9 @@ selected buffer other than the current buffer. | |||
| 91 | @var{bufname} @key{RET}}. This runs the command | 91 | @var{bufname} @key{RET}}. This runs the command |
| 92 | @code{switch-to-buffer} with argument @var{bufname}. While entering | 92 | @code{switch-to-buffer} with argument @var{bufname}. While entering |
| 93 | the buffer name, you can use the usual minibuffer completion and | 93 | the buffer name, you can use the usual minibuffer completion and |
| 94 | history commands (@pxref{Minibuffer}). An empty argument to @kbd{C-x | 94 | history commands (@pxref{Minibuffer}). An empty input specifies the |
| 95 | b} specifies the buffer that was current most recently among those not | 95 | buffer that was current most recently among those not now displayed in |
| 96 | now displayed in any window. | 96 | any window. |
| 97 | 97 | ||
| 98 | @cindex minibuffer confirmation | 98 | @cindex minibuffer confirmation |
| 99 | @cindex confirming in the minibuffer | 99 | @cindex confirming in the minibuffer |
| @@ -107,16 +107,8 @@ catches a common mistake, in which one types @key{RET} before | |||
| 107 | realizing that @key{TAB} did not complete far enough to yield the | 107 | realizing that @key{TAB} did not complete far enough to yield the |
| 108 | desired buffer name (@pxref{Completion}). Emacs asks for confirmation | 108 | desired buffer name (@pxref{Completion}). Emacs asks for confirmation |
| 109 | by putting the message @samp{[Confirm]} in the minibuffer; type | 109 | by putting the message @samp{[Confirm]} in the minibuffer; type |
| 110 | @key{RET} again to confirm and visit the buffer. | 110 | @key{RET} again to confirm and visit the buffer. @xref{Visiting}, for |
| 111 | 111 | information about modifying this behavior. | |
| 112 | @vindex confirm-nonexistent-file-or-buffer | ||
| 113 | The variable @code{confirm-nonexistent-file-or-buffer} controls | ||
| 114 | whether Emacs asks for confirmation before visiting a buffer that did | ||
| 115 | not previously exist. The default value, @code{after-completion}, | ||
| 116 | gives the behavior we have just described. If the value is | ||
| 117 | @code{nil}, Emacs never asks for confirmation; for any other | ||
| 118 | non-@code{nil} value, Emacs always asks for confirmation. This | ||
| 119 | variable also affects the @code{find-file} command (@pxref{Visiting}). | ||
| 120 | 112 | ||
| 121 | One reason to create a new buffer is to use it for making temporary | 113 | One reason to create a new buffer is to use it for making temporary |
| 122 | notes. If you try to save it, Emacs asks for the file name to use. | 114 | notes. If you try to save it, Emacs asks for the file name to use. |
| @@ -136,36 +128,26 @@ of most recent selection in the current frame), while @kbd{C-x @key{LEFT}} | |||
| 136 | 128 | ||
| 137 | @kindex C-x 4 b | 129 | @kindex C-x 4 b |
| 138 | @findex switch-to-buffer-other-window | 130 | @findex switch-to-buffer-other-window |
| 139 | @vindex even-window-heights | ||
| 140 | To select a buffer in a window other than the current one, type | 131 | To select a buffer in a window other than the current one, type |
| 141 | @kbd{C-x 4 b} (@code{switch-to-buffer-other-window}). This prompts | 132 | @kbd{C-x 4 b} (@code{switch-to-buffer-other-window}). This prompts |
| 142 | for a buffer name using the minibuffer, displays that buffer in | 133 | for a buffer name using the minibuffer, displays that buffer in |
| 143 | another window, and selects that window. By default, if displaying | 134 | another window, and selects that window. |
| 144 | the buffer causes two vertically adjacent windows to be displayed, the | ||
| 145 | heights of those windows are evened out; to countermand that and | ||
| 146 | preserve the window configuration, set the variable | ||
| 147 | @code{even-window-heights} to @code{nil}. | ||
| 148 | 135 | ||
| 149 | @kindex C-x 5 b | 136 | @kindex C-x 5 b |
| 150 | @findex switch-to-buffer-other-frame | 137 | @findex switch-to-buffer-other-frame |
| 151 | Similarly, @kbd{C-x 5 b} (@code{switch-to-buffer-other-frame}) | 138 | Similarly, @kbd{C-x 5 b} (@code{switch-to-buffer-other-frame}) |
| 152 | prompts for a buffer name, displays that buffer in another frame, and | 139 | prompts for a buffer name, displays that buffer in another frame, and |
| 153 | selects that frame. | 140 | selects that frame. If the buffer is already being shown in a window |
| 141 | on another frame, Emacs selects that window and frame instead of | ||
| 142 | creating a new frame. | ||
| 143 | |||
| 144 | @xref{Displaying Buffers}, for how the @kbd{C-x 4 b} and @kbd{C-x 5 | ||
| 145 | b} commands get the window and/or frame to display in. | ||
| 154 | 146 | ||
| 155 | In addition, @kbd{C-x C-f}, and any other command for visiting a | 147 | In addition, @kbd{C-x C-f}, and any other command for visiting a |
| 156 | file, can also be used to switch to an existing file-visiting buffer. | 148 | file, can also be used to switch to an existing file-visiting buffer. |
| 157 | @xref{Visiting}. | 149 | @xref{Visiting}. |
| 158 | 150 | ||
| 159 | @vindex display-buffer-reuse-frames | ||
| 160 | You can control how certain buffers are handled by these commands by | ||
| 161 | customizing the variables @code{special-display-buffer-names}, | ||
| 162 | @code{special-display-regexps}, @code{same-window-buffer-names}, and | ||
| 163 | @code{same-window-regexps}. See @ref{Force Same Window}, and | ||
| 164 | @ref{Special Buffer Frames}, for more about these variables. In | ||
| 165 | addition, if the value of @code{display-buffer-reuse-frames} is | ||
| 166 | non-@code{nil}, and the buffer you want to switch to is already | ||
| 167 | displayed in some frame, Emacs will just raise that frame. | ||
| 168 | |||
| 169 | @findex goto-line | 151 | @findex goto-line |
| 170 | @kbd{C-u M-g M-g}, that is @code{goto-line} with a plain prefix | 152 | @kbd{C-u M-g M-g}, that is @code{goto-line} with a plain prefix |
| 171 | argument, reads a number @var{n} using the minibuffer, selects the | 153 | argument, reads a number @var{n} using the minibuffer, selects the |
diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi index 2ba4af712af..bb675b61cff 100644 --- a/doc/emacs/emacs.texi +++ b/doc/emacs/emacs.texi | |||
| @@ -488,9 +488,8 @@ Multiple Windows | |||
| 488 | * Split Window:: New windows are made by splitting existing windows. | 488 | * Split Window:: New windows are made by splitting existing windows. |
| 489 | * Other Window:: Moving to another window or doing something to it. | 489 | * Other Window:: Moving to another window or doing something to it. |
| 490 | * Pop Up Window:: Finding a file or buffer in another window. | 490 | * Pop Up Window:: Finding a file or buffer in another window. |
| 491 | * Force Same Window:: Forcing certain buffers to appear in the selected | ||
| 492 | window rather than in another window. | ||
| 493 | * Change Window:: Deleting windows and changing their sizes. | 491 | * Change Window:: Deleting windows and changing their sizes. |
| 492 | * Displaying Buffers:: How Emacs picks a window for displaying a buffer. | ||
| 494 | * Window Convenience:: Convenience functions for window handling. | 493 | * Window Convenience:: Convenience functions for window handling. |
| 495 | 494 | ||
| 496 | Frames and Graphical Displays | 495 | Frames and Graphical Displays |
diff --git a/doc/emacs/emacsver.texi b/doc/emacs/emacsver.texi index ffa860585ba..9df86fd9275 100644 --- a/doc/emacs/emacsver.texi +++ b/doc/emacs/emacsver.texi | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | @c It would be nicer to generate this using configure and @version@. | 1 | @c It would be nicer to generate this using configure and @version@. |
| 2 | @c However, that would mean emacsver.texi would always be newer | 2 | @c However, that would mean emacsver.texi would always be newer |
| 3 | @c then the info files in release tarfiles. | 3 | @c then the info files in release tarfiles. |
| 4 | @set EMACSVER 24.0.50 | 4 | @set EMACSVER 24.0.90 |
diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi index 8ca598c3348..619252503a9 100644 --- a/doc/emacs/frames.texi +++ b/doc/emacs/frames.texi | |||
| @@ -850,11 +850,12 @@ each others' edits if they are not careful. | |||
| 850 | 850 | ||
| 851 | @vindex special-display-buffer-names | 851 | @vindex special-display-buffer-names |
| 852 | You can make certain chosen buffers, which Emacs normally displays | 852 | You can make certain chosen buffers, which Emacs normally displays |
| 853 | in ``another window,'' appear in special frames of their own. To do | 853 | in ``some other window'' (@pxref{Displaying Buffers}), appear in |
| 854 | this, set the variable @code{special-display-buffer-names} to a list | 854 | special frames of their own. To do this, set the variable |
| 855 | of buffer names; any buffer whose name is in that list automatically | 855 | @code{special-display-buffer-names} to a list of buffer names; any |
| 856 | gets a special frame, when an Emacs command wants to display it ``in | 856 | buffer whose name is in that list automatically gets a special frame. |
| 857 | another window.'' | 857 | @xref{Window Choice}, for how this fits in with the other ways for |
| 858 | Emacs to choose a window to display in. | ||
| 858 | 859 | ||
| 859 | For example, if you set the variable this way, | 860 | For example, if you set the variable this way, |
| 860 | 861 | ||
| @@ -906,13 +907,6 @@ where @var{function} is a symbol. Then the frame is constructed by | |||
| 906 | calling @var{function}; its first argument is the buffer, and its | 907 | calling @var{function}; its first argument is the buffer, and its |
| 907 | remaining arguments are @var{args}. | 908 | remaining arguments are @var{args}. |
| 908 | 909 | ||
| 909 | An analogous feature lets you specify buffers which should be | ||
| 910 | displayed in the selected window. @xref{Force Same Window}. The | ||
| 911 | same-window feature takes precedence over the special-frame feature; | ||
| 912 | therefore, if you add a buffer name to | ||
| 913 | @code{special-display-buffer-names} and it has no effect, check to see | ||
| 914 | whether that feature is also in use for the same buffer name. | ||
| 915 | |||
| 916 | @node Frame Parameters | 910 | @node Frame Parameters |
| 917 | @section Setting Frame Parameters | 911 | @section Setting Frame Parameters |
| 918 | @cindex Auto-Raise mode | 912 | @cindex Auto-Raise mode |
diff --git a/doc/emacs/windows.texi b/doc/emacs/windows.texi index 6aa8a06778b..dc92e4a519c 100644 --- a/doc/emacs/windows.texi +++ b/doc/emacs/windows.texi | |||
| @@ -18,9 +18,8 @@ one frame. | |||
| 18 | * Split Window:: New windows are made by splitting existing windows. | 18 | * Split Window:: New windows are made by splitting existing windows. |
| 19 | * Other Window:: Moving to another window or doing something to it. | 19 | * Other Window:: Moving to another window or doing something to it. |
| 20 | * Pop Up Window:: Finding a file or buffer in another window. | 20 | * Pop Up Window:: Finding a file or buffer in another window. |
| 21 | * Force Same Window:: Forcing certain buffers to appear in the selected | ||
| 22 | window rather than in another window. | ||
| 23 | * Change Window:: Deleting windows and changing their sizes. | 21 | * Change Window:: Deleting windows and changing their sizes. |
| 22 | * Displaying Buffers:: How Emacs picks a window for displaying a buffer. | ||
| 24 | * Window Convenience:: Convenience functions for window handling. | 23 | * Window Convenience:: Convenience functions for window handling. |
| 25 | @end menu | 24 | @end menu |
| 26 | 25 | ||
| @@ -191,84 +190,47 @@ feature is off by default. | |||
| 191 | 190 | ||
| 192 | @cindex selecting buffers in other windows | 191 | @cindex selecting buffers in other windows |
| 193 | @kindex C-x 4 | 192 | @kindex C-x 4 |
| 194 | @kbd{C-x 4} is a prefix key for commands that select another window | 193 | @kbd{C-x 4} is a prefix key for a variety of commands that switch to |
| 195 | (splitting the window if there is only one) and select a buffer in that | 194 | a buffer in a different window---either another existing window, or a |
| 196 | window. Different @kbd{C-x 4} commands have different ways of finding the | 195 | new window created by splitting the selected window. @xref{Window |
| 197 | buffer to select. | 196 | Choice}, for how Emacs picks or creates the window to use. |
| 198 | 197 | ||
| 199 | @table @kbd | 198 | @table @kbd |
| 199 | @findex switch-to-buffer-other-window | ||
| 200 | @item C-x 4 b @var{bufname} @key{RET} | 200 | @item C-x 4 b @var{bufname} @key{RET} |
| 201 | Select buffer @var{bufname} in another window. This runs | 201 | Select buffer @var{bufname} in another window |
| 202 | @code{switch-to-buffer-other-window}. | 202 | (@code{switch-to-buffer-other-window}). |
| 203 | |||
| 204 | @findex display-buffer | ||
| 203 | @item C-x 4 C-o @var{bufname} @key{RET} | 205 | @item C-x 4 C-o @var{bufname} @key{RET} |
| 204 | Display buffer @var{bufname} in another window, but | 206 | Display buffer @var{bufname} in some window, without trying to select |
| 205 | don't select that buffer or that window. This runs | 207 | it (@code{display-buffer}). @xref{Displaying Buffers}, for details |
| 206 | @code{display-buffer}. | 208 | about how the window is chosen. |
| 209 | |||
| 210 | @findex find-file-other-window | ||
| 207 | @item C-x 4 f @var{filename} @key{RET} | 211 | @item C-x 4 f @var{filename} @key{RET} |
| 208 | Visit file @var{filename} and select its buffer in another window. This | 212 | Visit file @var{filename} and select its buffer in another window |
| 209 | runs @code{find-file-other-window}. @xref{Visiting}. | 213 | (@code{find-file-other-window}). @xref{Visiting}. |
| 214 | |||
| 215 | @findex dired-other-window | ||
| 210 | @item C-x 4 d @var{directory} @key{RET} | 216 | @item C-x 4 d @var{directory} @key{RET} |
| 211 | Select a Dired buffer for directory @var{directory} in another window. | 217 | Select a Dired buffer for directory @var{directory} in another window |
| 212 | This runs @code{dired-other-window}. @xref{Dired}. | 218 | (@code{dired-other-window}). @xref{Dired}. |
| 219 | |||
| 220 | @findex mail-other-window | ||
| 213 | @item C-x 4 m | 221 | @item C-x 4 m |
| 214 | Start composing a mail message in another window. This runs | 222 | Start composing a mail message, similar to @kbd{C-x m} (@pxref{Sending |
| 215 | @code{mail-other-window}; its same-window analogue is @kbd{C-x m} | 223 | Mail}), but in another window (@code{mail-other-window}). |
| 216 | (@pxref{Sending Mail}). | 224 | |
| 225 | @findex find-tag-other-window | ||
| 217 | @item C-x 4 . | 226 | @item C-x 4 . |
| 218 | Find a tag in the current tags table, in another window. This runs | 227 | Find a tag in the current tags table, similar to @kbd{M-.} |
| 219 | @code{find-tag-other-window}, the multiple-window variant of @kbd{M-.} | 228 | (@pxref{Tags}), but in another window (@code{find-tag-other-window}). |
| 220 | (@pxref{Tags}). | ||
| 221 | @item C-x 4 r @var{filename} @key{RET} | 229 | @item C-x 4 r @var{filename} @key{RET} |
| 222 | Visit file @var{filename} read-only, and select its buffer in another | 230 | Visit file @var{filename} read-only, and select its buffer in another |
| 223 | window. This runs @code{find-file-read-only-other-window}. | 231 | window (@code{find-file-read-only-other-window}). @xref{Visiting}. |
| 224 | @xref{Visiting}. | ||
| 225 | @end table | 232 | @end table |
| 226 | 233 | ||
| 227 | @vindex split-height-threshold | ||
| 228 | @vindex split-width-threshold | ||
| 229 | By default, these commands split the window vertically when there is | ||
| 230 | only one. You can customize the variables @code{split-height-threshold} | ||
| 231 | and @code{split-width-threshold} to split the window horizontally | ||
| 232 | instead. | ||
| 233 | |||
| 234 | |||
| 235 | @node Force Same Window | ||
| 236 | @section Forcing Display in the Same Window | ||
| 237 | |||
| 238 | Certain Emacs commands switch to a specific buffer with special | ||
| 239 | contents. For example, @kbd{M-x shell} switches to a buffer named | ||
| 240 | @samp{*shell*}. By convention, all these commands are written to pop up | ||
| 241 | the buffer in a separate window. But you can specify that certain of | ||
| 242 | these buffers should appear in the selected window. | ||
| 243 | |||
| 244 | @vindex same-window-buffer-names | ||
| 245 | If you add a buffer name to the list @code{same-window-buffer-names}, | ||
| 246 | the effect is that such commands display that particular buffer by | ||
| 247 | switching to it in the selected window. For example, if you add the | ||
| 248 | element @code{"*grep*"} to the list, the @code{grep} command will | ||
| 249 | display its output buffer in the selected window. | ||
| 250 | |||
| 251 | The default value of @code{same-window-buffer-names} is not | ||
| 252 | @code{nil}: it specifies buffer names @samp{*info*}, @samp{*mail*} and | ||
| 253 | @samp{*shell*} (as well as others used by more obscure Emacs packages). | ||
| 254 | This is why @kbd{M-x shell} normally switches to the @samp{*shell*} | ||
| 255 | buffer in the selected window. If you delete this element from the | ||
| 256 | value of @code{same-window-buffer-names}, the behavior of @kbd{M-x | ||
| 257 | shell} will change---it will pop up the buffer in another window | ||
| 258 | instead. | ||
| 259 | |||
| 260 | @vindex same-window-regexps | ||
| 261 | You can specify these buffers more generally with the variable | ||
| 262 | @code{same-window-regexps}. Set it to a list of regular expressions; | ||
| 263 | then any buffer whose name matches one of those regular expressions is | ||
| 264 | displayed by switching to it in the selected window. (Once again, this | ||
| 265 | applies only to buffers that normally get displayed for you in a | ||
| 266 | separate window.) The default value of this variable specifies Telnet | ||
| 267 | and rlogin buffers. | ||
| 268 | |||
| 269 | An analogous feature lets you specify buffers which should be | ||
| 270 | displayed in their own individual frames. @xref{Special Buffer Frames}. | ||
| 271 | |||
| 272 | @node Change Window | 234 | @node Change Window |
| 273 | @section Deleting and Rearranging Windows | 235 | @section Deleting and Rearranging Windows |
| 274 | 236 | ||
| @@ -356,6 +318,113 @@ heights of all the windows in the selected frame. | |||
| 356 | Mouse clicks on the mode line provide another way to change window | 318 | Mouse clicks on the mode line provide another way to change window |
| 357 | heights and to delete windows. @xref{Mode Line Mouse}. | 319 | heights and to delete windows. @xref{Mode Line Mouse}. |
| 358 | 320 | ||
| 321 | @node Displaying Buffers | ||
| 322 | @section Displaying a Buffer in a Window | ||
| 323 | |||
| 324 | It is a common Emacs operation to display or ``pop up'' some buffer | ||
| 325 | in response to a user command. There are several different ways by | ||
| 326 | which commands do this. | ||
| 327 | |||
| 328 | Many commands, like @kbd{C-x C-f} (@code{find-file}), display the | ||
| 329 | buffer by ``taking over'' the selected window, expecting that the | ||
| 330 | user's attention will be diverted to that buffer. These commands | ||
| 331 | usually work by calling @code{switch-to-buffer} internally | ||
| 332 | (@pxref{Select Buffer}). | ||
| 333 | |||
| 334 | @findex display-buffer | ||
| 335 | Some commands try to display ``intelligently'', trying not to take | ||
| 336 | over the selected window, e.g. by splitting the selected window and | ||
| 337 | displaying the desired buffer in the child window. Such commands, | ||
| 338 | which include the various help commands (@pxref{Help}), work by | ||
| 339 | calling @code{display-buffer} internally. @xref{Window Choice}, for | ||
| 340 | details. | ||
| 341 | |||
| 342 | Other commands do the same as @code{display-buffer}, and | ||
| 343 | additionally select the displaying window so that you can begin | ||
| 344 | editing its buffer. The command @kbd{C-x `} (@code{next-error}) is | ||
| 345 | one example (@pxref{Compilation Mode}). Such commands work by calling | ||
| 346 | @code{pop-to-buffer} internally. @xref{Displaying Buffers,,Displaying | ||
| 347 | Buffers in Windows, elisp, The Emacs Lisp Reference Manual}. | ||
| 348 | |||
| 349 | Commands with names ending in @code{-other-window} behave like | ||
| 350 | @code{display-buffer}, except that they never display in the selected | ||
| 351 | window. Several of these commands are bound in the @kbd{C-x 4} prefix | ||
| 352 | key (@pxref{Pop Up Window}). | ||
| 353 | |||
| 354 | Commands with names ending in @code{-other-frame} behave like | ||
| 355 | @code{display-buffer}, except that they (i) never display in the | ||
| 356 | selected window and (ii) prefer to create a new frame to display the | ||
| 357 | desired buffer instead of splitting a window---as though the variable | ||
| 358 | @code{pop-up-frames} is set to @code{t} (@pxref{Window Choice}). | ||
| 359 | Several of these commands are bound in the @kbd{C-x 5} prefix key. | ||
| 360 | |||
| 361 | @menu | ||
| 362 | * Window Choice:: How @code{display-buffer} works. | ||
| 363 | @end menu | ||
| 364 | |||
| 365 | @node Window Choice | ||
| 366 | @subsection How @code{display-buffer} works | ||
| 367 | @findex display-buffer | ||
| 368 | |||
| 369 | The @code{display-buffer} command (as well as commands that call it | ||
| 370 | internally) chooses a window to display using the following steps: | ||
| 371 | |||
| 372 | @itemize | ||
| 373 | @vindex same-window-buffer-names | ||
| 374 | @vindex same-window-regexps | ||
| 375 | @item | ||
| 376 | First, check if the buffer should be displayed in the selected window | ||
| 377 | regardless of other considerations. You can tell Emacs to do this by | ||
| 378 | adding the desired buffer's name to the list | ||
| 379 | @code{same-window-buffer-names}, or adding a matching regular | ||
| 380 | expression to the list @code{same-window-regexps}. By default, these | ||
| 381 | variables are @code{nil}, so this step is skipped. | ||
| 382 | |||
| 383 | @vindex display-buffer-reuse-frames | ||
| 384 | @item | ||
| 385 | Otherwise, if the buffer is already displayed in an existing window, | ||
| 386 | ``reuse'' that window. Normally, only windows on the selected frame | ||
| 387 | are considered, but windows on other frames are also reusable if you | ||
| 388 | change @code{display-buffer-reuse-frames} to @code{t}, or if you | ||
| 389 | change @code{pop-up-frames} (see below) to @code{t}. | ||
| 390 | |||
| 391 | @item | ||
| 392 | Otherwise, if you specified that the buffer should be displayed in a | ||
| 393 | special frame by customizing @code{special-display-buffer-names} or | ||
| 394 | @code{special-display-regexps}, do so. @xref{Special Buffer Frames}. | ||
| 395 | |||
| 396 | @vindex pop-up-frames | ||
| 397 | @item | ||
| 398 | Otherwise, optionally create a new frame and display the buffer there. | ||
| 399 | By default, this step is skipped. To enable it, change the variable | ||
| 400 | @code{pop-up-frames} to a non-@code{nil} value. The special value | ||
| 401 | @code{graphic-only} means to do this only on graphical displays. | ||
| 402 | |||
| 403 | @item | ||
| 404 | Otherwise, try to create a new window by splitting the selected | ||
| 405 | window, and display the buffer in that new window. | ||
| 406 | |||
| 407 | @vindex split-height-threshold | ||
| 408 | @vindex split-width-threshold | ||
| 409 | The split can be either vertical or horizontal, depending on the | ||
| 410 | variables @code{split-height-threshold} and | ||
| 411 | @code{split-width-threshold}. These variables should have integer | ||
| 412 | values. If @code{split-height-threshold} is smaller than the selected | ||
| 413 | window's height, the split puts the new window below. Otherwise, if | ||
| 414 | @code{split-width-threshold} is smaller than the window's width, the | ||
| 415 | split puts the new window on the right. If neither condition holds, | ||
| 416 | Emacs tries to split so that the new window is below---but only if the | ||
| 417 | window was not split before (to avoid excessive splitting). | ||
| 418 | |||
| 419 | @item | ||
| 420 | Otherwise, display the buffer in an existing window on the selected | ||
| 421 | frame. | ||
| 422 | |||
| 423 | @item | ||
| 424 | If all the above methods fail for whatever reason, create a new frame | ||
| 425 | and display the buffer there. | ||
| 426 | @end itemize | ||
| 427 | |||
| 359 | @node Window Convenience | 428 | @node Window Convenience |
| 360 | @section Window Handling Convenience Features and Customization | 429 | @section Window Handling Convenience Features and Customization |
| 361 | 430 | ||
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 0094e7c12a6..423e052068b 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,3 +1,39 @@ | |||
| 1 | 2011-09-25 Martin Rudalics <rudalics@gmx.at> | ||
| 2 | |||
| 3 | * windows.texi (Windows and Frames, Display Action Functions) | ||
| 4 | (Switching Buffers): Fix some typos. | ||
| 5 | (Buffers and Windows): Remove reference to window-auto-delete. | ||
| 6 | Reword description of replace-buffer-in-windows. | ||
| 7 | (Window History): Fix some typos and refer to frame local buffer | ||
| 8 | list. | ||
| 9 | (Quitting Windows): New node. | ||
| 10 | (Window Configurations): Add descriptions of window-state-get | ||
| 11 | and window-state-put. | ||
| 12 | (Window Parameters): Describe variable ignore-window-parameters. | ||
| 13 | Sketch some window parameters currently in use. | ||
| 14 | * elisp.texi (Top): Update node listing. | ||
| 15 | |||
| 16 | 2011-09-25 Chong Yidong <cyd@stupidchicken.com> | ||
| 17 | |||
| 18 | * windows.texi (Display Action Functions) | ||
| 19 | (Choosing Window Options): New nodes. | ||
| 20 | |||
| 21 | 2011-09-24 Chong Yidong <cyd@stupidchicken.com> | ||
| 22 | |||
| 23 | * windows.texi (Window History): New node. Move text here from | ||
| 24 | Buffers and Windows. | ||
| 25 | (Switching Buffers): Rename from Displaying Buffers, since we | ||
| 26 | don't document display-buffer here; callers changed. Document | ||
| 27 | FORCE-SAME-WINDOW arg to switch-to-buffer and | ||
| 28 | switch-to-buffer-other-frame. Delete duplicate | ||
| 29 | replace-buffer-in-windows doc. | ||
| 30 | (Choosing Window): Document display actions. | ||
| 31 | |||
| 32 | 2011-09-24 Eli Zaretskii <eliz@gnu.org> | ||
| 33 | |||
| 34 | * display.texi (Forcing Redisplay): Update the description of | ||
| 35 | redisplay-dont-pause due to change in the default value. | ||
| 36 | |||
| 1 | 2011-09-23 Martin Rudalics <rudalics@gmx.at> | 37 | 2011-09-23 Martin Rudalics <rudalics@gmx.at> |
| 2 | 38 | ||
| 3 | * frames.texi (Frames and Windows): Move section and rename to | 39 | * frames.texi (Frames and Windows): Move section and rename to |
diff --git a/doc/lispref/buffers.texi b/doc/lispref/buffers.texi index 0f9de74c948..ce1a8b0fb4e 100644 --- a/doc/lispref/buffers.texi +++ b/doc/lispref/buffers.texi | |||
| @@ -124,7 +124,7 @@ selected window. This is to prevent confusion: it ensures that the | |||
| 124 | buffer that the cursor is in, when Emacs reads a command, is the | 124 | buffer that the cursor is in, when Emacs reads a command, is the |
| 125 | buffer to which that command applies (@pxref{Command Loop}). Thus, | 125 | buffer to which that command applies (@pxref{Command Loop}). Thus, |
| 126 | you should not use @code{set-buffer} to switch visibly to a different | 126 | you should not use @code{set-buffer} to switch visibly to a different |
| 127 | buffer; for that, use the functions described in @ref{Displaying | 127 | buffer; for that, use the functions described in @ref{Switching |
| 128 | Buffers}. | 128 | Buffers}. |
| 129 | 129 | ||
| 130 | When writing a Lisp function, do @emph{not} rely on this behavior of | 130 | When writing a Lisp function, do @emph{not} rely on this behavior of |
| @@ -775,13 +775,14 @@ been displayed in a window. Several functions, notably | |||
| 775 | @code{other-buffer}, use this ordering. A buffer list displayed for the | 775 | @code{other-buffer}, use this ordering. A buffer list displayed for the |
| 776 | user also follows this order. | 776 | user also follows this order. |
| 777 | 777 | ||
| 778 | Creating a buffer adds it to the end of the buffer list, and killing a | 778 | Creating a buffer adds it to the end of the buffer list, and killing |
| 779 | buffer removes it from that list. A buffer moves to the front of this | 779 | a buffer removes it from that list. A buffer moves to the front of |
| 780 | list whenever it is chosen for display in a window (@pxref{Displaying | 780 | this list whenever it is chosen for display in a window |
| 781 | Buffers}) or a window displaying it is selected (@pxref{Selecting | 781 | (@pxref{Switching Buffers}) or a window displaying it is selected |
| 782 | Windows}). A buffer moves to the end of the list when it is buried (see | 782 | (@pxref{Selecting Windows}). A buffer moves to the end of the list |
| 783 | @code{bury-buffer}, below). There are no functions available to the | 783 | when it is buried (see @code{bury-buffer}, below). There are no |
| 784 | Lisp programmer which directly manipulate the buffer list. | 784 | functions available to the Lisp programmer which directly manipulate |
| 785 | the buffer list. | ||
| 785 | 786 | ||
| 786 | In addition to the fundamental buffer list just described, Emacs | 787 | In addition to the fundamental buffer list just described, Emacs |
| 787 | maintains a local buffer list for each frame, in which the buffers that | 788 | maintains a local buffer list for each frame, in which the buffers that |
| @@ -888,24 +889,24 @@ as well as the fundamental buffer list; therefore, the buffer that you | |||
| 888 | bury will come last in the value of @code{(buffer-list @var{frame})} and | 889 | bury will come last in the value of @code{(buffer-list @var{frame})} and |
| 889 | in the value of @code{(buffer-list)}. | 890 | in the value of @code{(buffer-list)}. |
| 890 | 891 | ||
| 891 | If @var{buffer-or-name} is @code{nil} or omitted, this means to bury the | 892 | If @var{buffer-or-name} is @code{nil} or omitted, this means to bury |
| 892 | current buffer. In addition, if the buffer is displayed in the selected | 893 | the current buffer. In addition, if the buffer is displayed in the |
| 893 | window, this switches to some other buffer (obtained using | 894 | selected window, this switches to some other buffer (obtained using |
| 894 | @code{other-buffer}) in the selected window. @xref{Displaying Buffers}. | 895 | @code{other-buffer}) in the selected window. @xref{Switching |
| 895 | But if the selected window is dedicated to its buffer, it deletes that | 896 | Buffers}. But if the selected window is dedicated to its buffer, it |
| 896 | window if there are other windows left on its frame. Otherwise, if the | 897 | deletes that window if there are other windows left on its frame. |
| 897 | selected window is the only window on its frame, it iconifies that | 898 | Otherwise, if the selected window is the only window on its frame, it |
| 898 | frame. If @var{buffer-or-name} is displayed in some other window, it | 899 | iconifies that frame. If @var{buffer-or-name} is displayed in some |
| 899 | remains displayed there. | 900 | other window, it remains displayed there. |
| 900 | 901 | ||
| 901 | To replace a buffer in all the windows that display it, use | 902 | To replace a buffer in all the windows that display it, use |
| 902 | @code{replace-buffer-in-windows}. @xref{Buffers and Windows}. | 903 | @code{replace-buffer-in-windows}. @xref{Buffers and Windows}. |
| 903 | @end deffn | 904 | @end deffn |
| 904 | 905 | ||
| 905 | @deffn Command unbury-buffer | 906 | @deffn Command unbury-buffer |
| 906 | This command switches to the last buffer in the local buffer list of the | 907 | This command switches to the last buffer in the local buffer list of |
| 907 | selected frame. More precisely, it calls the function | 908 | the selected frame. More precisely, it calls the function |
| 908 | @code{switch-to-buffer} (@pxref{Displaying Buffers}), to display the | 909 | @code{switch-to-buffer} (@pxref{Switching Buffers}), to display the |
| 909 | buffer returned by @code{last-buffer}, see above, in the selected | 910 | buffer returned by @code{last-buffer}, see above, in the selected |
| 910 | window. | 911 | window. |
| 911 | @end deffn | 912 | @end deffn |
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 3002a4c220d..724c46300fd 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi | |||
| @@ -118,15 +118,12 @@ redisplay of all windows. | |||
| 118 | to put more work on the queue to be done by redisplay whenever there | 118 | to put more work on the queue to be done by redisplay whenever there |
| 119 | is a chance. | 119 | is a chance. |
| 120 | 120 | ||
| 121 | Emacs redisplay normally stops if input arrives, and does not happen | ||
| 122 | at all if input is available before it starts. Most of the time, this | ||
| 123 | is exactly what you want. However, you can prevent preemption by | ||
| 124 | binding @code{redisplay-dont-pause} to a non-@code{nil} value. | ||
| 125 | |||
| 126 | @defvar redisplay-dont-pause | 121 | @defvar redisplay-dont-pause |
| 127 | If this variable is non-@code{nil}, pending input does not | 122 | If this variable is non-@code{nil}, pending input does not prevent or |
| 128 | prevent or halt redisplay; redisplay occurs, and finishes, | 123 | halt redisplay; redisplay occurs, and finishes, regardless of whether |
| 129 | regardless of whether input is available. | 124 | input is available. If it is @code{nil}, Emacs redisplay stops if |
| 125 | input arrives, and does not happen at all if input is available before | ||
| 126 | it starts. The default is @code{t}. | ||
| 130 | @end defvar | 127 | @end defvar |
| 131 | 128 | ||
| 132 | @defvar redisplay-preemption-period | 129 | @defvar redisplay-preemption-period |
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi index d3b96a0eb81..8350c9b7080 100644 --- a/doc/lispref/elisp.texi +++ b/doc/lispref/elisp.texi | |||
| @@ -21,7 +21,7 @@ | |||
| 21 | @end ifset | 21 | @end ifset |
| 22 | 22 | ||
| 23 | @c per rms and peterb, use 10pt fonts for the main text, mostly to | 23 | @c per rms and peterb, use 10pt fonts for the main text, mostly to |
| 24 | @c save on paper cost. | 24 | @c save on paper cost. |
| 25 | @c Do this inside @tex for now, so current makeinfo does not complain. | 25 | @c Do this inside @tex for now, so current makeinfo does not complain. |
| 26 | @tex | 26 | @tex |
| 27 | @ifset smallbook | 27 | @ifset smallbook |
| @@ -935,11 +935,15 @@ Windows | |||
| 935 | * Selecting Windows:: The selected window is the one that you edit in. | 935 | * Selecting Windows:: The selected window is the one that you edit in. |
| 936 | * Cyclic Window Ordering:: Moving around the existing windows. | 936 | * Cyclic Window Ordering:: Moving around the existing windows. |
| 937 | * Buffers and Windows:: Each window displays the contents of a buffer. | 937 | * Buffers and Windows:: Each window displays the contents of a buffer. |
| 938 | * Displaying Buffers:: Higher-level functions for displaying a buffer | 938 | * Switching Buffers:: Higher-level functions for switching to a buffer. |
| 939 | and choosing a window for it. | ||
| 940 | * Choosing Window:: How to choose a window for displaying a buffer. | 939 | * Choosing Window:: How to choose a window for displaying a buffer. |
| 940 | * Display Action Functions:: Subroutines for @code{display-buffer}. | ||
| 941 | * Choosing Window Options:: Extra options affecting how buffers are displayed. | ||
| 942 | * Window History:: Each window remembers the buffers displayed in it. | ||
| 941 | * Dedicated Windows:: How to avoid displaying another buffer in | 943 | * Dedicated Windows:: How to avoid displaying another buffer in |
| 942 | a specific window. | 944 | a specific window. |
| 945 | * Quitting Windows:: How to restore the state prior to displaying a | ||
| 946 | buffer. | ||
| 943 | * Window Point:: Each window has its own location of point. | 947 | * Window Point:: Each window has its own location of point. |
| 944 | * Window Start and End:: Buffer positions indicating which text is | 948 | * Window Start and End:: Buffer positions indicating which text is |
| 945 | on-screen in a window. | 949 | on-screen in a window. |
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi index bd904bf49c0..71b612c527d 100644 --- a/doc/lispref/files.texi +++ b/doc/lispref/files.texi | |||
| @@ -103,7 +103,7 @@ function is basically equivalent to: | |||
| 103 | @end smallexample | 103 | @end smallexample |
| 104 | 104 | ||
| 105 | @noindent | 105 | @noindent |
| 106 | (See @code{switch-to-buffer} in @ref{Displaying Buffers}.) | 106 | (See @code{switch-to-buffer} in @ref{Switching Buffers}.) |
| 107 | 107 | ||
| 108 | If @var{wildcards} is non-@code{nil}, which is always true in an | 108 | If @var{wildcards} is non-@code{nil}, which is always true in an |
| 109 | interactive call, then @code{find-file} expands wildcard characters in | 109 | interactive call, then @code{find-file} expands wildcard characters in |
| @@ -187,8 +187,9 @@ various files. | |||
| 187 | 187 | ||
| 188 | @deffn Command find-file-other-window filename &optional wildcards | 188 | @deffn Command find-file-other-window filename &optional wildcards |
| 189 | This command selects a buffer visiting the file @var{filename}, but | 189 | This command selects a buffer visiting the file @var{filename}, but |
| 190 | does so in a window other than the selected window. It may use another | 190 | does so in a window other than the selected window. It may use |
| 191 | existing window or split a window; see @ref{Displaying Buffers}. | 191 | another existing window or split a window; see @ref{Switching |
| 192 | Buffers}. | ||
| 192 | 193 | ||
| 193 | When this command is called interactively, it prompts for | 194 | When this command is called interactively, it prompts for |
| 194 | @var{filename}. | 195 | @var{filename}. |
diff --git a/doc/lispref/vol1.texi b/doc/lispref/vol1.texi index 1275628cc94..0fa23d6412c 100644 --- a/doc/lispref/vol1.texi +++ b/doc/lispref/vol1.texi | |||
| @@ -953,11 +953,13 @@ Windows | |||
| 953 | * Selecting Windows:: The selected window is the one that you edit in. | 953 | * Selecting Windows:: The selected window is the one that you edit in. |
| 954 | * Cyclic Window Ordering:: Moving around the existing windows. | 954 | * Cyclic Window Ordering:: Moving around the existing windows. |
| 955 | * Buffers and Windows:: Each window displays the contents of a buffer. | 955 | * Buffers and Windows:: Each window displays the contents of a buffer. |
| 956 | * Displaying Buffers:: Higher-level functions for displaying a buffer | 956 | * Switching Buffers:: Higher-level functions for switching to a buffer. |
| 957 | and choosing a window for it. | ||
| 958 | * Choosing Window:: How to choose a window for displaying a buffer. | 957 | * Choosing Window:: How to choose a window for displaying a buffer. |
| 958 | * Display Action Functions:: Subroutines for @code{display-buffer}. | ||
| 959 | * Choosing Window Options:: Extra options affecting how buffers are displayed. | ||
| 960 | * Window History:: Each window remembers the buffers displayed in it. | ||
| 959 | * Dedicated Windows:: How to avoid displaying another buffer in | 961 | * Dedicated Windows:: How to avoid displaying another buffer in |
| 960 | a specific window. | 962 | a specific window. |
| 961 | * Window Point:: Each window has its own location of point. | 963 | * Window Point:: Each window has its own location of point. |
| 962 | * Window Start and End:: Buffer positions indicating which text is | 964 | * Window Start and End:: Buffer positions indicating which text is |
| 963 | on-screen in a window. | 965 | on-screen in a window. |
diff --git a/doc/lispref/vol2.texi b/doc/lispref/vol2.texi index 3d849fa2dcf..2469a742900 100644 --- a/doc/lispref/vol2.texi +++ b/doc/lispref/vol2.texi | |||
| @@ -952,11 +952,13 @@ Windows | |||
| 952 | * Selecting Windows:: The selected window is the one that you edit in. | 952 | * Selecting Windows:: The selected window is the one that you edit in. |
| 953 | * Cyclic Window Ordering:: Moving around the existing windows. | 953 | * Cyclic Window Ordering:: Moving around the existing windows. |
| 954 | * Buffers and Windows:: Each window displays the contents of a buffer. | 954 | * Buffers and Windows:: Each window displays the contents of a buffer. |
| 955 | * Displaying Buffers:: Higher-level functions for displaying a buffer | 955 | * Switching Buffers:: Higher-level functions for switching to a buffer. |
| 956 | and choosing a window for it. | ||
| 957 | * Choosing Window:: How to choose a window for displaying a buffer. | 956 | * Choosing Window:: How to choose a window for displaying a buffer. |
| 957 | * Display Action Functions:: Subroutines for @code{display-buffer}. | ||
| 958 | * Choosing Window Options:: Extra options affecting how buffers are displayed. | ||
| 959 | * Window History:: Each window remembers the buffers displayed in it. | ||
| 958 | * Dedicated Windows:: How to avoid displaying another buffer in | 960 | * Dedicated Windows:: How to avoid displaying another buffer in |
| 959 | a specific window. | 961 | a specific window. |
| 960 | * Window Point:: Each window has its own location of point. | 962 | * Window Point:: Each window has its own location of point. |
| 961 | * Window Start and End:: Buffer positions indicating which text is | 963 | * Window Start and End:: Buffer positions indicating which text is |
| 962 | on-screen in a window. | 964 | on-screen in a window. |
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi index b80fe02b0ff..96d489d1203 100644 --- a/doc/lispref/windows.texi +++ b/doc/lispref/windows.texi | |||
| @@ -22,11 +22,15 @@ is displayed in windows. | |||
| 22 | * Selecting Windows:: The selected window is the one that you edit in. | 22 | * Selecting Windows:: The selected window is the one that you edit in. |
| 23 | * Cyclic Window Ordering:: Moving around the existing windows. | 23 | * Cyclic Window Ordering:: Moving around the existing windows. |
| 24 | * Buffers and Windows:: Each window displays the contents of a buffer. | 24 | * Buffers and Windows:: Each window displays the contents of a buffer. |
| 25 | * Displaying Buffers:: Higher-level functions for displaying a buffer | 25 | * Switching Buffers:: Higher-level functions for switching to a buffer. |
| 26 | and choosing a window for it. | ||
| 27 | * Choosing Window:: How to choose a window for displaying a buffer. | 26 | * Choosing Window:: How to choose a window for displaying a buffer. |
| 27 | * Display Action Functions:: Subroutines for @code{display-buffer}. | ||
| 28 | * Choosing Window Options:: Extra options affecting how buffers are displayed. | ||
| 29 | * Window History:: Each window remembers the buffers displayed in it. | ||
| 28 | * Dedicated Windows:: How to avoid displaying another buffer in | 30 | * Dedicated Windows:: How to avoid displaying another buffer in |
| 29 | a specific window. | 31 | a specific window. |
| 32 | * Quitting Windows:: How to restore the state prior to displaying a | ||
| 33 | buffer. | ||
| 30 | * Window Point:: Each window has its own location of point. | 34 | * Window Point:: Each window has its own location of point. |
| 31 | * Window Start and End:: Buffer positions indicating which text is | 35 | * Window Start and End:: Buffer positions indicating which text is |
| 32 | on-screen in a window. | 36 | on-screen in a window. |
| @@ -292,7 +296,7 @@ optional argument @var{window} can be an arbitrary window and defaults | |||
| 292 | to the selected one. The return value is @code{nil} if @var{window} is | 296 | to the selected one. The return value is @code{nil} if @var{window} is |
| 293 | a live window or its children form a vertical combination. In the | 297 | a live window or its children form a vertical combination. In the |
| 294 | example above @code{(window-left-child W4)} is @code{W6} while | 298 | example above @code{(window-left-child W4)} is @code{W6} while |
| 295 | @code{(window-top-child W3)} is @code{nil}. | 299 | @code{(window-left-child W3)} is @code{nil}. |
| 296 | @end defun | 300 | @end defun |
| 297 | 301 | ||
| 298 | @defun window-child window | 302 | @defun window-child window |
| @@ -1963,7 +1967,6 @@ set of windows to investigate. See the description of | |||
| 1963 | @code{next-window} for details. | 1967 | @code{next-window} for details. |
| 1964 | @end defun | 1968 | @end defun |
| 1965 | 1969 | ||
| 1966 | |||
| 1967 | @node Buffers and Windows | 1970 | @node Buffers and Windows |
| 1968 | @section Buffers and Windows | 1971 | @section Buffers and Windows |
| 1969 | @cindex examining windows | 1972 | @cindex examining windows |
| @@ -1982,10 +1985,11 @@ one. If @var{window} is an internal window, this function returns | |||
| 1982 | 1985 | ||
| 1983 | The basic, low-level function to associate a window with a buffer is | 1986 | The basic, low-level function to associate a window with a buffer is |
| 1984 | @code{set-window-buffer}. Higher-level functions like | 1987 | @code{set-window-buffer}. Higher-level functions like |
| 1985 | @code{display-buffer} try to obey a number of user customizations | 1988 | @code{switch-to-buffer} and @code{display-buffer} try to obey a number |
| 1986 | regulating which windows are supposed to display which buffers. When | 1989 | of user customizations regulating which windows are supposed to |
| 1987 | writing an application, programmers should therefore carefully evaluate | 1990 | display which buffers. @xref{Switching Buffers}. When writing an |
| 1988 | whether they really need the power of @code{set-window-buffer}. | 1991 | application, you should avoid using @code{set-window-buffer} unless |
| 1992 | you are sure you need it. | ||
| 1989 | 1993 | ||
| 1990 | @defun set-window-buffer window buffer-or-name &optional keep-margins | 1994 | @defun set-window-buffer window buffer-or-name &optional keep-margins |
| 1991 | This function makes @var{window} display @var{buffer-or-name} and | 1995 | This function makes @var{window} display @var{buffer-or-name} and |
| @@ -2067,310 +2071,258 @@ The two remaining arguments work like the same-named arguments of | |||
| 2067 | like the optional arguments of @code{get-buffer-window}. | 2071 | like the optional arguments of @code{get-buffer-window}. |
| 2068 | @end defun | 2072 | @end defun |
| 2069 | 2073 | ||
| 2070 | The following command removes a buffer from all windows showing it. | ||
| 2071 | |||
| 2072 | @deffn Command replace-buffer-in-windows &optional buffer-or-name | 2074 | @deffn Command replace-buffer-in-windows &optional buffer-or-name |
| 2073 | This function replaces @var{buffer-or-name} in all windows displaying it | 2075 | This command replaces @var{buffer-or-name} with some other buffer, in |
| 2074 | with some other buffer. It uses @code{switch-to-prev-buffer}, see | 2076 | all windows displaying it. For each such window, it choose another |
| 2075 | below, to choose that other buffer which is usually the last buffer | 2077 | buffer using @code{switch-to-prev-buffer} (@pxref{Window History}). |
| 2076 | displayed before @var{buffer-or-name} in the respective window. | ||
| 2077 | 2078 | ||
| 2078 | The argument @var{buffer-or-name} may be a buffer or the name of an | 2079 | @var{buffer-or-name} may be a buffer, or the name of an existing |
| 2079 | existing buffer and defaults to the current buffer. | 2080 | buffer; it defaults to the current buffer. |
| 2080 | 2081 | ||
| 2081 | If a window displaying @var{buffer-or-name} is dedicated | 2082 | If a window displaying @var{buffer-or-name} is dedicated |
| 2082 | (@pxref{Dedicated Windows}) has never displayed any other buffers and is | 2083 | (@pxref{Dedicated Windows}), has never displayed any other buffers and |
| 2083 | not the only window on its frame, that window is deleted. If that | 2084 | is not the only window on its frame, that window is deleted. If that |
| 2084 | window is the only window on its frame and there are other frames left, | 2085 | window is the only window on its frame and there are other frames on the |
| 2085 | the window's frame is deleted too. If there are no other frames left, | 2086 | frame's terminal, that frame is deleted too; otherwise, the buffer |
| 2086 | some other buffer is displayed in that window as explained above. You | 2087 | provided by the function @code{switch-to-prev-buffer} (@pxref{Window |
| 2087 | can prevent the deletion of windows and/or frames by customizing the | 2088 | History}) is displayed instead. |
| 2088 | option @var{window-auto-delete}. | ||
| 2089 | |||
| 2090 | This function returns @code{nil}. | ||
| 2091 | @end deffn | 2089 | @end deffn |
| 2092 | 2090 | ||
| 2093 | When @code{replace-buffer-in-windows} has to show another buffer in a | ||
| 2094 | window, it tries to pick the buffer shown there before. For this | ||
| 2095 | purpose each window remembers the buffers it has displayed earlier and | ||
| 2096 | the order in which these buffers have been removed from it. | ||
| 2097 | |||
| 2098 | The list of @dfn{previous buffers} of a window is an association list | ||
| 2099 | where each entry specifies a buffer, the last start position of that | ||
| 2100 | buffer in the window (@pxref{Window Start and End}) and the last | ||
| 2101 | position of that buffer's point in the window (@pxref{Window Point}). | ||
| 2102 | This list is ordered by the times of the removal of the respective | ||
| 2103 | buffers from the window. In particular, the first element of the list | ||
| 2104 | references the buffer removed most recently. The function | ||
| 2105 | @code{set-window-buffer} pushes an entry for the old buffer of its | ||
| 2106 | window argument on that list before it shows its buffer argument in the | ||
| 2107 | window. | ||
| 2108 | 2091 | ||
| 2109 | The list of @dfn{next buffers} of a window is a list of buffers that | 2092 | @node Switching Buffers |
| 2110 | have been recently re-shown by the function @code{switch-to-prev-buffer} | 2093 | @section Switching to a Buffer in a Window |
| 2111 | and is used to avoid that that function switches to such a buffer again | 2094 | @cindex switching to a buffer |
| 2112 | before showing other interesting buffers. | 2095 | @cindex displaying a buffer |
| 2113 | |||
| 2114 | The lists of previous and next buffers and the global buffer list | ||
| 2115 | (@pxref{The Buffer List}) allow to effectively display all buffers in a | ||
| 2116 | window while giving preference to the buffers previously shown in that | ||
| 2117 | window. The commands used for this purpose are | ||
| 2118 | @code{switch-to-prev-buffer} and @code{switch-to-next-buffer} described | ||
| 2119 | below. | ||
| 2120 | 2096 | ||
| 2121 | The following functions directly operate on the lists of previous and | 2097 | This section describes high-level functions for switching to a |
| 2122 | next buffers. | 2098 | specified buffer in some window. |
| 2099 | |||
| 2100 | Do @emph{not} use these functions to make a buffer temporarily | ||
| 2101 | current just so a Lisp program can access or modify it. They have | ||
| 2102 | side-effects, such as changing window histories (@pxref{Window | ||
| 2103 | History}), which will surprise the user if used that way. If you want | ||
| 2104 | to make a buffer current to modify it in Lisp, use | ||
| 2105 | @code{with-current-buffer}, @code{save-current-buffer}, or | ||
| 2106 | @code{set-buffer}. @xref{Current Buffer}. | ||
| 2107 | |||
| 2108 | @deffn Command switch-to-buffer buffer-or-name &optional norecord force-same-window | ||
| 2109 | This function displays @var{buffer-or-name} in the selected window, | ||
| 2110 | and makes it the current buffer. (In contrast, @code{set-buffer} | ||
| 2111 | makes the buffer current but does not display it; @pxref{Current | ||
| 2112 | Buffer}). It is often used interactively (as the binding of @kbd{C-x | ||
| 2113 | b}), as well as in Lisp programs. The return value is the buffer | ||
| 2114 | switched to. | ||
| 2115 | |||
| 2116 | If @var{buffer-or-name} is @code{nil}, it defaults to the buffer | ||
| 2117 | returned by @code{other-buffer} (@pxref{The Buffer List}). If | ||
| 2118 | @var{buffer-or-name} is a string that is not the name of any existing | ||
| 2119 | buffer, this function creates a new buffer with that name; the new | ||
| 2120 | buffer's major mode is determined by the variable @code{major-mode} | ||
| 2121 | (@pxref{Major Modes}). | ||
| 2122 | |||
| 2123 | Normally the specified buffer is put at the front of the buffer | ||
| 2124 | list---both the global buffer list and the selected frame's buffer | ||
| 2125 | list (@pxref{The Buffer List}). However, this is not done if the | ||
| 2126 | optional argument @var{norecord} is non-@code{nil}. | ||
| 2127 | |||
| 2128 | If this function is unable to display the buffer in the selected | ||
| 2129 | window---usually because the selected window is a minibuffer window or | ||
| 2130 | is strongly dedicated to its buffer (@pxref{Dedicated Windows})---then | ||
| 2131 | it normally tries to display the buffer in some other window, in the | ||
| 2132 | manner of @code{pop-to-buffer} (see below). However, if the optional | ||
| 2133 | argument @var{force-same-window} is non-@code{nil}, it signals an error | ||
| 2134 | instead. | ||
| 2135 | @end deffn | ||
| 2123 | 2136 | ||
| 2124 | @defun window-prev-buffers &optional window | 2137 | The next two functions are similar to @code{switch-to-buffer}, except |
| 2125 | This function returns an alist specifying the buffers previously shown | 2138 | for the described features. |
| 2126 | in @var{window} together with their window start and point positions. | ||
| 2127 | The argument @var{window} must be a live window and defaults to the | ||
| 2128 | selected one. | ||
| 2129 | @end defun | ||
| 2130 | 2139 | ||
| 2131 | @defun set-window-prev-buffers window prev-buffers | 2140 | @deffn Command switch-to-buffer-other-window buffer-or-name &optional norecord |
| 2132 | This function sets @var{window}'s previous buffers to the value of | 2141 | This function makes the buffer specified by @var{buffer-or-name} |
| 2133 | @var{prev-buffers}. The argument @var{window} must be a live window and | 2142 | current and displays it in some window other than the selected window. |
| 2134 | defaults to the selected one. This function returns | 2143 | It uses the function @code{pop-to-buffer} internally (see below). |
| 2135 | @var{prev-buffers}. | ||
| 2136 | 2144 | ||
| 2137 | If non-@code{nil}, @var{prev-buffers} must specify an alist of triples | 2145 | If the selected window already displays the specified buffer, it |
| 2138 | specifying a buffer and two markers for that buffer's start and point | 2146 | continues to do so, but another window is nonetheless found to display |
| 2139 | position in @var{window}. | 2147 | it as well. |
| 2140 | @end defun | ||
| 2141 | 2148 | ||
| 2142 | @defun window-next-buffers &optional window | 2149 | The @var{buffer-or-name} and @var{norecord} arguments have the same |
| 2143 | This function returns the list of buffers recently re-shown in | 2150 | meanings as in @code{switch-to-buffer}. |
| 2144 | @var{window}. The argument @var{window} must be a live window and | 2151 | @end deffn |
| 2145 | defaults to the selected one. | ||
| 2146 | @end defun | ||
| 2147 | 2152 | ||
| 2148 | @defun set-window-next-buffers window next-buffers | 2153 | @deffn Command switch-to-buffer-other-frame buffer-or-name &optional norecord |
| 2149 | This function sets @var{window}'s next buffers to @var{next-buffers}. | 2154 | This function makes the buffer specified by @var{buffer-or-name} |
| 2150 | @var{window} must be a live window and defaults to the selected one. | 2155 | current and displays it, usually in a new frame. It uses the function |
| 2151 | This fucntion returns @var{next-buffers}. | 2156 | @code{pop-to-buffer} (see below). |
| 2152 | 2157 | ||
| 2153 | If non-@code{nil}, the argument @var{next-buffers} should specify a list | 2158 | If the specified buffer is already displayed in another window, in any |
| 2154 | of buffers that shall be preferably not shown by the command | 2159 | frame on the current terminal, this switches to that window instead of |
| 2155 | @code{switch-to-prev-buffer}, see below. | 2160 | creating a new frame. However, the selected window is never used for |
| 2156 | @end defun | 2161 | this. |
| 2157 | 2162 | ||
| 2158 | The following command is used by @code{replace-buffer-in-windows}, | 2163 | The @var{buffer-or-name} and @var{norecord} arguments have the same |
| 2159 | @code{bury-buffer} and @code{quit-window} to show another buffer in a | 2164 | meanings as in @code{switch-to-buffer}. |
| 2160 | window. It can be also used interactively to cycle through the list of | 2165 | @end deffn |
| 2161 | all buffers in a window, preferably showing the buffers recently shown | ||
| 2162 | (but not buried or killed) in that window. | ||
| 2163 | 2166 | ||
| 2164 | @deffn Command switch-to-prev-buffer &optional window bury-or-kill | 2167 | The above commands use @code{pop-to-buffer}, which is the function |
| 2165 | This function displays the previous buffer in @var{window}. The | 2168 | used by Lisp programs to flexibly display a buffer in some window and |
| 2166 | argument @var{window} must be a live window and defaults to the selected | 2169 | select that window for editing: |
| 2167 | one. If the optional argument @var{bury-or-kill} is non-@code{nil}, | 2170 | |
| 2168 | this means that the buffer currently shown in @var{window} is about to | 2171 | @defun pop-to-buffer buffer-or-name &optional action norecord |
| 2169 | be buried or killed and consequently shall not be switched to in future | 2172 | This function makes @var{buffer-or-name} the current buffer and |
| 2170 | invocations of this command. | 2173 | displays it in some window, preferably not the window previously |
| 2174 | selected. It then selects the displaying window. If that window is | ||
| 2175 | on a different graphical frame, that frame is given input focus if | ||
| 2176 | possible (@pxref{Input Focus}). The return value is the buffer that | ||
| 2177 | was switched to. | ||
| 2178 | |||
| 2179 | This function uses @code{display-buffer} to display the buffer, so all | ||
| 2180 | the variables affecting @code{display-buffer} will affect it as well. | ||
| 2181 | @xref{Choosing Window}. | ||
| 2182 | |||
| 2183 | If @var{buffer-or-name} is @code{nil}, it defaults to the buffer | ||
| 2184 | returned by @code{other-buffer} (@pxref{The Buffer List}). If | ||
| 2185 | @var{buffer-or-name} is a string that is not the name of any existing | ||
| 2186 | buffer, this function creates a new buffer with that name; the new | ||
| 2187 | buffer's major mode is determined by the variable @code{major-mode} | ||
| 2188 | (@pxref{Major Modes}). | ||
| 2189 | |||
| 2190 | If @var{action} is non-@code{nil}, it should be a display action to | ||
| 2191 | pass to @code{display-buffer} (@pxref{Choosing Window}). | ||
| 2192 | Alternatively, a non-@code{nil}, non-list value means to pop to a | ||
| 2193 | window other than the selected one---even if the buffer is already | ||
| 2194 | displayed in the selected window. | ||
| 2195 | |||
| 2196 | Like @code{switch-to-buffer}, this function updates the buffer list | ||
| 2197 | unless @var{norecord} is non-@code{nil}. | ||
| 2198 | @end defun | ||
| 2171 | 2199 | ||
| 2172 | The previous buffer is usually the buffer shown before the buffer | 2200 | @node Choosing Window |
| 2173 | currently shown in @var{window}. However, a buffer that has been buried | 2201 | @section Choosing a Window for Display |
| 2174 | or killed or has been already shown by a recent invocation of | ||
| 2175 | @code{switch-to-prev-buffer} does not qualify as previous buffer. | ||
| 2176 | 2202 | ||
| 2177 | If repeated invocations of this command have already shown all buffers | 2203 | The command @code{display-buffer} flexibly chooses a window for |
| 2178 | previously shown in @var{window}, further invocations will show buffers | 2204 | display, and displays a specified buffer in that window. It can be |
| 2179 | from the global buffer list starting with the buffer returned by | 2205 | called interactively, via the key binding @kbd{C-x 4 o}. It is also |
| 2180 | @code{last-buffer} (@pxref{The Buffer List}). | 2206 | used as a subroutine by many functions and commands, including |
| 2181 | @end deffn | 2207 | @code{switch-to-buffer} and @code{pop-to-buffer} (@pxref{Switching |
| 2208 | Buffers}). | ||
| 2209 | |||
| 2210 | @cindex display action | ||
| 2211 | @cindex action function, for display-buffer | ||
| 2212 | @cindex action alist, for display-buffer | ||
| 2213 | This command performs several complex steps to find a window to | ||
| 2214 | display in. These steps are described by means of @dfn{display | ||
| 2215 | actions}, which have the form @code{(@var{function} . @var{alist})}. | ||
| 2216 | Here, @var{function} is either a function or a list of functions, | ||
| 2217 | which we refer to as @dfn{action functions}; @var{alist} is an | ||
| 2218 | association list, which we refer to as @dfn{action alists}. | ||
| 2219 | |||
| 2220 | An action function accepts two arguments: the buffer to display and | ||
| 2221 | an action alist. It attempts to display the buffer in some window, | ||
| 2222 | picking or creating a window according to its own criteria. If | ||
| 2223 | successful, it returns the window; otherwise, it returns @code{nil}. | ||
| 2224 | @xref{Display Action Functions}, for a list of predefined action | ||
| 2225 | functions. | ||
| 2182 | 2226 | ||
| 2183 | The following command can be used to undo the effect of the last undone | 2227 | @code{display-buffer} works by combining display actions from |
| 2184 | @code{switch-to-prev-buffer} command. | 2228 | several sources, and calling the action functions in turn, until one |
| 2229 | of them manages to display the buffer and returns a non-@code{nil} | ||
| 2230 | value. | ||
| 2185 | 2231 | ||
| 2186 | @deffn Command switch-to-next-buffer &optional window | 2232 | @deffn Command display-buffer buffer-or-name &optional action frame |
| 2187 | This functions switches to the next buffer in @var{window} thus undoing | 2233 | This command makes @var{buffer-or-name} appear in some window, without |
| 2188 | the effect of the last @code{switch-to-prev-buffer} command in | 2234 | selecting the window or making the buffer current. The argument |
| 2189 | @var{window}. The argument @var{window} must be a live window and | 2235 | @var{buffer-or-name} must be a buffer or the name of an existing |
| 2190 | defaults to the selected one. | 2236 | buffer. The return value is the window chosen to display the buffer. |
| 2191 | 2237 | ||
| 2192 | If there is no recent invocation of a @code{switch-to-prev-buffer} that | 2238 | The optional argument @var{action}, if non-@code{nil}, should normally |
| 2193 | can be undone, @code{switch-to-next-buffer} will try to show the first | 2239 | be a display action (described above). @code{display-buffer} builds a |
| 2194 | buffer from the global buffer list as returned by @code{other-buffer} | 2240 | list of action functions and an action alist, by consolidating display |
| 2195 | (@pxref{The Buffer List}). | 2241 | actions from the following sources (in order): |
| 2196 | @end deffn | ||
| 2197 | 2242 | ||
| 2198 | Together, @code{switch-to-prev-buffer} and | 2243 | @itemize |
| 2199 | @code{switch-to-next-buffer} permit to navigate the global buffer list | 2244 | @item |
| 2200 | much like @code{bury-buffer} and @code{unbury-buffer}. In contrast with | 2245 | The variable @code{display-buffer-overriding-action}. |
| 2201 | the latter, however, they may show a buffer even if it is already shown | ||
| 2202 | in another window. Moreover, they try to restore the window specific | ||
| 2203 | start and point positions of buffers which should handle viewing one and | ||
| 2204 | the same buffer in multiple windows more easily. | ||
| 2205 | 2246 | ||
| 2247 | @item | ||
| 2248 | The user option @code{display-buffer-alist}. | ||
| 2206 | 2249 | ||
| 2207 | @node Displaying Buffers | 2250 | @item |
| 2208 | @section Displaying Buffers in Windows | 2251 | The @var{action} argument. |
| 2209 | @cindex switching to a buffer | ||
| 2210 | @cindex displaying a buffer | ||
| 2211 | 2252 | ||
| 2212 | In this section we describe convenient functions that choose a window | 2253 | @item |
| 2213 | automatically and use it to display a specified buffer. These functions | 2254 | The user option @code{display-buffer-base-action}. |
| 2214 | can also split an existing window in certain circumstances. We also | ||
| 2215 | describe variables that parameterize the heuristics used for choosing a | ||
| 2216 | window. | ||
| 2217 | @iftex | ||
| 2218 | See the preceding section for | ||
| 2219 | @end iftex | ||
| 2220 | @ifnottex | ||
| 2221 | @xref{Buffers and Windows}, for | ||
| 2222 | @end ifnottex | ||
| 2223 | low-level primitives that give you more precise control. All of these | ||
| 2224 | functions work by calling @code{set-window-buffer}. | ||
| 2225 | |||
| 2226 | Do not use the functions in this section in order to make a buffer | ||
| 2227 | current so that a Lisp program can access or modify it; they are too | ||
| 2228 | drastic for that purpose, since they change the display of buffers in | ||
| 2229 | windows, which would be gratuitous and surprise the user. Instead, use | ||
| 2230 | @code{set-buffer} and @code{save-current-buffer} (@pxref{Current | ||
| 2231 | Buffer}), which designate buffers as current for programmed access | ||
| 2232 | without affecting the display of buffers in windows. | ||
| 2233 | |||
| 2234 | @deffn Command switch-to-buffer buffer-or-name &optional norecord | ||
| 2235 | This function makes @var{buffer-or-name} the current buffer, and also | ||
| 2236 | displays the buffer in the selected window. This means that a human can | ||
| 2237 | see the buffer and subsequent keyboard commands will apply to it. | ||
| 2238 | Contrast this with @code{set-buffer}, which makes @var{buffer-or-name} | ||
| 2239 | the current buffer but does not display it in the selected window; | ||
| 2240 | see @ref{Current Buffer}. | ||
| 2241 | |||
| 2242 | If @var{buffer-or-name} is @code{nil}, @code{switch-to-buffer} chooses a | ||
| 2243 | buffer using @code{other-buffer}. If @var{buffer-or-name} is a string | ||
| 2244 | that does not identify an existing buffer, then a new buffer by that | ||
| 2245 | name is created. The major mode for the new buffer is set according to | ||
| 2246 | the variable @code{major-mode}; see @ref{Auto Major Mode}. | ||
| 2247 | |||
| 2248 | When the selected window is the minibuffer window or is strongly | ||
| 2249 | dedicated to its buffer (@pxref{Dedicated Windows}), this function calls | ||
| 2250 | @code{pop-to-buffer} (see below) to display the buffer in some other | ||
| 2251 | window. | ||
| 2252 | 2255 | ||
| 2253 | Normally the specified buffer is put at the front of the buffer list | 2256 | @item |
| 2254 | (both the selected frame's buffer list and the frame-independent buffer | 2257 | The constant @code{display-buffer-fallback-action}. |
| 2255 | list). This affects the operation of @code{other-buffer}. However, if | 2258 | @end itemize |
| 2256 | @var{norecord} is non-@code{nil}, this is not done. @xref{The Buffer | ||
| 2257 | List}. | ||
| 2258 | 2259 | ||
| 2259 | The @code{switch-to-buffer} function is often used interactively, as | 2260 | @noindent |
| 2260 | the binding of @kbd{C-x b}. It is also used frequently in programs. It | 2261 | Each action function is called in turn, passing the buffer as the |
| 2261 | returns the buffer that it switched to. | 2262 | first argument and the combined action alist as the second argument, |
| 2263 | until one of the functions returns non-nil. | ||
| 2264 | |||
| 2265 | The argument @var{action} can also have a non-@code{nil}, non-list | ||
| 2266 | value. This has the special meaning that the buffer should be | ||
| 2267 | displayed in a window other than the selected one, even if the | ||
| 2268 | selected window is already displaying it. If called interactively | ||
| 2269 | with a prefix argument, @var{action} is @code{t}. | ||
| 2270 | |||
| 2271 | The optional argument @var{frame}, if non-@code{nil}, specifies which | ||
| 2272 | frames to check when deciding whether the buffer is already displayed. | ||
| 2273 | It is equivalent to adding an element @code{(reusable-frames | ||
| 2274 | . @var{frame})} to the action alist of @var{action}. @xref{Display | ||
| 2275 | Action Functions}. | ||
| 2262 | @end deffn | 2276 | @end deffn |
| 2263 | 2277 | ||
| 2264 | The next two functions are similar to @code{switch-to-buffer}, except | 2278 | @defvar display-buffer-overriding-action |
| 2265 | for the described features. | 2279 | The value of this variable should be a display action, which is |
| 2266 | 2280 | treated with the highest priority by @code{display-buffer}. The | |
| 2267 | @deffn Command switch-to-buffer-other-window buffer-or-name &optional norecord | 2281 | default value is empty, i.e. @code{(nil . nil)}. |
| 2268 | This function makes the buffer specified by @var{buffer-or-name} current | 2282 | @end defvar |
| 2269 | and displays it in a window not currently selected, using the function | ||
| 2270 | @code{pop-to-buffer} (see below). | ||
| 2271 | 2283 | ||
| 2272 | The currently selected window is absolutely never used to do the job. | 2284 | @defopt display-buffer-alist |
| 2273 | If the selected window already displays @var{buffer-or-name}, then it | 2285 | The value of this option is an alist mapping regular expressions to |
| 2274 | continues to do so, but another window is nonetheless found to display | 2286 | display actions. If the name of the buffer passed to |
| 2275 | it in as well. | 2287 | @code{display-buffer} matches a regular expression in this alist, then |
| 2288 | @code{display-buffer} uses the corresponding display action. | ||
| 2289 | @end defopt | ||
| 2276 | 2290 | ||
| 2277 | This function updates the buffer list just like @code{switch-to-buffer} | 2291 | @defopt display-buffer-base-action |
| 2278 | unless @var{norecord} is non-@code{nil}. | 2292 | The value of this option should be a display action. This option can |
| 2279 | @end deffn | 2293 | be used to define a ``standard'' display action for calls to |
| 2294 | @code{display-buffer}. | ||
| 2295 | @end defopt | ||
| 2280 | 2296 | ||
| 2281 | @defun pop-to-buffer buffer-or-name &optional other-window norecord | 2297 | @defvr Constant display-buffer-fallback-action |
| 2282 | This function makes @var{buffer-or-name} the current buffer and switches | 2298 | This display action specifies the fallback behavior for |
| 2283 | to it in some window, preferably not the window previously selected. | 2299 | @code{display-buffer} if no other display actions are given. |
| 2284 | The ``popped-to'' window becomes the selected window. Its frame is | 2300 | @end defvr |
| 2285 | given the X server's focus, if possible; see @ref{Input Focus}. The | ||
| 2286 | return value is the buffer that was switched to. | ||
| 2287 | |||
| 2288 | If @var{buffer-or-name} is @code{nil}, that means to choose some other | ||
| 2289 | buffer, but you don't specify which. If @var{buffer-or-name} is a | ||
| 2290 | string that does not name an existing buffer, a buffer by that name is | ||
| 2291 | created. The major mode for the new buffer is set according to the | ||
| 2292 | variable @code{major-mode}. @xref{Auto Major Mode}. | ||
| 2293 | |||
| 2294 | If either of the variables @code{display-buffer-reuse-frames} or | ||
| 2295 | @code{pop-up-frames} is non-@code{nil}, @code{pop-to-buffer} looks for a | ||
| 2296 | window in any visible frame already displaying the buffer; if there is | ||
| 2297 | one, it selects and returns that window. If no such window exists and | ||
| 2298 | @code{pop-up-frames} is non-@code{nil}, it creates a new frame and | ||
| 2299 | displays the buffer in it. Otherwise, @code{pop-to-buffer} operates | ||
| 2300 | entirely within the selected frame. (If the selected frame has just a | ||
| 2301 | minibuffer, @code{pop-to-buffer} operates within the most recently | ||
| 2302 | selected frame that was not just a minibuffer.) | ||
| 2303 | |||
| 2304 | If the variable @code{pop-up-windows} is non-@code{nil}, windows may be | ||
| 2305 | split to create a new window that is different from the original window. | ||
| 2306 | For details, see @ref{Choosing Window}. | ||
| 2307 | |||
| 2308 | If @var{other-window} is non-@code{nil}, @code{pop-to-buffer} finds or | ||
| 2309 | creates another window even if @var{buffer-or-name} is already visible | ||
| 2310 | in the selected window. Thus @var{buffer-or-name} could end up | ||
| 2311 | displayed in two windows. On the other hand, if @var{buffer-or-name} is | ||
| 2312 | already displayed in the selected window and @var{other-window} is | ||
| 2313 | @code{nil}, then the selected window is considered sufficient for | ||
| 2314 | displaying @var{buffer-or-name}, so that nothing needs to be done. | ||
| 2315 | |||
| 2316 | All the variables that affect @code{display-buffer} affect | ||
| 2317 | @code{pop-to-buffer} as well. @xref{Choosing Window}. | ||
| 2318 | |||
| 2319 | This function updates the buffer list just like @code{switch-to-buffer} | ||
| 2320 | unless @var{norecord} is non-@code{nil}. | ||
| 2321 | @end defun | ||
| 2322 | 2301 | ||
| 2323 | @deffn Command replace-buffer-in-windows &optional buffer-or-name | 2302 | @node Display Action Functions |
| 2324 | This function replaces @var{buffer-or-name} in all windows displaying | 2303 | @section Action Functions for @code{display-buffer} |
| 2325 | it with some other buffer. It uses @code{other-buffer} to choose the | ||
| 2326 | other buffer. In the usual applications of this function, you | ||
| 2327 | don't care which other buffer is used; you just want to make sure that | ||
| 2328 | @var{buffer-or-name} is no longer displayed. | ||
| 2329 | 2304 | ||
| 2330 | The argument @var{buffer-or-name} may be a buffer or the name of an | 2305 | The following basic action functions are defined in Emacs. Each of |
| 2331 | existing buffer and defaults to the current buffer. | 2306 | these functions takes two arguments: @var{buffer}, the buffer to |
| 2307 | display, and @var{alist}, an action alist. Each action function | ||
| 2308 | returns the window if it succeeds, and @code{nil} if it fails. | ||
| 2332 | 2309 | ||
| 2333 | If a window displaying @var{buffer-or-name} is dedicated | 2310 | @defun display-buffer-same-window buffer alist |
| 2334 | (@pxref{Dedicated Windows}), and is not the only window on its frame, | 2311 | This function tries to display @var{buffer} in the selected window. |
| 2335 | that window is deleted. If that window is the only window on its frame | 2312 | It fails if the selected window is a minibuffer window or is dedicated |
| 2336 | and there are other frames left, the window's frame is deleted too. If | 2313 | to another buffer (@pxref{Dedicated Windows}). It also fails if |
| 2337 | there are no other frames left, some other buffer is displayed in that | 2314 | @var{alist} has a non-nil @code{inhibit-same-window} entry. |
| 2338 | window. | 2315 | @end defun |
| 2339 | 2316 | ||
| 2340 | This function returns @code{nil}. | 2317 | @defun display-buffer-reuse-window buffer alist |
| 2341 | @end deffn | 2318 | This function tries to ``display'' @var{buffer} by finding a window |
| 2319 | that is already displaying it. | ||
| 2342 | 2320 | ||
| 2343 | @node Choosing Window | 2321 | If @var{alist} has a non-@code{nil} @code{inhibit-same-window} entry, |
| 2344 | @section Choosing a Window for Display | 2322 | the selected window is not eligible for reuse. |
| 2345 | 2323 | ||
| 2346 | This section describes the basic facility that chooses a window to | 2324 | If @var{alist} contains a @code{reusable-frames} entry, its value |
| 2347 | display a buffer in---@code{display-buffer}. Higher-level functions and | 2325 | determines which frames to search for a reusable window: |
| 2348 | commands, like @code{switch-to-buffer} and @code{pop-to-buffer}, use this | ||
| 2349 | subroutine. Here we describe how to use @code{display-buffer} and how | ||
| 2350 | to customize it. | ||
| 2351 | |||
| 2352 | @deffn Command display-buffer buffer-or-name &optional not-this-window frame | ||
| 2353 | This command makes @var{buffer-or-name} appear in some window, but it | ||
| 2354 | does not select that window and does not make the buffer specified by | ||
| 2355 | @var{buffer-or-name} current. The identity of the selected window is | ||
| 2356 | unaltered by this function. The argument @var{buffer-or-name} must be a | ||
| 2357 | buffer or the name of an existing buffer. | ||
| 2358 | |||
| 2359 | @var{not-this-window} non-@code{nil} means to display the specified | ||
| 2360 | buffer in a window other than the selected one, even if it is already | ||
| 2361 | displayed in the selected window. This can cause the buffer to appear | ||
| 2362 | in two windows at once. Otherwise, if @var{buffer-or-name} is already | ||
| 2363 | being displayed in any window, that is good enough, so this function | ||
| 2364 | does nothing. | ||
| 2365 | |||
| 2366 | @code{display-buffer} returns the window chosen to display | ||
| 2367 | @var{buffer-or-name}. | ||
| 2368 | |||
| 2369 | If the optional argument @var{frame} is non-@code{nil}, it specifies | ||
| 2370 | which frames to check when deciding whether the buffer is already | ||
| 2371 | displayed. If the buffer is already displayed in some window on one of | ||
| 2372 | these frames, @code{display-buffer} simply returns that window. Here | ||
| 2373 | are the possible values of @var{frame}: | ||
| 2374 | 2326 | ||
| 2375 | @itemize @bullet | 2327 | @itemize @bullet |
| 2376 | @item | 2328 | @item |
| @@ -2386,9 +2338,36 @@ are the possible values of @var{frame}: | |||
| 2386 | A frame means consider windows on that frame only. | 2338 | A frame means consider windows on that frame only. |
| 2387 | @end itemize | 2339 | @end itemize |
| 2388 | 2340 | ||
| 2389 | Precisely how @code{display-buffer} finds or creates a window depends on | 2341 | If @var{alist} contains no @code{reusable-frames} entry, this function |
| 2390 | the variables described below. | 2342 | normally searches just the selected frame; however, if either the |
| 2391 | @end deffn | 2343 | variable @code{display-buffer-reuse-frames} or the variable |
| 2344 | @code{pop-up-frames} is non-@code{nil}, it searches all frames on the | ||
| 2345 | current terminal. @xref{Choosing Window Options}. | ||
| 2346 | @end defun | ||
| 2347 | |||
| 2348 | @defun display-buffer-pop-up-frame buffer alist | ||
| 2349 | This function creates a new frame, and displays the buffer in that | ||
| 2350 | frame's window. | ||
| 2351 | @end defun | ||
| 2352 | |||
| 2353 | @defun display-buffer-pop-up-window buffer alist | ||
| 2354 | This function tries to display @var{buffer} by splitting the selected | ||
| 2355 | window. It uses @code{split-window-sensibly} as a subroutine | ||
| 2356 | (@pxref{Choosing Window Options}). | ||
| 2357 | @end defun | ||
| 2358 | |||
| 2359 | @defun display-buffer-use-some-window buffer alist | ||
| 2360 | This function tries to display @var{buffer} by choosing an existing | ||
| 2361 | window and displaying the buffer in that window. It can fail if all | ||
| 2362 | windows are dedicated to another buffer (@pxref{Dedicated Windows}). | ||
| 2363 | @end defun | ||
| 2364 | |||
| 2365 | @node Choosing Window Options | ||
| 2366 | @section Additional Options for Displaying Buffers | ||
| 2367 | |||
| 2368 | The behavior of the standard display actions of @code{display-buffer} | ||
| 2369 | (@pxref{Choosing Window}) can be modified by a variety of user | ||
| 2370 | options. | ||
| 2392 | 2371 | ||
| 2393 | @defopt display-buffer-reuse-frames | 2372 | @defopt display-buffer-reuse-frames |
| 2394 | If this variable is non-@code{nil}, @code{display-buffer} searches | 2373 | If this variable is non-@code{nil}, @code{display-buffer} searches |
| @@ -2652,6 +2631,101 @@ If all options described above fail to produce a suitable window, | |||
| 2652 | resort, it will try to display @var{buffer-or-name} on a separate frame. | 2631 | resort, it will try to display @var{buffer-or-name} on a separate frame. |
| 2653 | In that case, the value of @code{pop-up-frames} is disregarded. | 2632 | In that case, the value of @code{pop-up-frames} is disregarded. |
| 2654 | 2633 | ||
| 2634 | |||
| 2635 | @node Window History | ||
| 2636 | @section Window History | ||
| 2637 | @cindex window history | ||
| 2638 | |||
| 2639 | Each window remembers the buffers it has displayed earlier and the order | ||
| 2640 | in which these buffers have been removed from it. This history is used, | ||
| 2641 | for example, by @code{replace-buffer-in-windows} (@pxref{Buffers and | ||
| 2642 | Windows}). This list is automatically maintained by Emacs, but you can | ||
| 2643 | use the following functions to explicitly inspect or alter it: | ||
| 2644 | |||
| 2645 | @defun window-prev-buffers &optional window | ||
| 2646 | This function returns a list specifying the previous contents of | ||
| 2647 | @var{window}, which should be a live window and defaults to the | ||
| 2648 | selected window. | ||
| 2649 | |||
| 2650 | Each list element has the form @code{(@var{buffer} @var{window-start} | ||
| 2651 | @var{window-pos})}, where @var{buffer} is a buffer previously shown in | ||
| 2652 | the window, @var{window-start} is the window start position when that | ||
| 2653 | buffer was last shown, and @var{window-pos} is the point position when | ||
| 2654 | that buffer was last shown. | ||
| 2655 | |||
| 2656 | The list is ordered so that earlier elements correspond to more | ||
| 2657 | recently-shown buffers, and the first element usually corresponds to the | ||
| 2658 | buffer most recently removed from the window. | ||
| 2659 | @end defun | ||
| 2660 | |||
| 2661 | @defun set-window-prev-buffers window prev-buffers | ||
| 2662 | This function sets @var{window}'s previous buffers to the value of | ||
| 2663 | @var{prev-buffers}. The argument @var{window} must be a live window | ||
| 2664 | and defaults to the selected one. The argument @var{prev-buffers} | ||
| 2665 | should be a list of the same form as that returned by | ||
| 2666 | @code{window-prev-buffers}. | ||
| 2667 | @end defun | ||
| 2668 | |||
| 2669 | In addition, each buffer maintains a list of @dfn{next buffers}, which | ||
| 2670 | is a list of buffers re-shown by @code{switch-to-prev-buffer} (see | ||
| 2671 | below). This list is mainly used by @code{switch-to-prev-buffer} and | ||
| 2672 | @code{switch-to-next-buffer} for choosing buffers to switch to. | ||
| 2673 | |||
| 2674 | @defun window-next-buffers &optional window | ||
| 2675 | This function returns the list of buffers recently re-shown in | ||
| 2676 | @var{window} via @code{switch-to-prev-buffer}. The @var{window} | ||
| 2677 | argument must denote a live window or @code{nil} (meaning the selected | ||
| 2678 | window). | ||
| 2679 | @end defun | ||
| 2680 | |||
| 2681 | @defun set-window-next-buffers window next-buffers | ||
| 2682 | This function sets the next buffer list of @var{window} to | ||
| 2683 | @var{next-buffers}. The @var{window} argument should be a live window | ||
| 2684 | or @code{nil} (meaning the selected window). The argument | ||
| 2685 | @var{next-buffers} should be a list of buffers. | ||
| 2686 | @end defun | ||
| 2687 | |||
| 2688 | The following commands can be used to cycle through the global buffer | ||
| 2689 | list, much like @code{bury-buffer} and @code{unbury-buffer}. However, | ||
| 2690 | they cycle according to the specified window's history list, rather | ||
| 2691 | than the global buffer list. In addition, they restore | ||
| 2692 | window-specific window start and point positions, and may show a | ||
| 2693 | buffer even if it is already shown in another window. The | ||
| 2694 | @code{switch-to-prev-buffer} command, in particular, is used by | ||
| 2695 | @code{replace-buffer-in-windows}, @code{bury-buffer} and | ||
| 2696 | @code{quit-window} to find a replacement buffer for a window. | ||
| 2697 | |||
| 2698 | @deffn Command switch-to-prev-buffer &optional window bury-or-kill | ||
| 2699 | This command displays the previous buffer in @var{window}. The | ||
| 2700 | argument @var{window} should be a live window or @code{nil} (meaning | ||
| 2701 | the selected window). If the optional argument @var{bury-or-kill} is | ||
| 2702 | non-@code{nil}, this means that the buffer currently shown in | ||
| 2703 | @var{window} is about to be buried or killed and consequently shall | ||
| 2704 | not be switched to in future invocations of this command. | ||
| 2705 | |||
| 2706 | The previous buffer is usually the buffer shown before the buffer | ||
| 2707 | currently shown in @var{window}. However, a buffer that has been buried | ||
| 2708 | or killed or has been already shown by a recent invocation of | ||
| 2709 | @code{switch-to-prev-buffer} does not qualify as previous buffer. | ||
| 2710 | |||
| 2711 | If repeated invocations of this command have already shown all buffers | ||
| 2712 | previously shown in @var{window}, further invocations will show buffers | ||
| 2713 | from the buffer list of the frame @var{window} appears on (@pxref{The | ||
| 2714 | Buffer List}). | ||
| 2715 | @end deffn | ||
| 2716 | |||
| 2717 | @deffn Command switch-to-next-buffer &optional window | ||
| 2718 | This command switches to the next buffer in @var{window} thus undoing | ||
| 2719 | the effect of the last @code{switch-to-prev-buffer} command in | ||
| 2720 | @var{window}. The argument @var{window} must be a live window and | ||
| 2721 | defaults to the selected one. | ||
| 2722 | |||
| 2723 | If there is no recent invocation of a @code{switch-to-prev-buffer} that | ||
| 2724 | can be undone, this function tries to show a buffer from the buffer list | ||
| 2725 | of the frame @var{window} appears on (@pxref{The Buffer List}). | ||
| 2726 | @end deffn | ||
| 2727 | |||
| 2728 | |||
| 2655 | @node Dedicated Windows | 2729 | @node Dedicated Windows |
| 2656 | @section Dedicated Windows | 2730 | @section Dedicated Windows |
| 2657 | @cindex dedicated window | 2731 | @cindex dedicated window |
| @@ -2666,15 +2740,15 @@ non-@code{nil}. The behavior of @code{set-window-buffer} | |||
| 2666 | (@pxref{Buffers and Windows}) with respect to dedicated windows is | 2740 | (@pxref{Buffers and Windows}) with respect to dedicated windows is |
| 2667 | slightly different, see below. | 2741 | slightly different, see below. |
| 2668 | 2742 | ||
| 2669 | When @code{delete-windows-on} (@pxref{Deleting Windows}) wants to delete | 2743 | When @code{delete-windows-on} (@pxref{Deleting Windows}) wants to |
| 2670 | a dedicated window and that window is the only window on its frame, it | 2744 | delete a dedicated window and that window is the only window on its |
| 2671 | deletes the window's frame too, provided there are other frames left. | 2745 | frame, it deletes the window's frame too, provided there are other |
| 2672 | @code{replace-buffer-in-windows} (@pxref{Displaying Buffers}) tries to | 2746 | frames left. @code{replace-buffer-in-windows} (@pxref{Switching |
| 2673 | delete all dedicated windows showing its buffer argument. When such a | 2747 | Buffers}) tries to delete all dedicated windows showing its buffer |
| 2674 | window is the only window on its frame, that frame is deleted, provided | 2748 | argument. When such a window is the only window on its frame, that |
| 2675 | there are other frames left. If there are no more frames left, some | 2749 | frame is deleted, provided there are other frames left. If there are |
| 2676 | other buffer is displayed in the window, and the window is marked as | 2750 | no more frames left, some other buffer is displayed in the window, and |
| 2677 | non-dedicated. | 2751 | the window is marked as non-dedicated. |
| 2678 | 2752 | ||
| 2679 | When you kill a buffer (@pxref{Killing Buffers}) displayed in a | 2753 | When you kill a buffer (@pxref{Killing Buffers}) displayed in a |
| 2680 | dedicated window, any such window usually gets deleted too, since | 2754 | dedicated window, any such window usually gets deleted too, since |
| @@ -2705,6 +2779,59 @@ display. Other functions do not treat @code{t} differently from any | |||
| 2705 | non-@code{nil} value. | 2779 | non-@code{nil} value. |
| 2706 | @end defun | 2780 | @end defun |
| 2707 | 2781 | ||
| 2782 | |||
| 2783 | @node Quitting Windows | ||
| 2784 | @section Quitting Windows | ||
| 2785 | |||
| 2786 | When you want to get rid of a window used for displaying a buffer you | ||
| 2787 | can use the function @code{delete-window} (@pxref{Deleting Windows}) to | ||
| 2788 | remove that window from its frame. If the buffer has been shown on a | ||
| 2789 | separate frame, you might want to call @code{delete-frame} | ||
| 2790 | (@pxref{Deleting Frames}) instead. If, on the other hand, a window has | ||
| 2791 | been reused for displaying the buffer, you might prefer showing the | ||
| 2792 | buffer previously shown in that window by calling the function | ||
| 2793 | @code{switch-to-prev-buffer} (@pxref{Window History}). Finally, you | ||
| 2794 | might want to either bury (@pxref{The Buffer List}) or kill | ||
| 2795 | (@pxref{Killing Buffers}) the window's buffer. | ||
| 2796 | |||
| 2797 | The following function uses information on how the window for | ||
| 2798 | displaying the buffer was obtained in the first place thus attempting to | ||
| 2799 | automatize the above decisions for you. | ||
| 2800 | |||
| 2801 | @deffn Command quit-window &optional kill window | ||
| 2802 | This command quits @var{window} and buries its buffer. The argument | ||
| 2803 | @var{window} must be a live window and defaults to the selected one. | ||
| 2804 | With prefix argument @var{kill} non-@code{nil}, it kills the buffer | ||
| 2805 | instead of burying it. | ||
| 2806 | |||
| 2807 | Quitting @var{window} means to proceed as follows: If @var{window} was | ||
| 2808 | created specially for displaying its current buffer, delete @var{window} | ||
| 2809 | provided its frame contains at least one other live window. If | ||
| 2810 | @var{window} is the only window on its frame and other frames still | ||
| 2811 | exist, delete the frame together with @var{window}. If, however, there | ||
| 2812 | are no other frames left, display some other buffer in @var{window}. | ||
| 2813 | |||
| 2814 | If @var{window} was reused for displaying its buffer, this command tries | ||
| 2815 | to display the buffer previously shown in it. It also tries to restore | ||
| 2816 | the window start (@pxref{Window Start and End}) and point (@pxref{Window | ||
| 2817 | Point}) positions of the previously shown buffer. If, in addition, the | ||
| 2818 | current buffer was temporarily resized, this command will also try to | ||
| 2819 | restore the original height of @var{window}. | ||
| 2820 | |||
| 2821 | The three cases described so far require that the buffer shown in | ||
| 2822 | @var{window} is still the buffer displayed by the last buffer display | ||
| 2823 | function for this window. If another buffer has been shown in the | ||
| 2824 | meantime or the buffer previously shown no longer exists, this command | ||
| 2825 | calls @code{switch-to-prev-buffer} (@pxref{Window History}) to show some | ||
| 2826 | other buffer instead. | ||
| 2827 | @end deffn | ||
| 2828 | |||
| 2829 | The function @code{quit-window} bases its decisions on information | ||
| 2830 | stored in @var{window}'s @code{quit-restore} window parameter | ||
| 2831 | (@pxref{Window Parameters}) and resets that parameter to @code{nil} | ||
| 2832 | after it's done. | ||
| 2833 | |||
| 2834 | |||
| 2708 | @node Window Point | 2835 | @node Window Point |
| 2709 | @section Windows and Point | 2836 | @section Windows and Point |
| 2710 | @cindex window position | 2837 | @cindex window position |
| @@ -3451,14 +3578,13 @@ argument because it always uses the frame that @var{window} is on. | |||
| 3451 | @cindex window configurations | 3578 | @cindex window configurations |
| 3452 | @cindex saving window information | 3579 | @cindex saving window information |
| 3453 | 3580 | ||
| 3454 | A @dfn{window configuration} records the entire layout of one | 3581 | A @dfn{window configuration} records the entire layout of one |
| 3455 | frame---all windows, their sizes, which buffers they contain, how those | 3582 | frame---all windows, their sizes, which buffers they contain, how those |
| 3456 | buffers are scrolled, and their values of point and the mark; also their | 3583 | buffers are scrolled, and their values of point and the mark; also their |
| 3457 | fringes, margins, and scroll bar settings. It also includes the value | 3584 | fringes, margins, and scroll bar settings. It also includes the value |
| 3458 | of @code{minibuffer-scroll-window}. As a special exception, the window | 3585 | of @code{minibuffer-scroll-window}. As a special exception, the window |
| 3459 | configuration does not record the value of point in the selected window | 3586 | configuration does not record the value of point in the selected window |
| 3460 | for the current buffer. Also, the window configuration does not record | 3587 | for the current buffer. |
| 3461 | the values of window parameters; see @ref{Window Parameters}. | ||
| 3462 | 3588 | ||
| 3463 | You can bring back an entire frame layout by restoring a previously | 3589 | You can bring back an entire frame layout by restoring a previously |
| 3464 | saved window configuration. If you want to record the layout of all | 3590 | saved window configuration. If you want to record the layout of all |
| @@ -3568,24 +3694,62 @@ sense, but are not implemented because we did not need them. See the | |||
| 3568 | file @file{winner.el} for some more operations on windows | 3694 | file @file{winner.el} for some more operations on windows |
| 3569 | configurations. | 3695 | configurations. |
| 3570 | 3696 | ||
| 3697 | The objects returned by @code{current-window-configuration} die | ||
| 3698 | together with the Emacs process. In order to store a window | ||
| 3699 | configuration on disk and read it back in another Emacs session the | ||
| 3700 | following two functions can be used. | ||
| 3701 | |||
| 3702 | @defun window-state-get &optional window markers | ||
| 3703 | This function returns the state of @var{window} as a Lisp object. The | ||
| 3704 | argument @var{window} can be any window and defaults to the root window | ||
| 3705 | of the selected frame. | ||
| 3706 | |||
| 3707 | The optional argument @var{markers} non-@code{nil} means to use markers | ||
| 3708 | for sampling positions like @code{window-point} or @code{window-start}. | ||
| 3709 | This argument should be non-@code{nil} only if the value is used for | ||
| 3710 | putting the state back in the same session since markers slow down | ||
| 3711 | processing. | ||
| 3712 | @end defun | ||
| 3713 | |||
| 3714 | The value returned by @code{window-state-get} can be converted by using | ||
| 3715 | one of the functions defined by Desktop Save Mode (@pxref{Desktop Save | ||
| 3716 | Mode}) to an object that can be written to a file. Such objects can be | ||
| 3717 | read back and converted to a Lisp object representing the state of the | ||
| 3718 | window. That Lisp object can be used as argument for the following | ||
| 3719 | function in order to restore the state window in another window. | ||
| 3720 | |||
| 3721 | @defun window-state-put state &optional window ignore | ||
| 3722 | This function puts the window state @var{state} into @var{window}. The | ||
| 3723 | argument @var{state} should be the state of a window returned by an | ||
| 3724 | earlier invocation of @code{window-state-get}, see above. The optional | ||
| 3725 | argument @var{window} must specify a live window and defaults to the | ||
| 3726 | selected one. | ||
| 3727 | |||
| 3728 | The optional argument @var{ignore} non-@code{nil} means to ignore | ||
| 3729 | minimum window sizes and fixed size restrictions. If @var{ignore} | ||
| 3730 | equals @code{safe}, this means subwindows can get as small as one line | ||
| 3731 | and/or two columns. | ||
| 3732 | @end defun | ||
| 3733 | |||
| 3734 | |||
| 3571 | @node Window Parameters | 3735 | @node Window Parameters |
| 3572 | @section Window Parameters | 3736 | @section Window Parameters |
| 3573 | @cindex window parameters | 3737 | @cindex window parameters |
| 3574 | 3738 | ||
| 3575 | This sections describes how window parameters can be used to associate | 3739 | This section describes how window parameters can be used to associate |
| 3576 | additional information with windows. | 3740 | additional information with windows. |
| 3577 | 3741 | ||
| 3578 | @defun window-parameter window parameter | 3742 | @defun window-parameter window parameter |
| 3579 | This function returns @var{window}'s value for @var{parameter}. The | 3743 | This function returns @var{window}'s value for @var{parameter}. The |
| 3580 | default for @var{window} is the selected window. If @var{window} | 3744 | default for @var{window} is the selected window. If @var{window} has no |
| 3581 | has no setting for @var{parameter}, this function returns @code{nil}. | 3745 | setting for @var{parameter}, this function returns @code{nil}. |
| 3582 | @end defun | 3746 | @end defun |
| 3583 | 3747 | ||
| 3584 | @defun window-parameters &optional window | 3748 | @defun window-parameters &optional window |
| 3585 | This function returns all parameters of @var{window} and their values. | 3749 | This function returns all parameters of @var{window} and their values. |
| 3586 | The default for @var{window} is the selected window. The return value | 3750 | The default for @var{window} is the selected window. The return value, |
| 3587 | is an association list of elements of the form @code{(@var{parameter} | 3751 | if non-@code{nil} is an association list whose elements have the form |
| 3588 | . @var{value})}. | 3752 | @code{(@var{parameter} . @var{value})}. |
| 3589 | @end defun | 3753 | @end defun |
| 3590 | 3754 | ||
| 3591 | @defun set-window-parameter window parameter value | 3755 | @defun set-window-parameter window parameter value |
| @@ -3594,13 +3758,56 @@ This function sets @var{window}'s value of @var{parameter} to | |||
| 3594 | is the selected window. | 3758 | is the selected window. |
| 3595 | @end defun | 3759 | @end defun |
| 3596 | 3760 | ||
| 3597 | Currently, window parameters are not saved in window configurations and | 3761 | Some functions, notably @code{delete-window}, |
| 3598 | consequently not restored by @code{set-window-configuration}. Hence, | 3762 | @code{delete-other-windows} and @code{split-window} may behave specially |
| 3599 | any change of a parameter introduced via @code{set-window-parameter} can | 3763 | when their @var{window} argument has a parameter set. You can override |
| 3600 | be undone only by invoking @code{set-window-parameter} for the same | 3764 | such special behavior by binding the following variable to a |
| 3601 | parameter again. Since @code{save-window-excursion} relies on window | 3765 | non-@code{nil} value: |
| 3602 | configurations (@pxref{Window Configurations}), window parameters are | 3766 | |
| 3603 | not saved and restored by that special form, either. | 3767 | @defvar ignore-window-parameters |
| 3768 | If this variable is non-@code{nil}, some standard functions do not | ||
| 3769 | process window parameters. The functions currently affected by this are | ||
| 3770 | @code{split-window}, @code{delete-window}, @code{delete-other-windows} | ||
| 3771 | and @code{other-window}. | ||
| 3772 | |||
| 3773 | An application can bind this variable to a non-@code{nil} value around | ||
| 3774 | calls to these functions. If it does so, the application is fully | ||
| 3775 | responsible for correctly assigning the parameters of all involved | ||
| 3776 | windows when exiting that function. | ||
| 3777 | @end defvar | ||
| 3778 | |||
| 3779 | The following parameters are currently used by the window management | ||
| 3780 | code. | ||
| 3781 | |||
| 3782 | @table @asis | ||
| 3783 | @item @code{delete-window} | ||
| 3784 | This parameter affects the execution of @code{delete-window} | ||
| 3785 | (@pxref{Deleting Windows}). | ||
| 3786 | |||
| 3787 | @item @code{delete-other-windows} | ||
| 3788 | This parameter affects the execution of @code{delete-other-windows} | ||
| 3789 | (@pxref{Deleting Windows}). | ||
| 3790 | |||
| 3791 | @item @code{split-window} | ||
| 3792 | This parameter affects the execution of @code{split-window} | ||
| 3793 | (@pxref{Splitting Windows}). | ||
| 3794 | |||
| 3795 | @item @code{other-window} | ||
| 3796 | This parameter affects the execution of @code{other-window} | ||
| 3797 | (@pxref{Cyclic Window Ordering}). | ||
| 3798 | |||
| 3799 | @item @code{no-other-window} | ||
| 3800 | This parameter marks the window as not selectable by @code{other-window} | ||
| 3801 | (@pxref{Cyclic Window Ordering}). | ||
| 3802 | @end table | ||
| 3803 | |||
| 3804 | In addition, the parameters @code{window-atom} and @code{window-side} | ||
| 3805 | are reserved and should not be used by applications. The | ||
| 3806 | @code{quit-restore} parameter tells how to proceed with a window when | ||
| 3807 | the buffer it shows is no more needed. This parameter is installed by | ||
| 3808 | the buffer display functions (@pxref{Choosing Window}) and consulted by | ||
| 3809 | the function @code{quit-window} (@pxref{Quitting Windows}). | ||
| 3810 | |||
| 3604 | 3811 | ||
| 3605 | @node Window Hooks | 3812 | @node Window Hooks |
| 3606 | @section Hooks for Window Scrolling and Changes | 3813 | @section Hooks for Window Scrolling and Changes |
diff --git a/doc/man/emacs.1 b/doc/man/emacs.1 index aef5bd402a2..60dfe3806c0 100644 --- a/doc/man/emacs.1 +++ b/doc/man/emacs.1 | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | .\" See section COPYING for copyright and redistribution information. | 1 | .\" See section COPYING for copyright and redistribution information. |
| 2 | .TH EMACS 1 "2007 April 13" "GNU Emacs 24.0.50" | 2 | .TH EMACS 1 "2007 April 13" "GNU Emacs 24.0.90" |
| 3 | . | 3 | . |
| 4 | . | 4 | . |
| 5 | .SH NAME | 5 | .SH NAME |
diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex index a7f94f96daa..3298298bb9d 100644 --- a/doc/misc/texinfo.tex +++ b/doc/misc/texinfo.tex | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | % Load plain if necessary, i.e., if running under initex. | 3 | % Load plain if necessary, i.e., if running under initex. |
| 4 | \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi | 4 | \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi |
| 5 | % | 5 | % |
| 6 | \def\texinfoversion{2011-08-14.17} | 6 | \def\texinfoversion{2011-09-23.09} |
| 7 | % | 7 | % |
| 8 | % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, | 8 | % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, |
| 9 | % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, | 9 | % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, |
| @@ -3955,13 +3955,13 @@ end | |||
| 3955 | % If so, set to same dimension as multitablelinespace. | 3955 | % If so, set to same dimension as multitablelinespace. |
| 3956 | \ifdim\multitableparskip>\multitablelinespace | 3956 | \ifdim\multitableparskip>\multitablelinespace |
| 3957 | \global\multitableparskip=\multitablelinespace | 3957 | \global\multitableparskip=\multitablelinespace |
| 3958 | \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller | 3958 | \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller |
| 3959 | %% than skip between lines in the table. | 3959 | % than skip between lines in the table. |
| 3960 | \fi% | 3960 | \fi% |
| 3961 | \ifdim\multitableparskip=0pt | 3961 | \ifdim\multitableparskip=0pt |
| 3962 | \global\multitableparskip=\multitablelinespace | 3962 | \global\multitableparskip=\multitablelinespace |
| 3963 | \global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller | 3963 | \global\advance\multitableparskip-7pt % to keep parskip somewhat smaller |
| 3964 | %% than skip between lines in the table. | 3964 | % than skip between lines in the table. |
| 3965 | \fi} | 3965 | \fi} |
| 3966 | 3966 | ||
| 3967 | 3967 | ||
| @@ -7247,9 +7247,15 @@ end | |||
| 7247 | \def\macroxxx#1{% | 7247 | \def\macroxxx#1{% |
| 7248 | \getargs{#1}% now \macname is the macname and \argl the arglist | 7248 | \getargs{#1}% now \macname is the macname and \argl the arglist |
| 7249 | \ifx\argl\empty % no arguments | 7249 | \ifx\argl\empty % no arguments |
| 7250 | \paramno=0 | 7250 | \paramno=0\relax |
| 7251 | \else | 7251 | \else |
| 7252 | \expandafter\parsemargdef \argl;% | 7252 | \expandafter\parsemargdef \argl;% |
| 7253 | \if\paramno>256\relax | ||
| 7254 | \ifx\eTeXversion\thisisundefined | ||
| 7255 | \errhelp = \EMsimple | ||
| 7256 | \errmessage{You need eTeX to compile a file with macros with more than 256 arguments} | ||
| 7257 | \fi | ||
| 7258 | \fi | ||
| 7253 | \fi | 7259 | \fi |
| 7254 | \if1\csname ismacro.\the\macname\endcsname | 7260 | \if1\csname ismacro.\the\macname\endcsname |
| 7255 | \message{Warning: redefining \the\macname}% | 7261 | \message{Warning: redefining \the\macname}% |
| @@ -7299,9 +7305,17 @@ end | |||
| 7299 | \def\getmacname#1 #2\relax{\macname={#1}} | 7305 | \def\getmacname#1 #2\relax{\macname={#1}} |
| 7300 | \def\getmacargs#1{\def\argl{#1}} | 7306 | \def\getmacargs#1{\def\argl{#1}} |
| 7301 | 7307 | ||
| 7308 | % For macro processing make @ a letter so that we can make Texinfo private macro names. | ||
| 7309 | \edef\texiatcatcode{\the\catcode`\@} | ||
| 7310 | \catcode `@=11\relax | ||
| 7311 | |||
| 7302 | % Parse the optional {params} list. Set up \paramno and \paramlist | 7312 | % Parse the optional {params} list. Set up \paramno and \paramlist |
| 7303 | % so \defmacro knows what to do. Define \macarg.blah for each blah | 7313 | % so \defmacro knows what to do. Define \macarg.BLAH for each BLAH |
| 7304 | % in the params list to be ##N where N is the position in that list. | 7314 | % in the params list to some hook where the argument si to be expanded. If |
| 7315 | % there are less than 10 arguments that hook is to be replaced by ##N where N | ||
| 7316 | % is the position in that list, that is to say the macro arguments are to be | ||
| 7317 | % defined `a la TeX in the macro body. | ||
| 7318 | % | ||
| 7305 | % That gets used by \mbodybackslash (above). | 7319 | % That gets used by \mbodybackslash (above). |
| 7306 | % | 7320 | % |
| 7307 | % We need to get `macro parameter char #' into several definitions. | 7321 | % We need to get `macro parameter char #' into several definitions. |
| @@ -7311,12 +7325,33 @@ end | |||
| 7311 | % | 7325 | % |
| 7312 | % The same technique is used to protect \eatspaces till just before | 7326 | % The same technique is used to protect \eatspaces till just before |
| 7313 | % the macro is used. | 7327 | % the macro is used. |
| 7314 | 7328 | % | |
| 7329 | % If there are 10 or more arguments, a different technique is used, where the | ||
| 7330 | % hook remains in the body, and when macro is to be expanded the body is | ||
| 7331 | % processed again to replace the arguments. | ||
| 7332 | % | ||
| 7333 | % In that case, the hook is \the\toks N-1, and we simply set \toks N-1 to the | ||
| 7334 | % argument N value and then \edef the body (nothing else will expand because of | ||
| 7335 | % the catcode regime underwhich the body was input). | ||
| 7336 | % | ||
| 7337 | % If you compile with TeX (not eTeX), and you have macros with 10 or more | ||
| 7338 | % arguments, you need that no macro has more than 256 arguments, otherwise an | ||
| 7339 | % error is produced. | ||
| 7315 | \def\parsemargdef#1;{% | 7340 | \def\parsemargdef#1;{% |
| 7316 | \paramno=0\def\paramlist{}% | 7341 | \paramno=0\def\paramlist{}% |
| 7317 | \let\hash\relax | 7342 | \let\hash\relax |
| 7318 | \let\xeatspaces\relax | 7343 | \let\xeatspaces\relax |
| 7319 | \parsemargdefxxx#1,;,% | 7344 | \parsemargdefxxx#1,;,% |
| 7345 | % In case that there are 10 or more arguments we parse again the arguments | ||
| 7346 | % list to set new definitions for the \macarg.BLAH macros corresponding to | ||
| 7347 | % each BLAH argument. It was anyhow needed to parse already once this list | ||
| 7348 | % in order to count the arguments, and as macros with at most 9 arguments | ||
| 7349 | % are by far more frequent than macro with 10 or more arguments, defining | ||
| 7350 | % twice the \macarg.BLAH macros does not cost too much processing power. | ||
| 7351 | \ifnum\paramno<10\relax\else | ||
| 7352 | \paramno0\relax | ||
| 7353 | \parsemmanyargdef@@#1,;,% 10 or more arguments | ||
| 7354 | \fi | ||
| 7320 | } | 7355 | } |
| 7321 | \def\parsemargdefxxx#1,{% | 7356 | \def\parsemargdefxxx#1,{% |
| 7322 | \if#1;\let\next=\relax | 7357 | \if#1;\let\next=\relax |
| @@ -7327,16 +7362,205 @@ end | |||
| 7327 | \edef\paramlist{\paramlist\hash\the\paramno,}% | 7362 | \edef\paramlist{\paramlist\hash\the\paramno,}% |
| 7328 | \fi\next} | 7363 | \fi\next} |
| 7329 | 7364 | ||
| 7365 | \def\parsemmanyargdef@@#1,{% | ||
| 7366 | \if#1;\let\next=\relax | ||
| 7367 | \else | ||
| 7368 | \let\next=\parsemmanyargdef@@ | ||
| 7369 | \edef\tempb{\eatspaces{#1}}% | ||
| 7370 | \expandafter\def\expandafter\tempa | ||
| 7371 | \expandafter{\csname macarg.\tempb\endcsname}% | ||
| 7372 | % Note that we need some extra \noexpand\noexpand, this is because we | ||
| 7373 | % don't want \the to be expanded in the \parsermacbody as it uses an | ||
| 7374 | % \xdef . | ||
| 7375 | \expandafter\edef\tempa | ||
| 7376 | {\noexpand\noexpand\noexpand\the\toks\the\paramno}% | ||
| 7377 | \advance\paramno by 1\relax | ||
| 7378 | \fi\next} | ||
| 7379 | |||
| 7330 | % These two commands read recursive and nonrecursive macro bodies. | 7380 | % These two commands read recursive and nonrecursive macro bodies. |
| 7331 | % (They're different since rec and nonrec macros end differently.) | 7381 | % (They're different since rec and nonrec macros end differently.) |
| 7332 | % | 7382 | % |
| 7383 | |||
| 7384 | \catcode `\@\texiatcatcode | ||
| 7333 | \long\def\parsemacbody#1@end macro% | 7385 | \long\def\parsemacbody#1@end macro% |
| 7334 | {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% | 7386 | {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% |
| 7335 | \long\def\parsermacbody#1@end rmacro% | 7387 | \long\def\parsermacbody#1@end rmacro% |
| 7336 | {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% | 7388 | {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% |
| 7389 | \catcode `\@=11\relax | ||
| 7390 | |||
| 7391 | \let\endargs@\relax | ||
| 7392 | \let\nil@\relax | ||
| 7393 | \def\nilm@{\nil@}% | ||
| 7394 | \long\def\nillm@{\nil@}% | ||
| 7395 | |||
| 7396 | % This macro is expanded during the Texinfo macro expansion, not during its | ||
| 7397 | % definition. It gets all the arguments values and assigns them to macros | ||
| 7398 | % macarg.ARGNAME | ||
| 7399 | % | ||
| 7400 | % #1 is the macro name | ||
| 7401 | % #2 is the list of argument names | ||
| 7402 | % #3 is the list of argument values | ||
| 7403 | \def\getargvals@#1#2#3{% | ||
| 7404 | \def\macargdeflist@{}% | ||
| 7405 | \def\saveparamlist@{#2}% Need to keep a copy for parameter expansion. | ||
| 7406 | \def\paramlist{#2,\nil@}% | ||
| 7407 | \def\macroname{#1}% | ||
| 7408 | \begingroup | ||
| 7409 | \macroargctxt | ||
| 7410 | \def\argvaluelist{#3,\nil@}% | ||
| 7411 | \def\@tempa{#3}% | ||
| 7412 | \ifx\@tempa\empty | ||
| 7413 | \setemptyargvalues@ | ||
| 7414 | \else | ||
| 7415 | \getargvals@@ | ||
| 7416 | \fi | ||
| 7417 | } | ||
| 7337 | 7418 | ||
| 7338 | % This defines the macro itself. There are six cases: recursive and | 7419 | % |
| 7339 | % nonrecursive macros of zero, one, and many arguments. | 7420 | \def\getargvals@@{% |
| 7421 | \ifx\paramlist\nilm@ | ||
| 7422 | % Some sanity check needed here that \argvaluelist is also empty. | ||
| 7423 | \ifx\argvaluelist\nillm@ | ||
| 7424 | \else | ||
| 7425 | \errhelp = \EMsimple | ||
| 7426 | \errmessage{Too many arguments in macro `\macroname'!}% | ||
| 7427 | \fi | ||
| 7428 | \let\next\macargexpandinbody@ | ||
| 7429 | \else | ||
| 7430 | \ifx\argvaluelist\nillm@ | ||
| 7431 | % No more arguments values passed to macro. Set remaining named-arg | ||
| 7432 | % macros to empty. | ||
| 7433 | \let\next\setemptyargvalues@ | ||
| 7434 | \else | ||
| 7435 | % pop current arg name into \@tempb | ||
| 7436 | \def\@tempa##1{\pop@{\@tempb}{\paramlist}##1\endargs@}% | ||
| 7437 | \expandafter\@tempa\expandafter{\paramlist}% | ||
| 7438 | % pop current argument value into \@tempc | ||
| 7439 | \def\@tempa##1{\longpop@{\@tempc}{\argvaluelist}##1\endargs@}% | ||
| 7440 | \expandafter\@tempa\expandafter{\argvaluelist}% | ||
| 7441 | % Here \@tempb is the current arg name and \@tempc is the current arg value. | ||
| 7442 | % First place the new argument macro definition into \@tempd | ||
| 7443 | \expandafter\macname\expandafter{\@tempc}% | ||
| 7444 | \expandafter\let\csname macarg.\@tempb\endcsname\relax | ||
| 7445 | \expandafter\def\expandafter\@tempe\expandafter{% | ||
| 7446 | \csname macarg.\@tempb\endcsname}% | ||
| 7447 | \edef\@tempd{\long\def\@tempe{\the\macname}}% | ||
| 7448 | \push@\@tempd\macargdeflist@ | ||
| 7449 | \let\next\getargvals@@ | ||
| 7450 | \fi | ||
| 7451 | \fi | ||
| 7452 | \next | ||
| 7453 | } | ||
| 7454 | |||
| 7455 | \def\push@#1#2{% | ||
| 7456 | \expandafter\expandafter\expandafter\def | ||
| 7457 | \expandafter\expandafter\expandafter#2% | ||
| 7458 | \expandafter\expandafter\expandafter{% | ||
| 7459 | \expandafter#1#2}% | ||
| 7460 | } | ||
| 7461 | |||
| 7462 | % Replace arguments by their values in the macro body, and place the result | ||
| 7463 | % in macro \@tempa | ||
| 7464 | \def\macvalstoargs@{% | ||
| 7465 | % To do this we use the property that token registers that are \the'ed | ||
| 7466 | % within an \edef expand only once. So we are going to place all argument | ||
| 7467 | % values into respective token registers. | ||
| 7468 | % | ||
| 7469 | % First we save the token context, and initialize argument numbering. | ||
| 7470 | \begingroup | ||
| 7471 | \paramno0\relax | ||
| 7472 | % Then, for each argument number #N, we place the corresponding argument | ||
| 7473 | % value into a new token list register \toks#N | ||
| 7474 | \expandafter\putargsintokens@\saveparamlist@,;,% | ||
| 7475 | % Then, we expand the body so that argument are replaced by their | ||
| 7476 | % values. The trick for values not to be expanded themselves is that they | ||
| 7477 | % are within tokens and that tokens expand only once in an \edef . | ||
| 7478 | \edef\@tempc{\csname mac.\macroname .body\endcsname}% | ||
| 7479 | % Now we restore the token stack pointer to free the token list registers | ||
| 7480 | % which we have used, but we make sure that expanded body is saved after | ||
| 7481 | % group. | ||
| 7482 | \expandafter | ||
| 7483 | \endgroup | ||
| 7484 | \expandafter\def\expandafter\@tempa\expandafter{\@tempc}% | ||
| 7485 | } | ||
| 7486 | |||
| 7487 | \def\macargexpandinbody@{% | ||
| 7488 | %% Define the named-macro outside of this group and then close this group. | ||
| 7489 | \expandafter | ||
| 7490 | \endgroup | ||
| 7491 | \macargdeflist@ | ||
| 7492 | % First the replace in body the macro arguments by their values, the result | ||
| 7493 | % is in \@tempa . | ||
| 7494 | \macvalstoargs@ | ||
| 7495 | % Then we point at the \norecurse or \gobble (for recursive) macro value | ||
| 7496 | % with \@tempb . | ||
| 7497 | \expandafter\let\expandafter\@tempb\csname mac.\macroname .recurse\endcsname | ||
| 7498 | % Depending on whether it is recursive or not, we need some tailing | ||
| 7499 | % \egroup . | ||
| 7500 | \ifx\@tempb\gobble | ||
| 7501 | \let\@tempc\relax | ||
| 7502 | \else | ||
| 7503 | \let\@tempc\egroup | ||
| 7504 | \fi | ||
| 7505 | % And now we do the real job: | ||
| 7506 | \edef\@tempd{\noexpand\@tempb{\macroname}\noexpand\scanmacro{\@tempa}\@tempc}% | ||
| 7507 | \@tempd | ||
| 7508 | } | ||
| 7509 | |||
| 7510 | \def\putargsintokens@#1,{% | ||
| 7511 | \if#1;\let\next\relax | ||
| 7512 | \else | ||
| 7513 | \let\next\putargsintokens@ | ||
| 7514 | % First we allocate the new token list register, and give it a temporary | ||
| 7515 | % alias \@tempb . | ||
| 7516 | \toksdef\@tempb\the\paramno | ||
| 7517 | % Then we place the argument value into that token list register. | ||
| 7518 | \expandafter\let\expandafter\@tempa\csname macarg.#1\endcsname | ||
| 7519 | \expandafter\@tempb\expandafter{\@tempa}% | ||
| 7520 | \advance\paramno by 1\relax | ||
| 7521 | \fi | ||
| 7522 | \next | ||
| 7523 | } | ||
| 7524 | |||
| 7525 | % Save the token stack pointer into macro #1 | ||
| 7526 | \def\texisavetoksstackpoint#1{\edef#1{\the\@cclvi}} | ||
| 7527 | % Restore the token stack pointer from number in macro #1 | ||
| 7528 | \def\texirestoretoksstackpoint#1{\expandafter\mathchardef\expandafter\@cclvi#1\relax} | ||
| 7529 | % newtoks that can be used non \outer . | ||
| 7530 | \def\texinonouternewtoks{\alloc@ 5\toks \toksdef \@cclvi} | ||
| 7531 | |||
| 7532 | % Tailing missing arguments are set to empty | ||
| 7533 | \def\setemptyargvalues@{% | ||
| 7534 | \ifx\paramlist\nilm@ | ||
| 7535 | \let\next\macargexpandinbody@ | ||
| 7536 | \else | ||
| 7537 | \expandafter\setemptyargvaluesparser@\paramlist\endargs@ | ||
| 7538 | \let\next\setemptyargvalues@ | ||
| 7539 | \fi | ||
| 7540 | \next | ||
| 7541 | } | ||
| 7542 | |||
| 7543 | \def\setemptyargvaluesparser@#1,#2\endargs@{% | ||
| 7544 | \expandafter\def\expandafter\@tempa\expandafter{% | ||
| 7545 | \expandafter\def\csname macarg.#1\endcsname{}}% | ||
| 7546 | \push@\@tempa\macargdeflist@ | ||
| 7547 | \def\paramlist{#2}% | ||
| 7548 | } | ||
| 7549 | |||
| 7550 | % #1 is the element target macro | ||
| 7551 | % #2 is the list macro | ||
| 7552 | % #3,#4\endargs@ is the list value | ||
| 7553 | \def\pop@#1#2#3,#4\endargs@{% | ||
| 7554 | \def#1{#3}% | ||
| 7555 | \def#2{#4}% | ||
| 7556 | } | ||
| 7557 | \long\def\longpop@#1#2#3,#4\endargs@{% | ||
| 7558 | \long\def#1{#3}% | ||
| 7559 | \long\def#2{#4}% | ||
| 7560 | } | ||
| 7561 | |||
| 7562 | % This defines a Texinfo @macro. There are eight cases: recursive and | ||
| 7563 | % nonrecursive macros of zero, one, up to nine, and many arguments. | ||
| 7340 | % Much magic with \expandafter here. | 7564 | % Much magic with \expandafter here. |
| 7341 | % \xdef is used so that macro definitions will survive the file | 7565 | % \xdef is used so that macro definitions will survive the file |
| 7342 | % they're defined in; @include reads the file inside a group. | 7566 | % they're defined in; @include reads the file inside a group. |
| @@ -7355,17 +7579,25 @@ end | |||
| 7355 | \expandafter\noexpand\csname\the\macname xxx\endcsname}% | 7579 | \expandafter\noexpand\csname\the\macname xxx\endcsname}% |
| 7356 | \expandafter\xdef\csname\the\macname xxx\endcsname##1{% | 7580 | \expandafter\xdef\csname\the\macname xxx\endcsname##1{% |
| 7357 | \egroup\noexpand\scanmacro{\temp}}% | 7581 | \egroup\noexpand\scanmacro{\temp}}% |
| 7358 | \else % many | 7582 | \else |
| 7359 | \expandafter\xdef\csname\the\macname\endcsname{% | 7583 | \ifnum\paramno<10\relax % at most 9 |
| 7360 | \bgroup\noexpand\macroargctxt | 7584 | \expandafter\xdef\csname\the\macname\endcsname{% |
| 7361 | \noexpand\csname\the\macname xx\endcsname}% | 7585 | \bgroup\noexpand\macroargctxt |
| 7362 | \expandafter\xdef\csname\the\macname xx\endcsname##1{% | 7586 | \noexpand\csname\the\macname xx\endcsname}% |
| 7363 | \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% | 7587 | \expandafter\xdef\csname\the\macname xx\endcsname##1{% |
| 7364 | \expandafter\expandafter | 7588 | \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% |
| 7365 | \expandafter\xdef | 7589 | \expandafter\expandafter |
| 7366 | \expandafter\expandafter | 7590 | \expandafter\xdef |
| 7367 | \csname\the\macname xxx\endcsname | 7591 | \expandafter\expandafter |
| 7368 | \paramlist{\egroup\noexpand\scanmacro{\temp}}% | 7592 | \csname\the\macname xxx\endcsname |
| 7593 | \paramlist{\egroup\noexpand\scanmacro{\temp}}% | ||
| 7594 | \else % 10 or more | ||
| 7595 | \expandafter\xdef\csname\the\macname\endcsname{% | ||
| 7596 | \noexpand\getargvals@{\the\macname}{\argl}% | ||
| 7597 | }% | ||
| 7598 | \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp | ||
| 7599 | \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\gobble | ||
| 7600 | \fi | ||
| 7369 | \fi | 7601 | \fi |
| 7370 | \else | 7602 | \else |
| 7371 | \ifcase\paramno | 7603 | \ifcase\paramno |
| @@ -7382,23 +7614,33 @@ end | |||
| 7382 | \egroup | 7614 | \egroup |
| 7383 | \noexpand\norecurse{\the\macname}% | 7615 | \noexpand\norecurse{\the\macname}% |
| 7384 | \noexpand\scanmacro{\temp}\egroup}% | 7616 | \noexpand\scanmacro{\temp}\egroup}% |
| 7385 | \else % many | 7617 | \else % at most 9 |
| 7386 | \expandafter\xdef\csname\the\macname\endcsname{% | 7618 | \ifnum\paramno<10\relax |
| 7387 | \bgroup\noexpand\macroargctxt | 7619 | \expandafter\xdef\csname\the\macname\endcsname{% |
| 7388 | \expandafter\noexpand\csname\the\macname xx\endcsname}% | 7620 | \bgroup\noexpand\macroargctxt |
| 7389 | \expandafter\xdef\csname\the\macname xx\endcsname##1{% | 7621 | \expandafter\noexpand\csname\the\macname xx\endcsname}% |
| 7390 | \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% | 7622 | \expandafter\xdef\csname\the\macname xx\endcsname##1{% |
| 7391 | \expandafter\expandafter | 7623 | \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% |
| 7392 | \expandafter\xdef | 7624 | \expandafter\expandafter |
| 7393 | \expandafter\expandafter | 7625 | \expandafter\xdef |
| 7394 | \csname\the\macname xxx\endcsname | 7626 | \expandafter\expandafter |
| 7395 | \paramlist{% | 7627 | \csname\the\macname xxx\endcsname |
| 7396 | \egroup | 7628 | \paramlist{% |
| 7397 | \noexpand\norecurse{\the\macname}% | 7629 | \egroup |
| 7398 | \noexpand\scanmacro{\temp}\egroup}% | 7630 | \noexpand\norecurse{\the\macname}% |
| 7631 | \noexpand\scanmacro{\temp}\egroup}% | ||
| 7632 | \else % 10 or more: | ||
| 7633 | \expandafter\xdef\csname\the\macname\endcsname{% | ||
| 7634 | \noexpand\getargvals@{\the\macname}{\argl}% | ||
| 7635 | }% | ||
| 7636 | \global\expandafter\let\csname mac.\the\macname .body\endcsname\temp | ||
| 7637 | \global\expandafter\let\csname mac.\the\macname .recurse\endcsname\norecurse | ||
| 7638 | \fi | ||
| 7399 | \fi | 7639 | \fi |
| 7400 | \fi} | 7640 | \fi} |
| 7401 | 7641 | ||
| 7642 | \catcode `\@\texiatcatcode\relax | ||
| 7643 | |||
| 7402 | \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} | 7644 | \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} |
| 7403 | 7645 | ||
| 7404 | % \braceorline decides whether the next nonwhitespace character is a | 7646 | % \braceorline decides whether the next nonwhitespace character is a |