aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/emacs/ChangeLog14
-rw-r--r--doc/emacs/buffers.texi42
-rw-r--r--doc/emacs/emacs.texi3
-rw-r--r--doc/emacs/emacsver.texi2
-rw-r--r--doc/emacs/frames.texi18
-rw-r--r--doc/emacs/windows.texi205
-rw-r--r--doc/lispref/ChangeLog36
-rw-r--r--doc/lispref/buffers.texi41
-rw-r--r--doc/lispref/display.texi13
-rw-r--r--doc/lispref/elisp.texi10
-rw-r--r--doc/lispref/files.texi7
-rw-r--r--doc/lispref/vol1.texi8
-rw-r--r--doc/lispref/vol2.texi8
-rw-r--r--doc/lispref/windows.texi811
-rw-r--r--doc/man/emacs.12
-rw-r--r--doc/misc/texinfo.tex314
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 @@
12011-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
12011-09-18 Chong Yidong <cyd@stupidchicken.com> 152011-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
93the buffer name, you can use the usual minibuffer completion and 93the buffer name, you can use the usual minibuffer completion and
94history commands (@pxref{Minibuffer}). An empty argument to @kbd{C-x 94history commands (@pxref{Minibuffer}). An empty input specifies the
95b} specifies the buffer that was current most recently among those not 95buffer that was current most recently among those not now displayed in
96now displayed in any window. 96any 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
107realizing that @key{TAB} did not complete far enough to yield the 107realizing that @key{TAB} did not complete far enough to yield the
108desired buffer name (@pxref{Completion}). Emacs asks for confirmation 108desired buffer name (@pxref{Completion}). Emacs asks for confirmation
109by putting the message @samp{[Confirm]} in the minibuffer; type 109by 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 111information about modifying this behavior.
112@vindex confirm-nonexistent-file-or-buffer
113 The variable @code{confirm-nonexistent-file-or-buffer} controls
114whether Emacs asks for confirmation before visiting a buffer that did
115not previously exist. The default value, @code{after-completion},
116gives the behavior we have just described. If the value is
117@code{nil}, Emacs never asks for confirmation; for any other
118non-@code{nil} value, Emacs always asks for confirmation. This
119variable 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
122notes. If you try to save it, Emacs asks for the file name to use. 114notes. 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
142for a buffer name using the minibuffer, displays that buffer in 133for a buffer name using the minibuffer, displays that buffer in
143another window, and selects that window. By default, if displaying 134another window, and selects that window.
144the buffer causes two vertically adjacent windows to be displayed, the
145heights of those windows are evened out; to countermand that and
146preserve 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})
152prompts for a buffer name, displays that buffer in another frame, and 139prompts for a buffer name, displays that buffer in another frame, and
153selects that frame. 140selects that frame. If the buffer is already being shown in a window
141on another frame, Emacs selects that window and frame instead of
142creating a new frame.
143
144 @xref{Displaying Buffers}, for how the @kbd{C-x 4 b} and @kbd{C-x 5
145b} 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
156file, can also be used to switch to an existing file-visiting buffer. 148file, 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
161customizing 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
165addition, if the value of @code{display-buffer-reuse-frames} is
166non-@code{nil}, and the buffer you want to switch to is already
167displayed 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
171argument, reads a number @var{n} using the minibuffer, selects the 153argument, 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
496Frames and Graphical Displays 495Frames 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
853in ``another window,'' appear in special frames of their own. To do 853in ``some other window'' (@pxref{Displaying Buffers}), appear in
854this, set the variable @code{special-display-buffer-names} to a list 854special frames of their own. To do this, set the variable
855of buffer names; any buffer whose name is in that list automatically 855@code{special-display-buffer-names} to a list of buffer names; any
856gets a special frame, when an Emacs command wants to display it ``in 856buffer whose name is in that list automatically gets a special frame.
857another window.'' 857@xref{Window Choice}, for how this fits in with the other ways for
858Emacs 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
906calling @var{function}; its first argument is the buffer, and its 907calling @var{function}; its first argument is the buffer, and its
907remaining arguments are @var{args}. 908remaining arguments are @var{args}.
908 909
909 An analogous feature lets you specify buffers which should be
910displayed in the selected window. @xref{Force Same Window}. The
911same-window feature takes precedence over the special-frame feature;
912therefore, if you add a buffer name to
913@code{special-display-buffer-names} and it has no effect, check to see
914whether 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 194a buffer in a different window---either another existing window, or a
196window. Different @kbd{C-x 4} commands have different ways of finding the 195new window created by splitting the selected window. @xref{Window
197buffer to select. 196Choice}, 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}
201Select buffer @var{bufname} in another window. This runs 201Select 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}
204Display buffer @var{bufname} in another window, but 206Display buffer @var{bufname} in some window, without trying to select
205don't select that buffer or that window. This runs 207it (@code{display-buffer}). @xref{Displaying Buffers}, for details
206@code{display-buffer}. 208about 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}
208Visit file @var{filename} and select its buffer in another window. This 212Visit file @var{filename} and select its buffer in another window
209runs @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}
211Select a Dired buffer for directory @var{directory} in another window. 217Select a Dired buffer for directory @var{directory} in another window
212This 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
214Start composing a mail message in another window. This runs 222Start 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} 223Mail}), 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 .
218Find a tag in the current tags table, in another window. This runs 227Find 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}
222Visit file @var{filename} read-only, and select its buffer in another 230Visit file @var{filename} read-only, and select its buffer in another
223window. This runs @code{find-file-read-only-other-window}. 231window (@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
230only one. You can customize the variables @code{split-height-threshold}
231and @code{split-width-threshold} to split the window horizontally
232instead.
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
239contents. For example, @kbd{M-x shell} switches to a buffer named
240@samp{*shell*}. By convention, all these commands are written to pop up
241the buffer in a separate window. But you can specify that certain of
242these 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},
246the effect is that such commands display that particular buffer by
247switching to it in the selected window. For example, if you add the
248element @code{"*grep*"} to the list, the @code{grep} command will
249display 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).
254This is why @kbd{M-x shell} normally switches to the @samp{*shell*}
255buffer in the selected window. If you delete this element from the
256value of @code{same-window-buffer-names}, the behavior of @kbd{M-x
257shell} will change---it will pop up the buffer in another window
258instead.
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;
263then any buffer whose name matches one of those regular expressions is
264displayed by switching to it in the selected window. (Once again, this
265applies only to buffers that normally get displayed for you in a
266separate window.) The default value of this variable specifies Telnet
267and rlogin buffers.
268
269 An analogous feature lets you specify buffers which should be
270displayed 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
357heights and to delete windows. @xref{Mode Line Mouse}. 319heights 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
325in response to a user command. There are several different ways by
326which commands do this.
327
328 Many commands, like @kbd{C-x C-f} (@code{find-file}), display the
329buffer by ``taking over'' the selected window, expecting that the
330user's attention will be diverted to that buffer. These commands
331usually 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
336over the selected window, e.g. by splitting the selected window and
337displaying the desired buffer in the child window. Such commands,
338which include the various help commands (@pxref{Help}), work by
339calling @code{display-buffer} internally. @xref{Window Choice}, for
340details.
341
342 Other commands do the same as @code{display-buffer}, and
343additionally select the displaying window so that you can begin
344editing its buffer. The command @kbd{C-x `} (@code{next-error}) is
345one example (@pxref{Compilation Mode}). Such commands work by calling
346@code{pop-to-buffer} internally. @xref{Displaying Buffers,,Displaying
347Buffers 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
351window. Several of these commands are bound in the @kbd{C-x 4} prefix
352key (@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
356selected window and (ii) prefer to create a new frame to display the
357desired buffer instead of splitting a window---as though the variable
358@code{pop-up-frames} is set to @code{t} (@pxref{Window Choice}).
359Several 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
369The @code{display-buffer} command (as well as commands that call it
370internally) 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
376First, check if the buffer should be displayed in the selected window
377regardless of other considerations. You can tell Emacs to do this by
378adding the desired buffer's name to the list
379@code{same-window-buffer-names}, or adding a matching regular
380expression to the list @code{same-window-regexps}. By default, these
381variables are @code{nil}, so this step is skipped.
382
383@vindex display-buffer-reuse-frames
384@item
385Otherwise, if the buffer is already displayed in an existing window,
386``reuse'' that window. Normally, only windows on the selected frame
387are considered, but windows on other frames are also reusable if you
388change @code{display-buffer-reuse-frames} to @code{t}, or if you
389change @code{pop-up-frames} (see below) to @code{t}.
390
391@item
392Otherwise, if you specified that the buffer should be displayed in a
393special 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
398Otherwise, optionally create a new frame and display the buffer there.
399By 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
404Otherwise, try to create a new window by splitting the selected
405window, and display the buffer in that new window.
406
407@vindex split-height-threshold
408@vindex split-width-threshold
409The split can be either vertical or horizontal, depending on the
410variables @code{split-height-threshold} and
411@code{split-width-threshold}. These variables should have integer
412values. If @code{split-height-threshold} is smaller than the selected
413window's height, the split puts the new window below. Otherwise, if
414@code{split-width-threshold} is smaller than the window's width, the
415split puts the new window on the right. If neither condition holds,
416Emacs tries to split so that the new window is below---but only if the
417window was not split before (to avoid excessive splitting).
418
419@item
420Otherwise, display the buffer in an existing window on the selected
421frame.
422
423@item
424If all the above methods fail for whatever reason, create a new frame
425and 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 @@
12011-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
162011-09-25 Chong Yidong <cyd@stupidchicken.com>
17
18 * windows.texi (Display Action Functions)
19 (Choosing Window Options): New nodes.
20
212011-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
322011-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
12011-09-23 Martin Rudalics <rudalics@gmx.at> 372011-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
124buffer that the cursor is in, when Emacs reads a command, is the 124buffer that the cursor is in, when Emacs reads a command, is the
125buffer to which that command applies (@pxref{Command Loop}). Thus, 125buffer to which that command applies (@pxref{Command Loop}). Thus,
126you should not use @code{set-buffer} to switch visibly to a different 126you should not use @code{set-buffer} to switch visibly to a different
127buffer; for that, use the functions described in @ref{Displaying 127buffer; for that, use the functions described in @ref{Switching
128Buffers}. 128Buffers}.
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
776user also follows this order. 776user 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
779buffer removes it from that list. A buffer moves to the front of this 779a buffer removes it from that list. A buffer moves to the front of
780list whenever it is chosen for display in a window (@pxref{Displaying 780this list whenever it is chosen for display in a window
781Buffers}) or a window displaying it is selected (@pxref{Selecting 781(@pxref{Switching Buffers}) or a window displaying it is selected
782Windows}). 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 783when it is buried (see @code{bury-buffer}, below). There are no
784Lisp programmer which directly manipulate the buffer list. 784functions available to the Lisp programmer which directly manipulate
785the 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
787maintains a local buffer list for each frame, in which the buffers that 788maintains 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
888bury will come last in the value of @code{(buffer-list @var{frame})} and 889bury will come last in the value of @code{(buffer-list @var{frame})} and
889in the value of @code{(buffer-list)}. 890in the value of @code{(buffer-list)}.
890 891
891If @var{buffer-or-name} is @code{nil} or omitted, this means to bury the 892If @var{buffer-or-name} is @code{nil} or omitted, this means to bury
892current buffer. In addition, if the buffer is displayed in the selected 893the current buffer. In addition, if the buffer is displayed in the
893window, this switches to some other buffer (obtained using 894selected 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
895But if the selected window is dedicated to its buffer, it deletes that 896Buffers}. But if the selected window is dedicated to its buffer, it
896window if there are other windows left on its frame. Otherwise, if the 897deletes that window if there are other windows left on its frame.
897selected window is the only window on its frame, it iconifies that 898Otherwise, if the selected window is the only window on its frame, it
898frame. If @var{buffer-or-name} is displayed in some other window, it 899iconifies that frame. If @var{buffer-or-name} is displayed in some
899remains displayed there. 900other window, it remains displayed there.
900 901
901To replace a buffer in all the windows that display it, use 902To 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
906This command switches to the last buffer in the local buffer list of the 907This command switches to the last buffer in the local buffer list of
907selected frame. More precisely, it calls the function 908the 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
909buffer returned by @code{last-buffer}, see above, in the selected 910buffer returned by @code{last-buffer}, see above, in the selected
910window. 911window.
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.
118to put more work on the queue to be done by redisplay whenever there 118to put more work on the queue to be done by redisplay whenever there
119is a chance. 119is a chance.
120 120
121 Emacs redisplay normally stops if input arrives, and does not happen
122at all if input is available before it starts. Most of the time, this
123is exactly what you want. However, you can prevent preemption by
124binding @code{redisplay-dont-pause} to a non-@code{nil} value.
125
126@defvar redisplay-dont-pause 121@defvar redisplay-dont-pause
127If this variable is non-@code{nil}, pending input does not 122If this variable is non-@code{nil}, pending input does not prevent or
128prevent or halt redisplay; redisplay occurs, and finishes, 123halt redisplay; redisplay occurs, and finishes, regardless of whether
129regardless of whether input is available. 124input is available. If it is @code{nil}, Emacs redisplay stops if
125input arrives, and does not happen at all if input is available before
126it 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
108If @var{wildcards} is non-@code{nil}, which is always true in an 108If @var{wildcards} is non-@code{nil}, which is always true in an
109interactive call, then @code{find-file} expands wildcard characters in 109interactive 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
189This command selects a buffer visiting the file @var{filename}, but 189This command selects a buffer visiting the file @var{filename}, but
190does so in a window other than the selected window. It may use another 190does so in a window other than the selected window. It may use
191existing window or split a window; see @ref{Displaying Buffers}. 191another existing window or split a window; see @ref{Switching
192Buffers}.
192 193
193When this command is called interactively, it prompts for 194When 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
292to the selected one. The return value is @code{nil} if @var{window} is 296to the selected one. The return value is @code{nil} if @var{window} is
293a live window or its children form a vertical combination. In the 297a live window or its children form a vertical combination. In the
294example above @code{(window-left-child W4)} is @code{W6} while 298example 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
1983The basic, low-level function to associate a window with a buffer is 1986The 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
1986regulating which windows are supposed to display which buffers. When 1989of user customizations regulating which windows are supposed to
1987writing an application, programmers should therefore carefully evaluate 1990display which buffers. @xref{Switching Buffers}. When writing an
1988whether they really need the power of @code{set-window-buffer}. 1991application, you should avoid using @code{set-window-buffer} unless
1992you 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
1991This function makes @var{window} display @var{buffer-or-name} and 1995This 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
2067like the optional arguments of @code{get-buffer-window}. 2071like the optional arguments of @code{get-buffer-window}.
2068@end defun 2072@end defun
2069 2073
2070The 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
2073This function replaces @var{buffer-or-name} in all windows displaying it 2075This command replaces @var{buffer-or-name} with some other buffer, in
2074with some other buffer. It uses @code{switch-to-prev-buffer}, see 2076all windows displaying it. For each such window, it choose another
2075below, to choose that other buffer which is usually the last buffer 2077buffer using @code{switch-to-prev-buffer} (@pxref{Window History}).
2076displayed before @var{buffer-or-name} in the respective window.
2077 2078
2078The 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
2079existing buffer and defaults to the current buffer. 2080buffer; it defaults to the current buffer.
2080 2081
2081If a window displaying @var{buffer-or-name} is dedicated 2082If 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
2083not the only window on its frame, that window is deleted. If that 2084is not the only window on its frame, that window is deleted. If that
2084window is the only window on its frame and there are other frames left, 2085window is the only window on its frame and there are other frames on the
2085the window's frame is deleted too. If there are no other frames left, 2086frame's terminal, that frame is deleted too; otherwise, the buffer
2086some other buffer is displayed in that window as explained above. You 2087provided by the function @code{switch-to-prev-buffer} (@pxref{Window
2087can prevent the deletion of windows and/or frames by customizing the 2088History}) is displayed instead.
2088option @var{window-auto-delete}.
2089
2090This 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
2094window, it tries to pick the buffer shown there before. For this
2095purpose each window remembers the buffers it has displayed earlier and
2096the order in which these buffers have been removed from it.
2097
2098The list of @dfn{previous buffers} of a window is an association list
2099where each entry specifies a buffer, the last start position of that
2100buffer in the window (@pxref{Window Start and End}) and the last
2101position of that buffer's point in the window (@pxref{Window Point}).
2102This list is ordered by the times of the removal of the respective
2103buffers from the window. In particular, the first element of the list
2104references the buffer removed most recently. The function
2105@code{set-window-buffer} pushes an entry for the old buffer of its
2106window argument on that list before it shows its buffer argument in the
2107window.
2108 2091
2109The list of @dfn{next buffers} of a window is a list of buffers that 2092@node Switching Buffers
2110have been recently re-shown by the function @code{switch-to-prev-buffer} 2093@section Switching to a Buffer in a Window
2111and is used to avoid that that function switches to such a buffer again 2094@cindex switching to a buffer
2112before showing other interesting buffers. 2095@cindex displaying a buffer
2113
2114The lists of previous and next buffers and the global buffer list
2115(@pxref{The Buffer List}) allow to effectively display all buffers in a
2116window while giving preference to the buffers previously shown in that
2117window. The commands used for this purpose are
2118@code{switch-to-prev-buffer} and @code{switch-to-next-buffer} described
2119below.
2120 2096
2121The following functions directly operate on the lists of previous and 2097 This section describes high-level functions for switching to a
2122next buffers. 2098specified buffer in some window.
2099
2100 Do @emph{not} use these functions to make a buffer temporarily
2101current just so a Lisp program can access or modify it. They have
2102side-effects, such as changing window histories (@pxref{Window
2103History}), which will surprise the user if used that way. If you want
2104to 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
2109This function displays @var{buffer-or-name} in the selected window,
2110and makes it the current buffer. (In contrast, @code{set-buffer}
2111makes the buffer current but does not display it; @pxref{Current
2112Buffer}). It is often used interactively (as the binding of @kbd{C-x
2113b}), as well as in Lisp programs. The return value is the buffer
2114switched to.
2115
2116If @var{buffer-or-name} is @code{nil}, it defaults to the buffer
2117returned 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
2119buffer, this function creates a new buffer with that name; the new
2120buffer's major mode is determined by the variable @code{major-mode}
2121(@pxref{Major Modes}).
2122
2123Normally the specified buffer is put at the front of the buffer
2124list---both the global buffer list and the selected frame's buffer
2125list (@pxref{The Buffer List}). However, this is not done if the
2126optional argument @var{norecord} is non-@code{nil}.
2127
2128If this function is unable to display the buffer in the selected
2129window---usually because the selected window is a minibuffer window or
2130is strongly dedicated to its buffer (@pxref{Dedicated Windows})---then
2131it normally tries to display the buffer in some other window, in the
2132manner of @code{pop-to-buffer} (see below). However, if the optional
2133argument @var{force-same-window} is non-@code{nil}, it signals an error
2134instead.
2135@end deffn
2123 2136
2124@defun window-prev-buffers &optional window 2137The next two functions are similar to @code{switch-to-buffer}, except
2125This function returns an alist specifying the buffers previously shown 2138for the described features.
2126in @var{window} together with their window start and point positions.
2127The argument @var{window} must be a live window and defaults to the
2128selected 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
2132This function sets @var{window}'s previous buffers to the value of 2141This function makes the buffer specified by @var{buffer-or-name}
2133@var{prev-buffers}. The argument @var{window} must be a live window and 2142current and displays it in some window other than the selected window.
2134defaults to the selected one. This function returns 2143It uses the function @code{pop-to-buffer} internally (see below).
2135@var{prev-buffers}.
2136 2144
2137If non-@code{nil}, @var{prev-buffers} must specify an alist of triples 2145If the selected window already displays the specified buffer, it
2138specifying a buffer and two markers for that buffer's start and point 2146continues to do so, but another window is nonetheless found to display
2139position in @var{window}. 2147it as well.
2140@end defun
2141 2148
2142@defun window-next-buffers &optional window 2149The @var{buffer-or-name} and @var{norecord} arguments have the same
2143This function returns the list of buffers recently re-shown in 2150meanings as in @code{switch-to-buffer}.
2144@var{window}. The argument @var{window} must be a live window and 2151@end deffn
2145defaults 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
2149This function sets @var{window}'s next buffers to @var{next-buffers}. 2154This function makes the buffer specified by @var{buffer-or-name}
2150@var{window} must be a live window and defaults to the selected one. 2155current and displays it, usually in a new frame. It uses the function
2151This fucntion returns @var{next-buffers}. 2156@code{pop-to-buffer} (see below).
2152 2157
2153If non-@code{nil}, the argument @var{next-buffers} should specify a list 2158If the specified buffer is already displayed in another window, in any
2154of buffers that shall be preferably not shown by the command 2159frame on the current terminal, this switches to that window instead of
2155@code{switch-to-prev-buffer}, see below. 2160creating a new frame. However, the selected window is never used for
2156@end defun 2161this.
2157 2162
2158The following command is used by @code{replace-buffer-in-windows}, 2163The @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 2164meanings as in @code{switch-to-buffer}.
2160window. It can be also used interactively to cycle through the list of 2165@end deffn
2161all 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 2167The above commands use @code{pop-to-buffer}, which is the function
2165This function displays the previous buffer in @var{window}. The 2168used by Lisp programs to flexibly display a buffer in some window and
2166argument @var{window} must be a live window and defaults to the selected 2169select that window for editing:
2167one. If the optional argument @var{bury-or-kill} is non-@code{nil}, 2170
2168this means that the buffer currently shown in @var{window} is about to 2171@defun pop-to-buffer buffer-or-name &optional action norecord
2169be buried or killed and consequently shall not be switched to in future 2172This function makes @var{buffer-or-name} the current buffer and
2170invocations of this command. 2173displays it in some window, preferably not the window previously
2174selected. It then selects the displaying window. If that window is
2175on a different graphical frame, that frame is given input focus if
2176possible (@pxref{Input Focus}). The return value is the buffer that
2177was switched to.
2178
2179This function uses @code{display-buffer} to display the buffer, so all
2180the variables affecting @code{display-buffer} will affect it as well.
2181@xref{Choosing Window}.
2182
2183If @var{buffer-or-name} is @code{nil}, it defaults to the buffer
2184returned 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
2186buffer, this function creates a new buffer with that name; the new
2187buffer's major mode is determined by the variable @code{major-mode}
2188(@pxref{Major Modes}).
2189
2190If @var{action} is non-@code{nil}, it should be a display action to
2191pass to @code{display-buffer} (@pxref{Choosing Window}).
2192Alternatively, a non-@code{nil}, non-list value means to pop to a
2193window other than the selected one---even if the buffer is already
2194displayed in the selected window.
2195
2196Like @code{switch-to-buffer}, this function updates the buffer list
2197unless @var{norecord} is non-@code{nil}.
2198@end defun
2171 2199
2172The previous buffer is usually the buffer shown before the buffer 2200@node Choosing Window
2173currently shown in @var{window}. However, a buffer that has been buried 2201@section Choosing a Window for Display
2174or 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
2177If repeated invocations of this command have already shown all buffers 2203 The command @code{display-buffer} flexibly chooses a window for
2178previously shown in @var{window}, further invocations will show buffers 2204display, and displays a specified buffer in that window. It can be
2179from the global buffer list starting with the buffer returned by 2205called interactively, via the key binding @kbd{C-x 4 o}. It is also
2180@code{last-buffer} (@pxref{The Buffer List}). 2206used as a subroutine by many functions and commands, including
2181@end deffn 2207@code{switch-to-buffer} and @code{pop-to-buffer} (@pxref{Switching
2208Buffers}).
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
2214display in. These steps are described by means of @dfn{display
2215actions}, which have the form @code{(@var{function} . @var{alist})}.
2216Here, @var{function} is either a function or a list of functions,
2217which we refer to as @dfn{action functions}; @var{alist} is an
2218association list, which we refer to as @dfn{action alists}.
2219
2220 An action function accepts two arguments: the buffer to display and
2221an action alist. It attempts to display the buffer in some window,
2222picking or creating a window according to its own criteria. If
2223successful, it returns the window; otherwise, it returns @code{nil}.
2224@xref{Display Action Functions}, for a list of predefined action
2225functions.
2182 2226
2183The 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. 2228several sources, and calling the action functions in turn, until one
2229of them manages to display the buffer and returns a non-@code{nil}
2230value.
2185 2231
2186@deffn Command switch-to-next-buffer &optional window 2232@deffn Command display-buffer buffer-or-name &optional action frame
2187This functions switches to the next buffer in @var{window} thus undoing 2233This command makes @var{buffer-or-name} appear in some window, without
2188the effect of the last @code{switch-to-prev-buffer} command in 2234selecting 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
2190defaults to the selected one. 2236buffer. The return value is the window chosen to display the buffer.
2191 2237
2192If there is no recent invocation of a @code{switch-to-prev-buffer} that 2238The optional argument @var{action}, if non-@code{nil}, should normally
2193can be undone, @code{switch-to-next-buffer} will try to show the first 2239be a display action (described above). @code{display-buffer} builds a
2194buffer from the global buffer list as returned by @code{other-buffer} 2240list of action functions and an action alist, by consolidating display
2195(@pxref{The Buffer List}). 2241actions 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
2200much like @code{bury-buffer} and @code{unbury-buffer}. In contrast with 2245The variable @code{display-buffer-overriding-action}.
2201the latter, however, they may show a buffer even if it is already shown
2202in another window. Moreover, they try to restore the window specific
2203start and point positions of buffers which should handle viewing one and
2204the same buffer in multiple windows more easily.
2205 2246
2247@item
2248The user option @code{display-buffer-alist}.
2206 2249
2207@node Displaying Buffers 2250@item
2208@section Displaying Buffers in Windows 2251The @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
2213automatically and use it to display a specified buffer. These functions 2254The user option @code{display-buffer-base-action}.
2214can also split an existing window in certain circumstances. We also
2215describe variables that parameterize the heuristics used for choosing a
2216window.
2217@iftex
2218See the preceding section for
2219@end iftex
2220@ifnottex
2221@xref{Buffers and Windows}, for
2222@end ifnottex
2223low-level primitives that give you more precise control. All of these
2224functions work by calling @code{set-window-buffer}.
2225
2226 Do not use the functions in this section in order to make a buffer
2227current so that a Lisp program can access or modify it; they are too
2228drastic for that purpose, since they change the display of buffers in
2229windows, which would be gratuitous and surprise the user. Instead, use
2230@code{set-buffer} and @code{save-current-buffer} (@pxref{Current
2231Buffer}), which designate buffers as current for programmed access
2232without affecting the display of buffers in windows.
2233
2234@deffn Command switch-to-buffer buffer-or-name &optional norecord
2235This function makes @var{buffer-or-name} the current buffer, and also
2236displays the buffer in the selected window. This means that a human can
2237see the buffer and subsequent keyboard commands will apply to it.
2238Contrast this with @code{set-buffer}, which makes @var{buffer-or-name}
2239the current buffer but does not display it in the selected window;
2240see @ref{Current Buffer}.
2241
2242If @var{buffer-or-name} is @code{nil}, @code{switch-to-buffer} chooses a
2243buffer using @code{other-buffer}. If @var{buffer-or-name} is a string
2244that does not identify an existing buffer, then a new buffer by that
2245name is created. The major mode for the new buffer is set according to
2246the variable @code{major-mode}; see @ref{Auto Major Mode}.
2247
2248When the selected window is the minibuffer window or is strongly
2249dedicated to its buffer (@pxref{Dedicated Windows}), this function calls
2250@code{pop-to-buffer} (see below) to display the buffer in some other
2251window.
2252 2255
2253Normally 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 2257The constant @code{display-buffer-fallback-action}.
2255list). 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
2257List}.
2258 2259
2259The @code{switch-to-buffer} function is often used interactively, as 2260@noindent
2260the binding of @kbd{C-x b}. It is also used frequently in programs. It 2261Each action function is called in turn, passing the buffer as the
2261returns the buffer that it switched to. 2262first argument and the combined action alist as the second argument,
2263until one of the functions returns non-nil.
2264
2265The argument @var{action} can also have a non-@code{nil}, non-list
2266value. This has the special meaning that the buffer should be
2267displayed in a window other than the selected one, even if the
2268selected window is already displaying it. If called interactively
2269with a prefix argument, @var{action} is @code{t}.
2270
2271The optional argument @var{frame}, if non-@code{nil}, specifies which
2272frames to check when deciding whether the buffer is already displayed.
2273It is equivalent to adding an element @code{(reusable-frames
2274. @var{frame})} to the action alist of @var{action}. @xref{Display
2275Action Functions}.
2262@end deffn 2276@end deffn
2263 2277
2264The next two functions are similar to @code{switch-to-buffer}, except 2278@defvar display-buffer-overriding-action
2265for the described features. 2279The value of this variable should be a display action, which is
2266 2280treated with the highest priority by @code{display-buffer}. The
2267@deffn Command switch-to-buffer-other-window buffer-or-name &optional norecord 2281default value is empty, i.e. @code{(nil . nil)}.
2268This function makes the buffer specified by @var{buffer-or-name} current 2282@end defvar
2269and displays it in a window not currently selected, using the function
2270@code{pop-to-buffer} (see below).
2271 2283
2272The currently selected window is absolutely never used to do the job. 2284@defopt display-buffer-alist
2273If the selected window already displays @var{buffer-or-name}, then it 2285The value of this option is an alist mapping regular expressions to
2274continues to do so, but another window is nonetheless found to display 2286display actions. If the name of the buffer passed to
2275it 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
2277This function updates the buffer list just like @code{switch-to-buffer} 2291@defopt display-buffer-base-action
2278unless @var{norecord} is non-@code{nil}. 2292The value of this option should be a display action. This option can
2279@end deffn 2293be 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
2282This function makes @var{buffer-or-name} the current buffer and switches 2298This display action specifies the fallback behavior for
2283to it in some window, preferably not the window previously selected. 2299@code{display-buffer} if no other display actions are given.
2284The ``popped-to'' window becomes the selected window. Its frame is 2300@end defvr
2285given the X server's focus, if possible; see @ref{Input Focus}. The
2286return value is the buffer that was switched to.
2287
2288If @var{buffer-or-name} is @code{nil}, that means to choose some other
2289buffer, but you don't specify which. If @var{buffer-or-name} is a
2290string that does not name an existing buffer, a buffer by that name is
2291created. The major mode for the new buffer is set according to the
2292variable @code{major-mode}. @xref{Auto Major Mode}.
2293
2294If 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
2296window in any visible frame already displaying the buffer; if there is
2297one, 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
2299displays the buffer in it. Otherwise, @code{pop-to-buffer} operates
2300entirely within the selected frame. (If the selected frame has just a
2301minibuffer, @code{pop-to-buffer} operates within the most recently
2302selected frame that was not just a minibuffer.)
2303
2304If the variable @code{pop-up-windows} is non-@code{nil}, windows may be
2305split to create a new window that is different from the original window.
2306For details, see @ref{Choosing Window}.
2307
2308If @var{other-window} is non-@code{nil}, @code{pop-to-buffer} finds or
2309creates another window even if @var{buffer-or-name} is already visible
2310in the selected window. Thus @var{buffer-or-name} could end up
2311displayed in two windows. On the other hand, if @var{buffer-or-name} is
2312already displayed in the selected window and @var{other-window} is
2313@code{nil}, then the selected window is considered sufficient for
2314displaying @var{buffer-or-name}, so that nothing needs to be done.
2315
2316All the variables that affect @code{display-buffer} affect
2317@code{pop-to-buffer} as well. @xref{Choosing Window}.
2318
2319This function updates the buffer list just like @code{switch-to-buffer}
2320unless @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
2324This function replaces @var{buffer-or-name} in all windows displaying 2303@section Action Functions for @code{display-buffer}
2325it with some other buffer. It uses @code{other-buffer} to choose the
2326other buffer. In the usual applications of this function, you
2327don'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
2330The argument @var{buffer-or-name} may be a buffer or the name of an 2305The following basic action functions are defined in Emacs. Each of
2331existing buffer and defaults to the current buffer. 2306these functions takes two arguments: @var{buffer}, the buffer to
2307display, and @var{alist}, an action alist. Each action function
2308returns the window if it succeeds, and @code{nil} if it fails.
2332 2309
2333If 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, 2311This function tries to display @var{buffer} in the selected window.
2335that window is deleted. If that window is the only window on its frame 2312It fails if the selected window is a minibuffer window or is dedicated
2336and there are other frames left, the window's frame is deleted too. If 2313to another buffer (@pxref{Dedicated Windows}). It also fails if
2337there are no other frames left, some other buffer is displayed in that 2314@var{alist} has a non-nil @code{inhibit-same-window} entry.
2338window. 2315@end defun
2339 2316
2340This function returns @code{nil}. 2317@defun display-buffer-reuse-window buffer alist
2341@end deffn 2318This function tries to ``display'' @var{buffer} by finding a window
2319that is already displaying it.
2342 2320
2343@node Choosing Window 2321If @var{alist} has a non-@code{nil} @code{inhibit-same-window} entry,
2344@section Choosing a Window for Display 2322the selected window is not eligible for reuse.
2345 2323
2346 This section describes the basic facility that chooses a window to 2324If @var{alist} contains a @code{reusable-frames} entry, its value
2347display a buffer in---@code{display-buffer}. Higher-level functions and 2325determines which frames to search for a reusable window:
2348commands, like @code{switch-to-buffer} and @code{pop-to-buffer}, use this
2349subroutine. Here we describe how to use @code{display-buffer} and how
2350to customize it.
2351
2352@deffn Command display-buffer buffer-or-name &optional not-this-window frame
2353This command makes @var{buffer-or-name} appear in some window, but it
2354does 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
2356unaltered by this function. The argument @var{buffer-or-name} must be a
2357buffer or the name of an existing buffer.
2358
2359@var{not-this-window} non-@code{nil} means to display the specified
2360buffer in a window other than the selected one, even if it is already
2361displayed in the selected window. This can cause the buffer to appear
2362in two windows at once. Otherwise, if @var{buffer-or-name} is already
2363being displayed in any window, that is good enough, so this function
2364does nothing.
2365
2366@code{display-buffer} returns the window chosen to display
2367@var{buffer-or-name}.
2368
2369If the optional argument @var{frame} is non-@code{nil}, it specifies
2370which frames to check when deciding whether the buffer is already
2371displayed. If the buffer is already displayed in some window on one of
2372these frames, @code{display-buffer} simply returns that window. Here
2373are 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}:
2386A frame means consider windows on that frame only. 2338A frame means consider windows on that frame only.
2387@end itemize 2339@end itemize
2388 2340
2389Precisely how @code{display-buffer} finds or creates a window depends on 2341If @var{alist} contains no @code{reusable-frames} entry, this function
2390the variables described below. 2342normally searches just the selected frame; however, if either the
2391@end deffn 2343variable @code{display-buffer-reuse-frames} or the variable
2344@code{pop-up-frames} is non-@code{nil}, it searches all frames on the
2345current terminal. @xref{Choosing Window Options}.
2346@end defun
2347
2348@defun display-buffer-pop-up-frame buffer alist
2349This function creates a new frame, and displays the buffer in that
2350frame's window.
2351@end defun
2352
2353@defun display-buffer-pop-up-window buffer alist
2354This function tries to display @var{buffer} by splitting the selected
2355window. 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
2360This function tries to display @var{buffer} by choosing an existing
2361window and displaying the buffer in that window. It can fail if all
2362windows 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
2368The behavior of the standard display actions of @code{display-buffer}
2369(@pxref{Choosing Window}) can be modified by a variety of user
2370options.
2392 2371
2393@defopt display-buffer-reuse-frames 2372@defopt display-buffer-reuse-frames
2394If this variable is non-@code{nil}, @code{display-buffer} searches 2373If 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,
2652resort, it will try to display @var{buffer-or-name} on a separate frame. 2631resort, it will try to display @var{buffer-or-name} on a separate frame.
2653In that case, the value of @code{pop-up-frames} is disregarded. 2632In 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
2639Each window remembers the buffers it has displayed earlier and the order
2640in which these buffers have been removed from it. This history is used,
2641for example, by @code{replace-buffer-in-windows} (@pxref{Buffers and
2642Windows}). This list is automatically maintained by Emacs, but you can
2643use the following functions to explicitly inspect or alter it:
2644
2645@defun window-prev-buffers &optional window
2646This function returns a list specifying the previous contents of
2647@var{window}, which should be a live window and defaults to the
2648selected window.
2649
2650Each list element has the form @code{(@var{buffer} @var{window-start}
2651@var{window-pos})}, where @var{buffer} is a buffer previously shown in
2652the window, @var{window-start} is the window start position when that
2653buffer was last shown, and @var{window-pos} is the point position when
2654that buffer was last shown.
2655
2656The list is ordered so that earlier elements correspond to more
2657recently-shown buffers, and the first element usually corresponds to the
2658buffer most recently removed from the window.
2659@end defun
2660
2661@defun set-window-prev-buffers window prev-buffers
2662This function sets @var{window}'s previous buffers to the value of
2663@var{prev-buffers}. The argument @var{window} must be a live window
2664and defaults to the selected one. The argument @var{prev-buffers}
2665should be a list of the same form as that returned by
2666@code{window-prev-buffers}.
2667@end defun
2668
2669In addition, each buffer maintains a list of @dfn{next buffers}, which
2670is a list of buffers re-shown by @code{switch-to-prev-buffer} (see
2671below). 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
2675This function returns the list of buffers recently re-shown in
2676@var{window} via @code{switch-to-prev-buffer}. The @var{window}
2677argument must denote a live window or @code{nil} (meaning the selected
2678window).
2679@end defun
2680
2681@defun set-window-next-buffers window next-buffers
2682This function sets the next buffer list of @var{window} to
2683@var{next-buffers}. The @var{window} argument should be a live window
2684or @code{nil} (meaning the selected window). The argument
2685@var{next-buffers} should be a list of buffers.
2686@end defun
2687
2688The following commands can be used to cycle through the global buffer
2689list, much like @code{bury-buffer} and @code{unbury-buffer}. However,
2690they cycle according to the specified window's history list, rather
2691than the global buffer list. In addition, they restore
2692window-specific window start and point positions, and may show a
2693buffer 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
2699This command displays the previous buffer in @var{window}. The
2700argument @var{window} should be a live window or @code{nil} (meaning
2701the selected window). If the optional argument @var{bury-or-kill} is
2702non-@code{nil}, this means that the buffer currently shown in
2703@var{window} is about to be buried or killed and consequently shall
2704not be switched to in future invocations of this command.
2705
2706The previous buffer is usually the buffer shown before the buffer
2707currently shown in @var{window}. However, a buffer that has been buried
2708or killed or has been already shown by a recent invocation of
2709@code{switch-to-prev-buffer} does not qualify as previous buffer.
2710
2711If repeated invocations of this command have already shown all buffers
2712previously shown in @var{window}, further invocations will show buffers
2713from the buffer list of the frame @var{window} appears on (@pxref{The
2714Buffer List}).
2715@end deffn
2716
2717@deffn Command switch-to-next-buffer &optional window
2718This command switches to the next buffer in @var{window} thus undoing
2719the effect of the last @code{switch-to-prev-buffer} command in
2720@var{window}. The argument @var{window} must be a live window and
2721defaults to the selected one.
2722
2723If there is no recent invocation of a @code{switch-to-prev-buffer} that
2724can be undone, this function tries to show a buffer from the buffer list
2725of 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
2667slightly different, see below. 2741slightly different, see below.
2668 2742
2669When @code{delete-windows-on} (@pxref{Deleting Windows}) wants to delete 2743When @code{delete-windows-on} (@pxref{Deleting Windows}) wants to
2670a dedicated window and that window is the only window on its frame, it 2744delete a dedicated window and that window is the only window on its
2671deletes the window's frame too, provided there are other frames left. 2745frame, it deletes the window's frame too, provided there are other
2672@code{replace-buffer-in-windows} (@pxref{Displaying Buffers}) tries to 2746frames left. @code{replace-buffer-in-windows} (@pxref{Switching
2673delete all dedicated windows showing its buffer argument. When such a 2747Buffers}) tries to delete all dedicated windows showing its buffer
2674window is the only window on its frame, that frame is deleted, provided 2748argument. When such a window is the only window on its frame, that
2675there are other frames left. If there are no more frames left, some 2749frame is deleted, provided there are other frames left. If there are
2676other buffer is displayed in the window, and the window is marked as 2750no more frames left, some other buffer is displayed in the window, and
2677non-dedicated. 2751the window is marked as non-dedicated.
2678 2752
2679When you kill a buffer (@pxref{Killing Buffers}) displayed in a 2753When you kill a buffer (@pxref{Killing Buffers}) displayed in a
2680dedicated window, any such window usually gets deleted too, since 2754dedicated window, any such window usually gets deleted too, since
@@ -2705,6 +2779,59 @@ display. Other functions do not treat @code{t} differently from any
2705non-@code{nil} value. 2779non-@code{nil} value.
2706@end defun 2780@end defun
2707 2781
2782
2783@node Quitting Windows
2784@section Quitting Windows
2785
2786When you want to get rid of a window used for displaying a buffer you
2787can use the function @code{delete-window} (@pxref{Deleting Windows}) to
2788remove that window from its frame. If the buffer has been shown on a
2789separate frame, you might want to call @code{delete-frame}
2790(@pxref{Deleting Frames}) instead. If, on the other hand, a window has
2791been reused for displaying the buffer, you might prefer showing the
2792buffer previously shown in that window by calling the function
2793@code{switch-to-prev-buffer} (@pxref{Window History}). Finally, you
2794might 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
2798displaying the buffer was obtained in the first place thus attempting to
2799automatize the above decisions for you.
2800
2801@deffn Command quit-window &optional kill window
2802This command quits @var{window} and buries its buffer. The argument
2803@var{window} must be a live window and defaults to the selected one.
2804With prefix argument @var{kill} non-@code{nil}, it kills the buffer
2805instead of burying it.
2806
2807Quitting @var{window} means to proceed as follows: If @var{window} was
2808created specially for displaying its current buffer, delete @var{window}
2809provided its frame contains at least one other live window. If
2810@var{window} is the only window on its frame and other frames still
2811exist, delete the frame together with @var{window}. If, however, there
2812are no other frames left, display some other buffer in @var{window}.
2813
2814If @var{window} was reused for displaying its buffer, this command tries
2815to display the buffer previously shown in it. It also tries to restore
2816the window start (@pxref{Window Start and End}) and point (@pxref{Window
2817Point}) positions of the previously shown buffer. If, in addition, the
2818current buffer was temporarily resized, this command will also try to
2819restore the original height of @var{window}.
2820
2821The three cases described so far require that the buffer shown in
2822@var{window} is still the buffer displayed by the last buffer display
2823function for this window. If another buffer has been shown in the
2824meantime or the buffer previously shown no longer exists, this command
2825calls @code{switch-to-prev-buffer} (@pxref{Window History}) to show some
2826other buffer instead.
2827@end deffn
2828
2829The function @code{quit-window} bases its decisions on information
2830stored in @var{window}'s @code{quit-restore} window parameter
2831(@pxref{Window Parameters}) and resets that parameter to @code{nil}
2832after 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 3581A @dfn{window configuration} records the entire layout of one
3455frame---all windows, their sizes, which buffers they contain, how those 3582frame---all windows, their sizes, which buffers they contain, how those
3456buffers are scrolled, and their values of point and the mark; also their 3583buffers are scrolled, and their values of point and the mark; also their
3457fringes, margins, and scroll bar settings. It also includes the value 3584fringes, margins, and scroll bar settings. It also includes the value
3458of @code{minibuffer-scroll-window}. As a special exception, the window 3585of @code{minibuffer-scroll-window}. As a special exception, the window
3459configuration does not record the value of point in the selected window 3586configuration does not record the value of point in the selected window
3460for the current buffer. Also, the window configuration does not record 3587for the current buffer.
3461the 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
3464saved window configuration. If you want to record the layout of all 3590saved 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
3568file @file{winner.el} for some more operations on windows 3694file @file{winner.el} for some more operations on windows
3569configurations. 3695configurations.
3570 3696
3697 The objects returned by @code{current-window-configuration} die
3698together with the Emacs process. In order to store a window
3699configuration on disk and read it back in another Emacs session the
3700following two functions can be used.
3701
3702@defun window-state-get &optional window markers
3703This function returns the state of @var{window} as a Lisp object. The
3704argument @var{window} can be any window and defaults to the root window
3705of the selected frame.
3706
3707The optional argument @var{markers} non-@code{nil} means to use markers
3708for sampling positions like @code{window-point} or @code{window-start}.
3709This argument should be non-@code{nil} only if the value is used for
3710putting the state back in the same session since markers slow down
3711processing.
3712@end defun
3713
3714The value returned by @code{window-state-get} can be converted by using
3715one of the functions defined by Desktop Save Mode (@pxref{Desktop Save
3716Mode}) to an object that can be written to a file. Such objects can be
3717read back and converted to a Lisp object representing the state of the
3718window. That Lisp object can be used as argument for the following
3719function in order to restore the state window in another window.
3720
3721@defun window-state-put state &optional window ignore
3722This function puts the window state @var{state} into @var{window}. The
3723argument @var{state} should be the state of a window returned by an
3724earlier invocation of @code{window-state-get}, see above. The optional
3725argument @var{window} must specify a live window and defaults to the
3726selected one.
3727
3728The optional argument @var{ignore} non-@code{nil} means to ignore
3729minimum window sizes and fixed size restrictions. If @var{ignore}
3730equals @code{safe}, this means subwindows can get as small as one line
3731and/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
3575This sections describes how window parameters can be used to associate 3739This section describes how window parameters can be used to associate
3576additional information with windows. 3740additional information with windows.
3577 3741
3578@defun window-parameter window parameter 3742@defun window-parameter window parameter
3579This function returns @var{window}'s value for @var{parameter}. The 3743This function returns @var{window}'s value for @var{parameter}. The
3580default for @var{window} is the selected window. If @var{window} 3744default for @var{window} is the selected window. If @var{window} has no
3581has no setting for @var{parameter}, this function returns @code{nil}. 3745setting 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
3585This function returns all parameters of @var{window} and their values. 3749This function returns all parameters of @var{window} and their values.
3586The default for @var{window} is the selected window. The return value 3750The default for @var{window} is the selected window. The return value,
3587is an association list of elements of the form @code{(@var{parameter} 3751if 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
3594is the selected window. 3758is the selected window.
3595@end defun 3759@end defun
3596 3760
3597Currently, window parameters are not saved in window configurations and 3761Some functions, notably @code{delete-window},
3598consequently not restored by @code{set-window-configuration}. Hence, 3762@code{delete-other-windows} and @code{split-window} may behave specially
3599any change of a parameter introduced via @code{set-window-parameter} can 3763when their @var{window} argument has a parameter set. You can override
3600be undone only by invoking @code{set-window-parameter} for the same 3764such special behavior by binding the following variable to a
3601parameter again. Since @code{save-window-excursion} relies on window 3765non-@code{nil} value:
3602configurations (@pxref{Window Configurations}), window parameters are 3766
3603not saved and restored by that special form, either. 3767@defvar ignore-window-parameters
3768If this variable is non-@code{nil}, some standard functions do not
3769process window parameters. The functions currently affected by this are
3770@code{split-window}, @code{delete-window}, @code{delete-other-windows}
3771and @code{other-window}.
3772
3773An application can bind this variable to a non-@code{nil} value around
3774calls to these functions. If it does so, the application is fully
3775responsible for correctly assigning the parameters of all involved
3776windows when exiting that function.
3777@end defvar
3778
3779The following parameters are currently used by the window management
3780code.
3781
3782@table @asis
3783@item @code{delete-window}
3784This parameter affects the execution of @code{delete-window}
3785(@pxref{Deleting Windows}).
3786
3787@item @code{delete-other-windows}
3788This parameter affects the execution of @code{delete-other-windows}
3789(@pxref{Deleting Windows}).
3790
3791@item @code{split-window}
3792This parameter affects the execution of @code{split-window}
3793(@pxref{Splitting Windows}).
3794
3795@item @code{other-window}
3796This parameter affects the execution of @code{other-window}
3797(@pxref{Cyclic Window Ordering}).
3798
3799@item @code{no-other-window}
3800This parameter marks the window as not selectable by @code{other-window}
3801(@pxref{Cyclic Window Ordering}).
3802@end table
3803
3804In addition, the parameters @code{window-atom} and @code{window-side}
3805are reserved and should not be used by applications. The
3806@code{quit-restore} parameter tells how to proceed with a window when
3807the buffer it shows is no more needed. This parameter is installed by
3808the buffer display functions (@pxref{Choosing Window}) and consulted by
3809the 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