aboutsummaryrefslogtreecommitdiffstats
path: root/doc/lispref
diff options
context:
space:
mode:
authorEli Zaretskii2012-11-13 16:17:18 +0200
committerEli Zaretskii2012-11-13 16:17:18 +0200
commit3c4ca7155293ffc2d04708007131bcbc882d8913 (patch)
tree61787be8cd43b6fb3d5159852fbd186eea404de7 /doc/lispref
parent5ade42a5114255c43117065494b96d480c1e1588 (diff)
parentc708524567662c8911c5ab2695acc7bda0383705 (diff)
downloademacs-3c4ca7155293ffc2d04708007131bcbc882d8913.tar.gz
emacs-3c4ca7155293ffc2d04708007131bcbc882d8913.zip
Merge from trunk.
Diffstat (limited to 'doc/lispref')
-rw-r--r--doc/lispref/ChangeLog82
-rw-r--r--doc/lispref/control.texi13
-rw-r--r--doc/lispref/debugging.texi29
-rw-r--r--doc/lispref/edebug.texi4
-rw-r--r--doc/lispref/elisp.texi7
-rw-r--r--doc/lispref/errors.texi3
-rw-r--r--doc/lispref/frames.texi14
-rw-r--r--doc/lispref/lists.texi44
-rw-r--r--doc/lispref/objects.texi146
-rw-r--r--doc/lispref/os.texi49
-rw-r--r--doc/lispref/searching.texi27
-rw-r--r--doc/lispref/variables.texi123
-rw-r--r--doc/lispref/windows.texi755
13 files changed, 921 insertions, 375 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index da3cc91a675..6d6ddf4da9a 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,85 @@
12012-11-13 Glenn Morris <rgm@gnu.org>
2
3 * variables.texi (Adding Generalized Variables):
4 At least mention gv-define-expander and gv-letplace.
5
6 * debugging.texi (Error Debugging): Mention debug-on-message.
7 (Using Debugger): Mention debugger-bury-or-kill.
8
9 * control.texi (Signaling Errors):
10 * debugging.texi (Error Debugging):
11 * errors.texi (Standard Errors): Add user-error.
12
13 * variables.texi (Adding Generalized Variables):
14 Use standard formatting for common lisp note about setf functions.
15
162012-11-10 Martin Rudalics <rudalics@gmx.at>
17
18 * elisp.texi (Top): Add Recombining Windows to menu.
19 * windows.texi (Recombining Windows): New subsection.
20 (Splitting Windows): Rewrite text on handling of window
21 combinations and move it to new subsection.
22
232012-11-10 Chong Yidong <cyd@gnu.org>
24
25 * searching.texi (Replacing Match): Document \? in replace-match.
26
27 * variables.texi (Creating Buffer-Local): Document setq-local and
28 defvar-local.
29 (Setting Generalized Variables): Arrange table alphabetically.
30
31 * lists.texi (List Elements, List Variables): Clarify descriptions
32 of push and pop for generalized variables.
33
34 * edebug.texi (Specification List): setf is no longer CL-only.
35
362012-11-10 Glenn Morris <rgm@gnu.org>
37
38 * variables.texi (Adding Generalized Variables):
39 Update description of FIX-RETURN expansion.
40
41 * variables.texi (Setting Generalized Variables):
42 Split most of previous contents into this subsection.
43 (Adding Generalized Variables): New subsection.
44 Move note on lack of setf functions here from misc/cl.texi.
45
46 * elisp.texi: Add Generalized Variables subsections to detailed menu.
47
482012-11-10 Chong Yidong <cyd@gnu.org>
49
50 * frames.texi (Initial Parameters): Doc fix (Bug#12144).
51
522012-11-08 Michael Albinus <michael.albinus@gmx.de>
53
54 * os.texi (Notifications): Update descriptions of
55 notifications-notify, notifications-close-notification and
56 notifications-get-capabilities according to latest code changes.
57 Add notifications-get-server-information.
58
592012-11-03 Chong Yidong <cyd@gnu.org>
60
61 * objects.texi (General Escape Syntax): Clarify the explanation of
62 escape sequences.
63 (Non-ASCII in Strings): Clarify when a string is unibyte vs
64 multibyte. Hex escapes do not automatically make a string
65 multibyte.
66
672012-11-03 Martin Rudalics <rudalics@gmx.at>
68
69 * windows.texi (Switching Buffers): Document option
70 switch-to-buffer-preserve-window-point.
71 (Display Action Functions): Document window-height and
72 window-width alist entries.
73 (Display Action Functions): Document
74 display-buffer-below-selected and
75 display-buffer-in-previous-window.
76 (Quitting Windows): Document quit-restore-window. Rewrite
77 section.
78 (Window Configurations): In window-state-get mention that
79 argument window must be valid.
80 (Window Parameters): Document quit-restore window parameter
81 (Bug#12158).
82
12012-10-31 Glenn Morris <rgm@gnu.org> 832012-10-31 Glenn Morris <rgm@gnu.org>
2 84
3 * control.texi (Catch and Throw): Add xref to cl.texi. 85 * control.texi (Catch and Throw): Add xref to cl.texi.
diff --git a/doc/lispref/control.texi b/doc/lispref/control.texi
index cf393b59c49..489e5cc5b22 100644
--- a/doc/lispref/control.texi
+++ b/doc/lispref/control.texi
@@ -824,6 +824,19 @@ The function @code{signal} never returns.
824@end example 824@end example
825@end defun 825@end defun
826 826
827@cindex user errors, signaling
828@defun user-error format-string &rest args
829This function behaves exactly like @code{error}, except that it uses
830the error symbol @code{user-error} rather than @code{error}. As the
831name suggests, this is intended to report errors on the part of the
832user, rather than errors in the code itself. For example,
833if you try to use the command @code{Info-history-back} (@kbd{l}) to
834move back beyond the start of your Info browsing history, Emacs
835signals a @code{user-error}. Such errors do not cause entry to the
836debugger, even when @code{debug-on-error} is non-@code{nil}.
837@xref{Error Debugging}.
838@end defun
839
827@cindex CL note---no continuable errors 840@cindex CL note---no continuable errors
828@quotation 841@quotation
829@b{Common Lisp note:} Emacs Lisp has nothing like the Common Lisp 842@b{Common Lisp note:} Emacs Lisp has nothing like the Common Lisp
diff --git a/doc/lispref/debugging.texi b/doc/lispref/debugging.texi
index 2226db942d1..11532b19781 100644
--- a/doc/lispref/debugging.texi
+++ b/doc/lispref/debugging.texi
@@ -117,12 +117,12 @@ has any of those condition symbols, or if the error message matches
117any of the regular expressions, then that error does not enter the 117any of the regular expressions, then that error does not enter the
118debugger. 118debugger.
119 119
120The normal value of this variable lists several errors that happen 120The normal value of this variable includes @code{user-error}, as well
121often during editing but rarely result from bugs in Lisp programs. 121as several errors that happen often during editing but rarely result
122However, ``rarely'' is not ``never''; if your program fails with an 122from bugs in Lisp programs. However, ``rarely'' is not ``never''; if
123error that matches this list, you may try changing this list to debug 123your program fails with an error that matches this list, you may try
124the error. The easiest way is usually to set 124changing this list to debug the error. The easiest way is usually to
125@code{debug-ignored-errors} to @code{nil}. 125set @code{debug-ignored-errors} to @code{nil}.
126@end defopt 126@end defopt
127 127
128@defopt eval-expression-debug-on-error 128@defopt eval-expression-debug-on-error
@@ -163,6 +163,14 @@ supported values correspond to the signals @code{SIGUSR1} and
163@code{inhibit-quit} is set and Emacs is not otherwise responding. 163@code{inhibit-quit} is set and Emacs is not otherwise responding.
164@end defopt 164@end defopt
165 165
166@cindex message, finding what causes a particular message
167@defvar debug-on-message
168If you set @code{debug-on-message} to a regular expression,
169Emacs will enter the debugger if it displays a matching message in the
170echo area. For example, this can be useful when trying to find the
171cause of a particular message.
172@end defvar
173
166 To debug an error that happens during loading of the init 174 To debug an error that happens during loading of the init
167file, use the option @samp{--debug-init}. This binds 175file, use the option @samp{--debug-init}. This binds
168@code{debug-on-error} to @code{t} while loading the init file, and 176@code{debug-on-error} to @code{t} while loading the init file, and
@@ -314,6 +322,7 @@ is a message describing the reason that the debugger was invoked (such
314as the error message and associated data, if it was invoked due to an 322as the error message and associated data, if it was invoked due to an
315error). 323error).
316 324
325@vindex debugger-bury-or-kill
317 The backtrace buffer is read-only and uses a special major mode, 326 The backtrace buffer is read-only and uses a special major mode,
318Debugger mode, in which letters are defined as debugger commands. The 327Debugger mode, in which letters are defined as debugger commands. The
319usual Emacs editing commands are available; thus, you can switch windows 328usual Emacs editing commands are available; thus, you can switch windows
@@ -322,8 +331,12 @@ switch buffers, visit files, or do any other sort of editing. However,
322the debugger is a recursive editing level (@pxref{Recursive Editing}) 331the debugger is a recursive editing level (@pxref{Recursive Editing})
323and it is wise to go back to the backtrace buffer and exit the debugger 332and it is wise to go back to the backtrace buffer and exit the debugger
324(with the @kbd{q} command) when you are finished with it. Exiting 333(with the @kbd{q} command) when you are finished with it. Exiting
325the debugger gets out of the recursive edit and kills the backtrace 334the debugger gets out of the recursive edit and buries the backtrace
326buffer. 335buffer. (You can customize what the @kbd{q} command does with the
336backtrace buffer by setting the variable @code{debugger-bury-or-kill}.
337For example, set it to @code{kill} if you prefer to kill the buffer
338rather than bury it. Consult the variable's documentation for more
339possibilities.)
327 340
328 When the debugger has been entered, the @code{debug-on-error} 341 When the debugger has been entered, the @code{debug-on-error}
329variable is temporarily set according to 342variable is temporarily set according to
diff --git a/doc/lispref/edebug.texi b/doc/lispref/edebug.texi
index 0211f9e1b9c..b5edda06bad 100644
--- a/doc/lispref/edebug.texi
+++ b/doc/lispref/edebug.texi
@@ -1211,9 +1211,7 @@ A single unevaluated Lisp object, which is not instrumented.
1211A single evaluated expression, which is instrumented. 1211A single evaluated expression, which is instrumented.
1212 1212
1213@item place 1213@item place
1214@c I can't see that this index entry is useful without any explanation. 1214A generalized variable. @xref{Generalized Variables}.
1215@c @findex edebug-unwrap
1216A place to store a value, as in the Common Lisp @code{setf} construct.
1217 1215
1218@item body 1216@item body
1219Short for @code{&rest form}. See @code{&rest} below. 1217Short for @code{&rest form}. See @code{&rest} below.
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi
index 06a2ebfcaf8..a70558bf09f 100644
--- a/doc/lispref/elisp.texi
+++ b/doc/lispref/elisp.texi
@@ -502,6 +502,11 @@ Buffer-Local Variables
502* Default Value:: The default value is seen in buffers 502* Default Value:: The default value is seen in buffers
503 that don't have their own buffer-local values. 503 that don't have their own buffer-local values.
504 504
505Generalized Variables
506
507* Setting Generalized Variables:: The @code{setf} macro.
508* Adding Generalized Variables:: Defining new @code{setf} forms.
509
505Functions 510Functions
506 511
507* What Is a Function:: Lisp functions vs. primitives; terminology. 512* What Is a Function:: Lisp functions vs. primitives; terminology.
@@ -996,6 +1001,8 @@ Windows
996* Resizing Windows:: Changing the sizes of windows. 1001* Resizing Windows:: Changing the sizes of windows.
997* Splitting Windows:: Splitting one window into two windows. 1002* Splitting Windows:: Splitting one window into two windows.
998* Deleting Windows:: Deleting a window gives its space to other windows. 1003* Deleting Windows:: Deleting a window gives its space to other windows.
1004* Recombining Windows:: Preserving the frame layout when splitting and
1005 deleting windows.
999* Selecting Windows:: The selected window is the one that you edit in. 1006* Selecting Windows:: The selected window is the one that you edit in.
1000* Cyclic Window Ordering:: Moving around the existing windows. 1007* Cyclic Window Ordering:: Moving around the existing windows.
1001* Buffers and Windows:: Each window displays the contents of a buffer. 1008* Buffers and Windows:: Each window displays the contents of a buffer.
diff --git a/doc/lispref/errors.texi b/doc/lispref/errors.texi
index a57f74d6c86..b92fd9ed665 100644
--- a/doc/lispref/errors.texi
+++ b/doc/lispref/errors.texi
@@ -172,6 +172,9 @@ The message is @samp{Text is read-only}. This is a subcategory of
172@item undefined-color 172@item undefined-color
173The message is @samp{Undefined color}. @xref{Color Names}. 173The message is @samp{Undefined color}. @xref{Color Names}.
174 174
175@item user-error
176The message is the empty string. @xref{Signaling Errors}.
177
175@item void-function 178@item void-function
176The message is @samp{Symbol's function definition is void}. 179The message is @samp{Symbol's function definition is void}.
177@xref{Function Cells}. 180@xref{Function Cells}.
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
index f58d62675e5..27d55c4fdb9 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -419,16 +419,16 @@ the initial frame, specify the same parameters in
419@code{initial-frame-alist} with values that match the X resources. 419@code{initial-frame-alist} with values that match the X resources.
420@end defopt 420@end defopt
421 421
422If these parameters specify a separate @dfn{minibuffer-only frame} with
423@code{(minibuffer . nil)}, and you have not created one, Emacs creates
424one for you.
425
426@cindex minibuffer-only frame 422@cindex minibuffer-only frame
423If these parameters include @code{(minibuffer . nil)}, that indicates
424that the initial frame should have no minibuffer. In this case, Emacs
425creates a separate @dfn{minibuffer-only frame} as well.
426
427@defopt minibuffer-frame-alist 427@defopt minibuffer-frame-alist
428This variable's value is an alist of parameter values used when 428This variable's value is an alist of parameter values used when
429creating an initial minibuffer-only frame. This is the 429creating an initial minibuffer-only frame (i.e.@: the minibuffer-only
430minibuffer-only frame that Emacs creates if @code{initial-frame-alist} 430frame that Emacs creates if @code{initial-frame-alist} specifies a
431specifies a frame with no minibuffer. 431frame with no minibuffer).
432@end defopt 432@end defopt
433 433
434@defopt default-frame-alist 434@defopt default-frame-alist
diff --git a/doc/lispref/lists.texi b/doc/lispref/lists.texi
index 458db838177..40e8d08f72c 100644
--- a/doc/lispref/lists.texi
+++ b/doc/lispref/lists.texi
@@ -234,17 +234,15 @@ This is in contrast to @code{cdr}, which signals an error if
234@end defun 234@end defun
235 235
236@defmac pop listname 236@defmac pop listname
237This macro is a way of examining the @sc{car} of a list, 237This macro provides a convenient way to examine the @sc{car} of a
238and taking it off the list, all at once. 238list, and take it off the list, all at once. It operates on the list
239@c FIXME I don't think is a particularly good way to do it, 239stored in @var{listname}. It removes the first element from the list,
240@c but generalized variables have not been introduced yet. 240saves the @sc{cdr} into @var{listname}, then returns the removed
241(In fact, this macro can act on generalized variables, not just lists. 241element.
242@xref{Generalized Variables}.) 242
243 243In the simplest case, @var{listname} is an unquoted symbol naming a
244It operates on the list which is stored in the symbol @var{listname}. 244list; in that case, this macro is equivalent to @w{@code{(prog1
245It removes this element from the list by setting @var{listname} 245(car listname) (setq listname (cdr listname)))}}.
246to the @sc{cdr} of its old value---but it also returns the @sc{car}
247of that list, which is the element being removed.
248 246
249@example 247@example
250x 248x
@@ -255,7 +253,10 @@ x
255 @result{} (b c) 253 @result{} (b c)
256@end example 254@end example
257 255
258@noindent 256More generally, @var{listname} can be a generalized variable. In that
257case, this macro saves into @var{listname} using @code{setf}.
258@xref{Generalized Variables}.
259
259For the @code{push} macro, which adds an element to a list, 260For the @code{push} macro, which adds an element to a list,
260@xref{List Variables}. 261@xref{List Variables}.
261@end defmac 262@end defmac
@@ -683,13 +684,12 @@ Some examples:
683 These functions, and one macro, provide convenient ways 684 These functions, and one macro, provide convenient ways
684to modify a list which is stored in a variable. 685to modify a list which is stored in a variable.
685 686
686@defmac push newelt listname 687@defmac push element listname
687This macro provides an alternative way to write 688This macro creates a new list whose @sc{car} is @var{element} and
688@code{(setq @var{listname} (cons @var{newelt} @var{listname}))}. 689whose @sc{cdr} is the list specified by @var{listname}, and saves that
689@c FIXME I don't think is a particularly good way to do it, 690list in @var{listname}. In the simplest case, @var{listname} is an
690@c but generalized variables have not been introduced yet. 691unquoted symbol naming a list, and this macro is equivalent
691(In fact, this macro can act on generalized variables, not just lists. 692to @w{@code{(setq @var{listname} (cons @var{element} @var{listname}))}}.
692@xref{Generalized Variables}.)
693 693
694@example 694@example
695(setq l '(a b)) 695(setq l '(a b))
@@ -700,7 +700,11 @@ l
700 @result{} (c a b) 700 @result{} (c a b)
701@end example 701@end example
702 702
703@noindent 703More generally, @code{listname} can be a generalized variable. In
704that case, this macro does the equivalent of @w{@code{(setf
705@var{listname} (cons @var{element} @var{listname}))}}.
706@xref{Generalized Variables}.
707
704For the @code{pop} macro, which removes the first element from a list, 708For the @code{pop} macro, which removes the first element from a list,
705@xref{List Elements}. 709@xref{List Elements}.
706@end defmac 710@end defmac
diff --git a/doc/lispref/objects.texi b/doc/lispref/objects.texi
index 7d40f0ff934..6933ffe492a 100644
--- a/doc/lispref/objects.texi
+++ b/doc/lispref/objects.texi
@@ -351,51 +351,48 @@ following text.)
351control characters, Emacs provides several types of escape syntax that 351control characters, Emacs provides several types of escape syntax that
352you can use to specify non-@acronym{ASCII} text characters. 352you can use to specify non-@acronym{ASCII} text characters.
353 353
354@cindex unicode character escape
355 You can specify characters by their Unicode values.
356@code{?\u@var{nnnn}} represents a character that maps to the Unicode
357code point @samp{U+@var{nnnn}} (by convention, Unicode code points are
358given in hexadecimal). There is a slightly different syntax for
359specifying characters with code points higher than
360@code{U+@var{ffff}}: @code{\U00@var{nnnnnn}} represents the character
361whose code point is @samp{U+@var{nnnnnn}}. The Unicode Standard only
362defines code points up to @samp{U+@var{10ffff}}, so if you specify a
363code point higher than that, Emacs signals an error.
364
365 This peculiar and inconvenient syntax was adopted for compatibility
366with other programming languages. Unlike some other languages, Emacs
367Lisp supports this syntax only in character literals and strings.
368
369@cindex @samp{\} in character constant 354@cindex @samp{\} in character constant
370@cindex backslash in character constants 355@cindex backslash in character constants
371@cindex octal character code 356@cindex unicode character escape
372 The most general read syntax for a character represents the 357 Firstly, you can specify characters by their Unicode values.
373character code in either octal or hex. To use octal, write a question 358@code{?\u@var{nnnn}} represents a character with Unicode code point
374mark followed by a backslash and the octal character code (up to three 359@samp{U+@var{nnnn}}, where @var{nnnn} is (by convention) a hexadecimal
375octal digits); thus, @samp{?\101} for the character @kbd{A}, 360number with exactly four digits. The backslash indicates that the
376@samp{?\001} for the character @kbd{C-a}, and @code{?\002} for the 361subsequent characters form an escape sequence, and the @samp{u}
377character @kbd{C-b}. Although this syntax can represent any 362specifies a Unicode escape sequence.
378@acronym{ASCII} character, it is preferred only when the precise octal 363
379value is more important than the @acronym{ASCII} representation. 364 There is a slightly different syntax for specifying Unicode
380 365characters with code points higher than @code{U+@var{ffff}}:
381@example 366@code{?\U00@var{nnnnnn}} represents the character with code point
382@group 367@samp{U+@var{nnnnnn}}, where @var{nnnnnn} is a six-digit hexadecimal
383?\012 @result{} 10 ?\n @result{} 10 ?\C-j @result{} 10 368number. The Unicode Standard only defines code points up to
384?\101 @result{} 65 ?A @result{} 65 369@samp{U+@var{10ffff}}, so if you specify a code point higher than
385@end group 370that, Emacs signals an error.
386@end example 371
387 372 Secondly, you can specify characters by their hexadecimal character
388 To use hex, write a question mark followed by a backslash, @samp{x}, 373codes. A hexadecimal escape sequence consists of a backslash,
389and the hexadecimal character code. You can use any number of hex 374@samp{x}, and the hexadecimal character code. Thus, @samp{?\x41} is
390digits, so you can represent any character code in this way. 375the character @kbd{A}, @samp{?\x1} is the character @kbd{C-a}, and
391Thus, @samp{?\x41} for the character @kbd{A}, @samp{?\x1} for the 376@code{?\xe0} is the character
392character @kbd{C-a}, and @code{?\xe0} for the Latin-1 character
393@iftex 377@iftex
394@samp{@`a}. 378@samp{@`a}.
395@end iftex 379@end iftex
396@ifnottex 380@ifnottex
397@samp{a} with grave accent. 381@samp{a} with grave accent.
398@end ifnottex 382@end ifnottex
383You can use any number of hex digits, so you can represent any
384character code in this way.
385
386@cindex octal character code
387 Thirdly, you can specify characters by their character code in
388octal. An octal escape sequence consists of a backslash followed by
389up to three octal digits; thus, @samp{?\101} for the character
390@kbd{A}, @samp{?\001} for the character @kbd{C-a}, and @code{?\002}
391for the character @kbd{C-b}. Only characters up to octal code 777 can
392be specified this way.
393
394 These escape sequences may also be used in strings. @xref{Non-ASCII
395in Strings}.
399 396
400@node Ctl-Char Syntax 397@node Ctl-Char Syntax
401@subsubsection Control-Character Syntax 398@subsubsection Control-Character Syntax
@@ -1026,40 +1023,53 @@ but the newline is ignored if escaped."
1026@node Non-ASCII in Strings 1023@node Non-ASCII in Strings
1027@subsubsection Non-@acronym{ASCII} Characters in Strings 1024@subsubsection Non-@acronym{ASCII} Characters in Strings
1028 1025
1029 You can include a non-@acronym{ASCII} international character in a 1026 There are two text representations for non-@acronym{ASCII}
1030string constant by writing it literally. There are two text 1027characters in Emacs strings: multibyte and unibyte (@pxref{Text
1031representations for non-@acronym{ASCII} characters in Emacs strings 1028Representations}). Roughly speaking, unibyte strings store raw bytes,
1032(and in buffers): unibyte and multibyte (@pxref{Text 1029while multibyte strings store human-readable text. Each character in
1033Representations}). If the string constant is read from a multibyte 1030a unibyte string is a byte, i.e.@: its value is between 0 and 255. By
1034source, such as a multibyte buffer or string, or a file that would be 1031contrast, each character in a multibyte string may have a value
1035visited as multibyte, then Emacs reads the non-@acronym{ASCII} 1032between 0 to 4194303 (@pxref{Character Type}). In both cases,
1036character as a multibyte character and automatically makes the string 1033characters above 127 are non-@acronym{ASCII}.
1037a multibyte string. If the string constant is read from a unibyte 1034
1038source, then Emacs reads the non-@acronym{ASCII} character as unibyte, 1035 You can include a non-@acronym{ASCII} character in a string constant
1039and makes the string unibyte. 1036by writing it literally. If the string constant is read from a
1040 1037multibyte source, such as a multibyte buffer or string, or a file that
1041 Instead of writing a non-@acronym{ASCII} character literally into a 1038would be visited as multibyte, then Emacs reads each
1042multibyte string, you can write it as its character code using a hex 1039non-@acronym{ASCII} character as a multibyte character and
1043escape, @samp{\x@var{nnnnnnn}}, with as many digits as necessary. 1040automatically makes the string a multibyte string. If the string
1044(Multibyte non-@acronym{ASCII} character codes are all greater than 1041constant is read from a unibyte source, then Emacs reads the
1045256.) You can also specify a character in a multibyte string using 1042non-@acronym{ASCII} character as unibyte, and makes the string
1046the @samp{\u} or @samp{\U} Unicode escape syntax (@pxref{General 1043unibyte.
1047Escape Syntax}). In either case, any character which is not a valid 1044
1048hex digit terminates the construct. If the next character in the 1045 Instead of writing a character literally into a multibyte string,
1049string could be interpreted as a hex digit, write @w{@samp{\ }} 1046you can write it as its character code using an escape sequence.
1050(backslash and space) to terminate the hex escape---for example, 1047@xref{General Escape Syntax}, for details about escape sequences.
1048
1049 If you use any Unicode-style escape sequence @samp{\uNNNN} or
1050@samp{\U00NNNNNN} in a string constant (even for an @acronym{ASCII}
1051character), Emacs automatically assumes that it is multibyte.
1052
1053 You can also use hexadecimal escape sequences (@samp{\x@var{n}}) and
1054octal escape sequences (@samp{\@var{n}}) in string constants.
1055@strong{But beware:} If a string constant contains hexadecimal or
1056octal escape sequences, and these escape sequences all specify unibyte
1057characters (i.e.@: less than 256), and there are no other literal
1058non-@acronym{ASCII} characters or Unicode-style escape sequences in
1059the string, then Emacs automatically assumes that it is a unibyte
1060string. That is to say, it assumes that all non-@acronym{ASCII}
1061characters occurring in the string are 8-bit raw bytes.
1062
1063 In hexadecimal and octal escape sequences, the escaped character
1064code may contain a variable number of digits, so the first subsequent
1065character which is not a valid hexadecimal or octal digit terminates
1066the escape sequence. If the next character in a string could be
1067interpreted as a hexadecimal or octal digit, write @w{@samp{\ }}
1068(backslash and space) to terminate the escape sequence. For example,
1051@w{@samp{\xe0\ }} represents one character, @samp{a} with grave 1069@w{@samp{\xe0\ }} represents one character, @samp{a} with grave
1052accent. @w{@samp{\ }} in a string constant is just like 1070accent. @w{@samp{\ }} in a string constant is just like
1053backslash-newline; it does not contribute any character to the string, 1071backslash-newline; it does not contribute any character to the string,
1054but it does terminate the preceding hex escape. Using any hex escape 1072but it does terminate any preceding hex escape.
1055in a string (even for an @acronym{ASCII} character) automatically
1056forces the string to be multibyte.
1057
1058 You can represent a unibyte non-@acronym{ASCII} character with its
1059character code, which must be in the range from 128 (0200 octal) to
1060255 (0377 octal). If you write all such character codes in octal and
1061the string contains no other characters forcing it to be multibyte,
1062this produces a unibyte string.
1063 1073
1064@node Nonprinting Characters 1074@node Nonprinting Characters
1065@subsubsection Nonprinting Characters in Strings 1075@subsubsection Nonprinting Characters in Strings
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi
index 6c5f6e85683..2f06e207fc4 100644
--- a/doc/lispref/os.texi
+++ b/doc/lispref/os.texi
@@ -2276,13 +2276,19 @@ These arguments should consist of alternating keyword and value pairs.
2276The supported keywords and values are as follows: 2276The supported keywords and values are as follows:
2277 2277
2278@table @code 2278@table @code
2279@item :bus @var{bus}
2280The D-Bus bus. This argument is needed only if a bus other than
2281@code{:session} shall be used.
2282
2279@item :title @var{title} 2283@item :title @var{title}
2280The notification title. 2284The notification title.
2281 2285
2282@item :body @var{text} 2286@item :body @var{text}
2283The notification body text. Depending on the implementation of the 2287The notification body text. Depending on the implementation of the
2284notification server, the text could contain HTML markups, like 2288notification server, the text could contain HTML markups, like
2285@samp{"<b>bold text</b>"}, hyperlinks, or images. 2289@samp{"<b>bold text</b>"}, hyperlinks, or images. Special HTML
2290characters must be encoded, as @samp{"Contact
2291&lt;postmaster@@localhost&gt;!"}.
2286 2292
2287@item :app-name @var{name} 2293@item :app-name @var{name}
2288The name of the application sending the notification. The default is 2294The name of the application sending the notification. The default is
@@ -2317,7 +2323,10 @@ When this keyword is given, the @var{title} string of the actions is
2317interpreted as icon name. 2323interpreted as icon name.
2318 2324
2319@item :category @var{category} 2325@item :category @var{category}
2320The type of notification this is, a string. 2326The type of notification this is, a string. See the
2327@uref{http://developer.gnome.org/notification-spec/#categories,
2328Desktop Notifications Specification} for a list of standard
2329categories.
2321 2330
2322@item :desktop-entry @var{filename} 2331@item :desktop-entry @var{filename}
2323This specifies the name of the desktop filename representing the 2332This specifies the name of the desktop filename representing the
@@ -2420,13 +2429,17 @@ A message window opens on the desktop. Press "I agree"
2420@end example 2429@end example
2421@end defun 2430@end defun
2422 2431
2423@defun notifications-close-notification id 2432@defun notifications-close-notification id &optional bus
2424This function closes a notification with identifier @var{id}. 2433This function closes a notification with identifier @var{id}.
2434@var{bus} can be a string denoting a D-Bus connection, the default is
2435@code{:session}.
2425@end defun 2436@end defun
2426 2437
2427@defun notifications-get-capabilities 2438@defun notifications-get-capabilities &optional bus
2428Returns the capabilities of the notification server, a list of strings. 2439Returns the capabilities of the notification server, a list of
2429The following capabilities can be expected: 2440symbols. @var{bus} can be a string denoting a D-Bus connection, the
2441default is @code{:session}. The following capabilities can be
2442expected:
2430 2443
2431@table @code 2444@table @code
2432@item :actions 2445@item :actions
@@ -2463,6 +2476,30 @@ Further vendor-specific caps start with @code{:x-vendor}, like
2463@code{:x-gnome-foo-cap}. 2476@code{:x-gnome-foo-cap}.
2464@end defun 2477@end defun
2465 2478
2479@defun notifications-get-server-information &optional bus
2480Return information on the notification server, a list of strings.
2481@var{bus} can be a string denoting a D-Bus connection, the default is
2482@code{:session}. The returned list is @code{(@var{name} @var{vendor}
2483@var{version} @var{spec-version})}.
2484
2485@table @var
2486@item name
2487The product name of the server.
2488
2489@item vendor
2490The vendor name. For example, @samp{"KDE"}, @samp{"GNOME"}.
2491
2492@item version
2493The server's version number.
2494
2495@item spec-version
2496The specification version the server is compliant with.
2497@end table
2498
2499If @var{SPEC_VERSION} is @code{nil}, the server supports a
2500specification prior to @samp{"1.0"}.
2501@end defun
2502
2466 2503
2467@node Dynamic Libraries 2504@node Dynamic Libraries
2468@section Dynamically Loaded Libraries 2505@section Dynamically Loaded Libraries
diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi
index 56c96363e81..f165381a0f8 100644
--- a/doc/lispref/searching.texi
+++ b/doc/lispref/searching.texi
@@ -1310,22 +1310,31 @@ part of one of the following sequences:
1310@table @asis 1310@table @asis
1311@item @samp{\&} 1311@item @samp{\&}
1312@cindex @samp{&} in replacement 1312@cindex @samp{&} in replacement
1313@samp{\&} stands for the entire text being replaced. 1313This stands for the entire text being replaced.
1314 1314
1315@item @samp{\@var{n}} 1315@item @samp{\@var{n}}, where @var{n} is a digit
1316@cindex @samp{\@var{n}} in replacement 1316@cindex @samp{\@var{n}} in replacement
1317@samp{\@var{n}}, where @var{n} is a digit, stands for the text that 1317This stands for the text that matched the @var{n}th subexpression in
1318matched the @var{n}th subexpression in the original regexp. 1318the original regexp. Subexpressions are those expressions grouped
1319Subexpressions are those expressions grouped inside @samp{\(@dots{}\)}. 1319inside @samp{\(@dots{}\)}. If the @var{n}th subexpression never
1320If the @var{n}th subexpression never matched, an empty string is substituted. 1320matched, an empty string is substituted.
1321 1321
1322@item @samp{\\} 1322@item @samp{\\}
1323@cindex @samp{\} in replacement 1323@cindex @samp{\} in replacement
1324@samp{\\} stands for a single @samp{\} in the replacement text. 1324This stands for a single @samp{\} in the replacement text.
1325
1326@item @samp{\?}
1327This stands for itself (for compatibility with @code{replace-regexp}
1328and related commands; @pxref{Regexp Replacement,,, emacs, The GNU
1329Emacs Manual}).
1325@end table 1330@end table
1326 1331
1327These substitutions occur after case conversion, if any, 1332@noindent
1328so the strings they substitute are never case-converted. 1333Any other character following @samp{\} signals an error.
1334
1335The substitutions performed by @samp{\&} and @samp{\@var{n}} occur
1336after case conversion, if any. Therefore, the strings they substitute
1337are never case-converted.
1329 1338
1330If @var{subexp} is non-@code{nil}, that says to replace just 1339If @var{subexp} is non-@code{nil}, that says to replace just
1331subexpression number @var{subexp} of the regexp that was matched, not 1340subexpression number @var{subexp} of the regexp that was matched, not
diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi
index 88b7909126e..dfde3c45c04 100644
--- a/doc/lispref/variables.texi
+++ b/doc/lispref/variables.texi
@@ -1262,6 +1262,13 @@ needed if you use the @var{local} argument to @code{add-hook} or
1262@code{remove-hook}. 1262@code{remove-hook}.
1263@end deffn 1263@end deffn
1264 1264
1265@defmac setq-local variable value
1266This macro creates a buffer-local binding in the current buffer for
1267@var{variable}, and gives it the buffer-local value @var{value}. It
1268is equivalent to calling @code{make-local-variable} followed by
1269@code{setq}. @var{variable} should be an unquoted symbol.
1270@end defmac
1271
1265@deffn Command make-variable-buffer-local variable 1272@deffn Command make-variable-buffer-local variable
1266This function marks @var{variable} (a symbol) automatically 1273This function marks @var{variable} (a symbol) automatically
1267buffer-local, so that any subsequent attempt to set it will make it 1274buffer-local, so that any subsequent attempt to set it will make it
@@ -1297,6 +1304,14 @@ on having separate values in separate buffers, then using
1297@code{make-variable-buffer-local} can be the best solution. 1304@code{make-variable-buffer-local} can be the best solution.
1298@end deffn 1305@end deffn
1299 1306
1307@defmac defvar-local variable value &optional docstring
1308This macro defines @var{variable} as a variable with initial value
1309@var{value} and @var{docstring}, and marks it as automatically
1310buffer-local. It is equivalent to calling @code{defvar} followed by
1311@code{make-variable-buffer-local}. @var{variable} should be an
1312unquoted symbol.
1313@end defmac
1314
1300@defun local-variable-p variable &optional buffer 1315@defun local-variable-p variable &optional buffer
1301This returns @code{t} if @var{variable} is buffer-local in buffer 1316This returns @code{t} if @var{variable} is buffer-local in buffer
1302@var{buffer} (which defaults to the current buffer); otherwise, 1317@var{buffer} (which defaults to the current buffer); otherwise,
@@ -1948,7 +1963,6 @@ Attempting to assign them any other value will result in an error:
1948@error{} Wrong type argument: integerp, 1000.0 1963@error{} Wrong type argument: integerp, 1000.0
1949@end example 1964@end example
1950 1965
1951@c FIXME? Not sure this is the right place for this section.
1952@node Generalized Variables 1966@node Generalized Variables
1953@section Generalized Variables 1967@section Generalized Variables
1954 1968
@@ -1958,13 +1972,20 @@ a regular Lisp variable. But the @sc{car}s and @sc{cdr}s of lists, elements
1958of arrays, properties of symbols, and many other locations are also 1972of arrays, properties of symbols, and many other locations are also
1959places where Lisp values are stored. 1973places where Lisp values are stored.
1960 1974
1961@c FIXME? Not sure this is a useful analogy...
1962Generalized variables are analogous to ``lvalues'' in the C 1975Generalized variables are analogous to ``lvalues'' in the C
1963language, where @samp{x = a[i]} gets an element from an array 1976language, where @samp{x = a[i]} gets an element from an array
1964and @samp{a[i] = x} stores an element using the same notation. 1977and @samp{a[i] = x} stores an element using the same notation.
1965Just as certain forms like @code{a[i]} can be lvalues in C, there 1978Just as certain forms like @code{a[i]} can be lvalues in C, there
1966is a set of forms that can be generalized variables in Lisp. 1979is a set of forms that can be generalized variables in Lisp.
1967 1980
1981@menu
1982* Setting Generalized Variables:: The @code{setf} macro.
1983* Adding Generalized Variables:: Defining new @code{setf} forms.
1984@end menu
1985
1986@node Setting Generalized Variables
1987@subsection The @code{setf} Macro
1988
1968The @code{setf} macro is the most basic way to operate on generalized 1989The @code{setf} macro is the most basic way to operate on generalized
1969variables. The @code{setf} form is like @code{setq}, except that it 1990variables. The @code{setf} form is like @code{setq}, except that it
1970accepts arbitrary place forms on the left side rather than just 1991accepts arbitrary place forms on the left side rather than just
@@ -1998,14 +2019,16 @@ so there is no performance penalty for using it in compiled code.
1998A call to any of the following standard Lisp functions: 2019A call to any of the following standard Lisp functions:
1999 2020
2000@smallexample 2021@smallexample
2001car cdr nth nthcdr 2022aref cddr symbol-function
2002caar cadr cdar cddr 2023car elt symbol-plist
2003aref elt get gethash 2024caar get symbol-value
2004symbol-function symbol-value symbol-plist 2025cadr gethash
2026cdr nth
2027cdar nthcdr
2005@end smallexample 2028@end smallexample
2006 2029
2007@item 2030@item
2008The following Emacs-specific functions are also @code{setf}-able: 2031A call to any of the following Emacs-specific functions:
2009 2032
2010@smallexample 2033@smallexample
2011default-value process-get 2034default-value process-get
@@ -2022,8 +2045,8 @@ process-filter
2022@end itemize 2045@end itemize
2023 2046
2024@noindent 2047@noindent
2025Using any forms other than these in the @var{place} argument to 2048@code{setf} signals an error if you pass a @var{place} form that it
2026@code{setf} will signal an error. 2049does not know how to handle.
2027 2050
2028@c And for cl-lib's cl-getf. 2051@c And for cl-lib's cl-getf.
2029Note that for @code{nthcdr}, the list argument of the function must 2052Note that for @code{nthcdr}, the list argument of the function must
@@ -2049,3 +2072,85 @@ place can be used to insert or delete at any position in a list.
2049The @file{cl-lib} library defines various extensions for generalized 2072The @file{cl-lib} library defines various extensions for generalized
2050variables, including additional @code{setf} places. 2073variables, including additional @code{setf} places.
2051@xref{Generalized Variables,,, cl, Common Lisp Extensions}. 2074@xref{Generalized Variables,,, cl, Common Lisp Extensions}.
2075
2076
2077@node Adding Generalized Variables
2078@subsection Defining new @code{setf} forms
2079
2080This section describes how to define new forms that @code{setf} can
2081operate on.
2082
2083@defmac gv-define-simple-setter name setter &optional fix-return
2084This macro enables you to easily define @code{setf} methods for simple
2085cases. @var{name} is the name of a function, macro, or special form.
2086You can use this macro whenever @var{name} has a directly
2087corresponding @var{setter} function that updates it, e.g.,
2088@code{(gv-define-simple-setter car setcar)}.
2089
2090This macro translates a call of the form
2091
2092@example
2093(setf (@var{name} @var{args}@dots{}) @var{value})
2094@end example
2095
2096into
2097@example
2098(@var{setter} @var{args}@dots{} @var{value})
2099@end example
2100
2101@noindent
2102Such a @code{setf} call is documented to return @var{value}. This is
2103no problem with, e.g., @code{car} and @code{setcar}, because
2104@code{setcar} returns the value that it set. If your @var{setter}
2105function does not return @var{value}, use a non-@code{nil} value for
2106the @var{fix-return} argument of @code{gv-define-simple-setter}. This
2107expands into something equivalent to
2108@example
2109(let ((temp @var{value}))
2110 (@var{setter} @var{args}@dots{} temp)
2111 temp)
2112@end example
2113so ensuring that it returns the correct result.
2114@end defmac
2115
2116
2117@defmac gv-define-setter name arglist &rest body
2118This macro allows for more complex @code{setf} expansions than the
2119previous form. You may need to use this form, for example, if there
2120is no simple setter function to call, or if there is one but it
2121requires different arguments to the place form.
2122
2123This macro expands the form
2124@code{(setf (@var{name} @var{args}@dots{}) @var{value})} by
2125first binding the @code{setf} argument forms
2126@code{(@var{value} @var{args}@dots{})} according to @var{arglist},
2127and then executing @var{body}. @var{body} should return a Lisp
2128form that does the assignment, and finally returns the value that was
2129set. An example of using this macro is:
2130
2131@example
2132(gv-define-setter caar (val x) `(setcar (car ,x) ,val))
2133@end example
2134@end defmac
2135
2136@findex gv-define-expander
2137@findex gv-letplace
2138@c FIXME? Not sure what or how much to say about these.
2139@c See cl.texi for an example of using gv-letplace.
2140For more control over the expansion, see the macro @code{gv-define-expander}.
2141The macro @code{gv-letplace} can be useful in defining macros that
2142perform similarly to @code{setf}; for example, the @code{incf} macro
2143of Common Lisp. Consult the source file @file{gv.el} for more details.
2144
2145@cindex CL note---no @code{setf} functions
2146@quotation
2147@b{Common Lisp note:} Common Lisp defines another way to specify the
2148@code{setf} behavior of a function, namely ``@code{setf} functions'',
2149whose names are lists @code{(setf @var{name})} rather than symbols.
2150For example, @code{(defun (setf foo) @dots{})} defines the function
2151that is used when @code{setf} is applied to @code{foo}. Emacs does
2152not support this. It is a compile-time error to use @code{setf} on a
2153form that has not already had an appropriate expansion defined. In
2154Common Lisp, this is not an error since the function @code{(setf
2155@var{func})} might be defined later.
2156@end quotation
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index d0e149eb165..bb02b1d54fd 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -16,8 +16,10 @@ is displayed in windows.
16* Windows and Frames:: Relating windows to the frame they appear on. 16* Windows and Frames:: Relating windows to the frame they appear on.
17* Window Sizes:: Accessing a window's size. 17* Window Sizes:: Accessing a window's size.
18* Resizing Windows:: Changing the sizes of windows. 18* Resizing Windows:: Changing the sizes of windows.
19* Splitting Windows:: Splitting one window into two windows. 19* Splitting Windows:: Creating a new window.
20* Deleting Windows:: Deleting a window gives its space to other windows. 20* Deleting Windows:: Removing a window from its frame.
21* Recombining Windows:: Preserving the frame layout when splitting and
22 deleting windows.
21* Selecting Windows:: The selected window is the one that you edit in. 23* Selecting Windows:: The selected window is the one that you edit in.
22* Cyclic Window Ordering:: Moving around the existing windows. 24* Cyclic Window Ordering:: Moving around the existing windows.
23* Buffers and Windows:: Each window displays the contents of a buffer. 25* Buffers and Windows:: Each window displays the contents of a buffer.
@@ -587,7 +589,7 @@ function @code{window-resizable} above.
587The choice of which window edges this function alters depends on the 589The choice of which window edges this function alters depends on the
588values of the option @code{window-combination-resize} and the 590values of the option @code{window-combination-resize} and the
589combination limits of the involved windows; in some cases, it may alter 591combination limits of the involved windows; in some cases, it may alter
590both edges. @xref{Splitting Windows}. To resize by moving only the 592both edges. @xref{Recombining Windows}. To resize by moving only the
591bottom or right edge of a window, use the function 593bottom or right edge of a window, use the function
592@code{adjust-window-trailing-edge}, below. 594@code{adjust-window-trailing-edge}, below.
593@end defun 595@end defun
@@ -795,26 +797,169 @@ A new live window @var{W2} is created, to the left of the internal
795window @var{W3}. A new internal window @var{W1} is created, becoming 797window @var{W3}. A new internal window @var{W1} is created, becoming
796the new root window. 798the new root window.
797 799
798@defopt window-combination-resize 800 For interactive use, Emacs provides two commands which always split
799If this variable is @code{nil}, @code{split-window} can only split a 801the selected window. These call @code{split-window} internally.
800window (denoted by @var{window}) if @var{window}'s screen area is large
801enough to accommodate both itself and the new window.
802 802
803If this variable is @code{t}, @code{split-window} tries to resize all 803@deffn Command split-window-right &optional size
804windows that are part of the same combination as @var{window}, in order 804This function splits the selected window into two side-by-side
805to accommodate the new window. In particular, this may allow 805windows, putting the selected window on the left. If @var{size} is
806@code{split-window} to succeed even if @var{window} is a fixed-size 806positive, the left window gets @var{size} columns; if @var{size} is
807window or too small to ordinarily split. Furthermore, subsequently 807negative, the right window gets @minus{}@var{size} columns.
808resizing or deleting @var{window} may resize all other windows in its 808@end deffn
809combination.
810 809
811The default is @code{nil}. Other values are reserved for future use. 810@deffn Command split-window-below &optional size
812The value of this variable is ignored when 811This function splits the selected window into two windows, one above
813@code{window-combination-limit} is non-@code{nil} (see below). 812the other, leaving the upper window selected. If @var{size} is
813positive, the upper window gets @var{size} lines; if @var{size} is
814negative, the lower window gets @minus{}@var{size} lines.
815@end deffn
816
817@defopt split-window-keep-point
818If the value of this variable is non-@code{nil} (the default),
819@code{split-window-below} behaves as described above.
820
821If it is @code{nil}, @code{split-window-below} adjusts point in each
822of the two windows to minimize redisplay. (This is useful on slow
823terminals.) It selects whichever window contains the screen line that
824point was previously on. Note that this only affects
825@code{split-window-below}, not the lower-level @code{split-window}
826function.
814@end defopt 827@end defopt
815 828
816 To illustrate the effect of @code{window-combination-resize}, 829@node Deleting Windows
817consider the following window configuration: 830@section Deleting Windows
831@cindex deleting windows
832
833 @dfn{Deleting} a window removes it from the frame's window tree. If
834the window is a live window, it disappears from the screen. If the
835window is an internal window, its child windows are deleted too.
836
837 Even after a window is deleted, it continues to exist as a Lisp
838object, until there are no more references to it. Window deletion can
839be reversed, by restoring a saved window configuration (@pxref{Window
840Configurations}).
841
842@deffn Command delete-window &optional window
843This function removes @var{window} from display and returns
844@code{nil}. If @var{window} is omitted or @code{nil}, it defaults to
845the selected window. If deleting the window would leave no more
846windows in the window tree (e.g. if it is the only live window in the
847frame), an error is signaled.
848
849By default, the space taken up by @var{window} is given to one of its
850adjacent sibling windows, if any. However, if the variable
851@code{window-combination-resize} is non-@code{nil}, the space is
852proportionally distributed among any remaining windows in the window
853combination. @xref{Recombining Windows}.
854
855The behavior of this function may be altered by the window parameters
856of @var{window}, so long as the variable
857@code{ignore-window-parameters} is @code{nil}. If the value of
858the @code{delete-window} window parameter is @code{t}, this function
859ignores all other window parameters. Otherwise, if the value of the
860@code{delete-window} window parameter is a function, that function is
861called with the argument @var{window}, in lieu of the usual action of
862@code{delete-window}. Otherwise, this function obeys the
863@code{window-atom} or @code{window-side} window parameter, if any.
864@xref{Window Parameters}.
865@end deffn
866
867@deffn Command delete-other-windows &optional window
868This function makes @var{window} fill its frame, by deleting other
869windows as necessary. If @var{window} is omitted or @code{nil}, it
870defaults to the selected window. The return value is @code{nil}.
871
872The behavior of this function may be altered by the window parameters
873of @var{window}, so long as the variable
874@code{ignore-window-parameters} is @code{nil}. If the value of
875the @code{delete-other-windows} window parameter is @code{t}, this
876function ignores all other window parameters. Otherwise, if the value
877of the @code{delete-other-windows} window parameter is a function,
878that function is called with the argument @var{window}, in lieu of the
879usual action of @code{delete-other-windows}. Otherwise, this function
880obeys the @code{window-atom} or @code{window-side} window parameter,
881if any. @xref{Window Parameters}.
882@end deffn
883
884@deffn Command delete-windows-on &optional buffer-or-name frame
885This function deletes all windows showing @var{buffer-or-name}, by
886calling @code{delete-window} on those windows. @var{buffer-or-name}
887should be a buffer, or the name of a buffer; if omitted or @code{nil},
888it defaults to the current buffer. If there are no windows showing
889the specified buffer, this function does nothing. If the specified
890buffer is a minibuffer, an error is signaled.
891
892If there is a dedicated window showing the buffer, and that window is
893the only one on its frame, this function also deletes that frame if it
894is not the only frame on the terminal.
895
896The optional argument @var{frame} specifies which frames to operate
897on:
898
899@itemize @bullet
900@item @code{nil}
901means operate on all frames.
902@item @code{t}
903means operate on the selected frame.
904@item @code{visible}
905means operate on all visible frames.
906@item @code{0}
907means operate on all visible or iconified frames.
908@item A frame
909means operate on that frame.
910@end itemize
911
912Note that this argument does not have the same meaning as in other
913functions which scan all live windows (@pxref{Cyclic Window
914Ordering}). Specifically, the meanings of @code{t} and @code{nil} here
915are the opposite of what they are in those other functions.
916@end deffn
917
918
919@node Recombining Windows
920@section Recombining Windows
921
922When deleting the last sibling of a window @code{W}, its parent window
923is deleted too, with @code{W} replacing it in the window tree. This
924means that @code{W} must be recombined with its parent's siblings to
925form a new window combination (@pxref{Windows and Frames}). In some
926occasions, deleting a live window may even entail the deletion of two
927internal windows.
928
929@smallexample
930@group
931 ______________________________________
932 | ______ ____________________________ |
933 || || __________________________ ||
934 || ||| ___________ ___________ |||
935 || |||| || ||||
936 || ||||____W6_____||_____W7____||||
937 || |||____________W4____________|||
938 || || __________________________ ||
939 || ||| |||
940 || ||| |||
941 || |||____________W5____________|||
942 ||__W2__||_____________W3_____________ |
943 |__________________W1__________________|
944
945@end group
946@end smallexample
947
948@noindent
949Deleting @code{W5} in this configuration normally causes the deletion of
950@code{W3} and @code{W4}. The remaining live windows @code{W2},
951@code{W6} and @code{W7} are recombined to form a new horizontal
952combination with parent @code{W1}.
953
954 Sometimes, however, it makes sense to not delete a parent window like
955@code{W4}. In particular, a parent window should not be removed when it
956was used to preserve a combination embedded in a combination of the same
957type. Such embeddings make sense to assure that when you split a window
958and subsequently delete the new window, Emacs reestablishes the layout
959of the associated frame as it existed before the splitting.
960
961 Consider a scenario starting with two live windows @code{W2} and
962@code{W3} and their parent @code{W1}.
818 963
819@smallexample 964@smallexample
820@group 965@group
@@ -824,10 +969,10 @@ consider the following window configuration:
824 || || 969 || ||
825 || || 970 || ||
826 || || 971 || ||
827 ||_________________W2_________________||
828 | ____________________________________ |
829 || || 972 || ||
830 || || 973 || ||
974 ||_________________W2_________________||
975 | ____________________________________ |
831 || || 976 || ||
832 || || 977 || ||
833 ||_________________W3_________________|| 978 ||_________________W3_________________||
@@ -837,8 +982,7 @@ consider the following window configuration:
837@end smallexample 982@end smallexample
838 983
839@noindent 984@noindent
840If @code{window-combination-resize} is @code{nil}, splitting window 985Split @code{W2} to make a new window @code{W4} as follows.
841@code{W3} leaves the size of @code{W2} unchanged:
842 986
843@smallexample 987@smallexample
844@group 988@group
@@ -846,24 +990,25 @@ If @code{window-combination-resize} is @code{nil}, splitting window
846 | ____________________________________ | 990 | ____________________________________ |
847 || || 991 || ||
848 || || 992 || ||
849 || ||
850 || ||
851 ||_________________W2_________________|| 993 ||_________________W2_________________||
852 | ____________________________________ | 994 | ____________________________________ |
853 || || 995 || ||
854 ||_________________W3_________________||
855 | ____________________________________ |
856 || || 996 || ||
857 ||_________________W4_________________|| 997 ||_________________W4_________________||
998 | ____________________________________ |
999 || ||
1000 || ||
1001 ||_________________W3_________________||
858 |__________________W1__________________| 1002 |__________________W1__________________|
859 1003
860@end group 1004@end group
861@end smallexample 1005@end smallexample
862 1006
863@noindent 1007@noindent
864If @code{window-combination-resize} is @code{t}, splitting @code{W3} 1008Now, when enlarging a window vertically, Emacs tries to obtain the
865instead leaves all three live windows with approximately the same 1009corresponding space from its lower sibling, provided such a window
866height: 1010exists. In our scenario, enlarging @code{W4} will steal space from
1011@code{W3}.
867 1012
868@smallexample 1013@smallexample
869@group 1014@group
@@ -875,36 +1020,119 @@ height:
875 | ____________________________________ | 1020 | ____________________________________ |
876 || || 1021 || ||
877 || || 1022 || ||
1023 || ||
1024 || ||
1025 ||_________________W4_________________||
1026 | ____________________________________ |
878 ||_________________W3_________________|| 1027 ||_________________W3_________________||
1028 |__________________W1__________________|
1029
1030@end group
1031@end smallexample
1032
1033@noindent
1034Deleting @code{W4} will now give its entire space to @code{W2},
1035including the space earlier stolen from @code{W3}.
1036
1037@smallexample
1038@group
1039 ______________________________________
879 | ____________________________________ | 1040 | ____________________________________ |
880 || || 1041 || ||
881 || || 1042 || ||
882 ||_________________W4_________________|| 1043 || ||
1044 || ||
1045 || ||
1046 || ||
1047 || ||
1048 || ||
1049 ||_________________W2_________________||
1050 | ____________________________________ |
1051 ||_________________W3_________________||
883 |__________________W1__________________| 1052 |__________________W1__________________|
884 1053
885@end group 1054@end group
886@end smallexample 1055@end smallexample
887 1056
1057@noindent
1058This can be counterintutive, in particular if @code{W4} were used for
1059displaying a buffer only temporarily (@pxref{Temporary Displays}), and
1060you want to continue working with the initial layout.
1061
1062The behavior can be fixed by making a new parent window when splitting
1063@code{W2}. The variable described next allows to do that.
1064
888@defopt window-combination-limit 1065@defopt window-combination-limit
889If the value of this variable is @code{t}, the @code{split-window} 1066This variable controls whether splitting a window shall make a new
890function always creates a new internal window. If the value is 1067parent window. The following values are recognized:
891@code{nil}, the new live window is allowed to share the existing 1068
1069@table @code
1070@item nil
1071This means that the new live window is allowed to share the existing
892parent window, if one exists, provided the split occurs in the same 1072parent window, if one exists, provided the split occurs in the same
893direction as the existing window combination (otherwise, a new 1073direction as the existing window combination (otherwise, a new internal
894internal window is created anyway). The default is @code{nil}. Other 1074window is created anyway).
895values are reserved for future use. 1075
896 1076@item window-size
897Thus, if the value of this variable is at all times @code{t}, then at 1077In this case @code{display-buffer} makes a new parent window if it is
898all times every window tree is a binary tree (a tree where each window 1078passed a @code{window-height} or @code{window-width} entry in the
899except the root window has exactly one sibling). 1079@var{alist} argument (@pxref{Display Action Functions}).
900 1080
901Furthermore, @code{split-window} calls 1081@item temp-buffer
902@code{set-window-combination-limit} on the newly-created internal 1082This value causes the creation of a new parent window when a window is
903window, recording the current value of this variable. This affects 1083split for showing a temporary buffer (@pxref{Temporary Displays}) only.
904how the window tree is rearranged when the child windows are deleted 1084
905(see below). 1085@item display-buffer
1086This means that when @code{display-buffer} (@pxref{Choosing Window})
1087splits a window it always makes a new parent window.
1088
1089@item t
1090In this case a new parent window is always created when splitting a
1091window. Thus, if the value of this variable is at all times @code{t},
1092then at all times every window tree is a binary tree (a tree where each
1093window except the root window has exactly one sibling).
1094@end table
1095
1096The default is @code{nil}. Other values are reserved for future use.
1097
1098If, as a consequence of this variable's setting, @code{split-window}
1099makes a new parent window, it also calls
1100@code{set-window-combination-limit} (see below) on the newly-created
1101internal window. This affects how the window tree is rearranged when
1102the child windows are deleted (see below).
906@end defopt 1103@end defopt
907 1104
1105 If @code{window-combination-limit} is @code{t}, splitting @code{W2} in
1106the initial configuration of our scenario would have produced this:
1107
1108@smallexample
1109@group
1110 ______________________________________
1111 | ____________________________________ |
1112 || __________________________________ ||
1113 ||| |||
1114 |||________________W2________________|||
1115 || __________________________________ ||
1116 ||| |||
1117 |||________________W4________________|||
1118 ||_________________W5_________________||
1119 | ____________________________________ |
1120 || ||
1121 || ||
1122 ||_________________W3_________________||
1123 |__________________W1__________________|
1124
1125@end group
1126@end smallexample
1127
1128@noindent
1129A new internal window @code{W5} has been created; its children are
1130@code{W2} and the new live window @code{W4}. Now, @code{W2} is the only
1131sibling of @code{W4}, so enlarging @code{W4} will try to shrink
1132@code{W2}, leaving @code{W3} unaffected. Observe that @code{W5}
1133represents a vertical combination of two windows embedded in the
1134vertical combination @code{W1}.
1135
908@cindex window combination limit 1136@cindex window combination limit
909@defun set-window-combination-limit window limit 1137@defun set-window-combination-limit window limit
910This functions sets the @dfn{combination limit} of the window 1138This functions sets the @dfn{combination limit} of the window
@@ -912,25 +1140,52 @@ This functions sets the @dfn{combination limit} of the window
912function @code{window-combination-limit}. See below for its effects; 1140function @code{window-combination-limit}. See below for its effects;
913note that it is only meaningful for internal windows. The 1141note that it is only meaningful for internal windows. The
914@code{split-window} function automatically calls this function, passing 1142@code{split-window} function automatically calls this function, passing
915the value of the variable @code{window-combination-limit} as 1143it @code{t} as @var{limit}, provided the value of the variable
916@var{limit}. 1144@code{window-combination-limit} is @code{t} when it is called.
917@end defun 1145@end defun
918 1146
919@defun window-combination-limit window 1147@defun window-combination-limit window
920This function returns the combination limit for @var{window}. 1148This function returns the combination limit for @var{window}.
921 1149
922The combination limit is meaningful only for an internal window. If 1150The combination limit is meaningful only for an internal window. If it
923it is @code{nil}, then Emacs is allowed to automatically delete 1151is @code{nil}, then Emacs is allowed to automatically delete
924@var{window}, in response to a window deletion, in order to group the 1152@var{window}, in response to a window deletion, in order to group the
925child windows of @var{window} with its sibling windows to form a new 1153child windows of @var{window} with its sibling windows to form a new
926window combination. If the combination limit is @code{t}, the child 1154window combination. If the combination limit is @code{t}, the child
927windows of @var{window} are never automatically re-combined with its 1155windows of @var{window} are never automatically recombined with its
928siblings. 1156siblings.
1157
1158If, in the configuration shown at the beginning of this section, the
1159combination limit of @code{W4} (the parent window of @code{W6} and
1160@code{W7}) is @code{t}, deleting @code{W5} will not implicitly delete
1161@code{W4} too.
929@end defun 1162@end defun
930 1163
931 To illustrate the effect of @code{window-combination-limit}, 1164Alternatively, the problems sketched above can be avoided by always
932consider the following configuration (throughout this example, we will 1165resizing all windows in the same combination whenever one of its windows
933assume that @code{window-combination-resize} is @code{nil}): 1166is split or deleted. This also permits to split windows that would be
1167otherwise too small for such an operation.
1168
1169@defopt window-combination-resize
1170If this variable is @code{nil}, @code{split-window} can only split a
1171window (denoted by @var{window}) if @var{window}'s screen area is large
1172enough to accommodate both itself and the new window.
1173
1174If this variable is @code{t}, @code{split-window} tries to resize all
1175windows that are part of the same combination as @var{window}, in order
1176to accommodate the new window. In particular, this may allow
1177@code{split-window} to succeed even if @var{window} is a fixed-size
1178window or too small to ordinarily split. Furthermore, subsequently
1179resizing or deleting @var{window} may resize all other windows in its
1180combination.
1181
1182The default is @code{nil}. Other values are reserved for future use.
1183The value of this variable is ignored when
1184@code{window-combination-limit} is non-@code{nil}.
1185@end defopt
1186
1187 To illustrate the effect of @code{window-combination-resize}, consider
1188the following frame layout.
934 1189
935@smallexample 1190@smallexample
936@group 1191@group
@@ -940,12 +1195,12 @@ assume that @code{window-combination-resize} is @code{nil}):
940 || || 1195 || ||
941 || || 1196 || ||
942 || || 1197 || ||
943 || ||
944 || ||
945 ||_________________W2_________________|| 1198 ||_________________W2_________________||
946 | ____________________________________ | 1199 | ____________________________________ |
947 || || 1200 || ||
948 || || 1201 || ||
1202 || ||
1203 || ||
949 ||_________________W3_________________|| 1204 ||_________________W3_________________||
950 |__________________W1__________________| 1205 |__________________W1__________________|
951 1206
@@ -953,8 +1208,8 @@ assume that @code{window-combination-resize} is @code{nil}):
953@end smallexample 1208@end smallexample
954 1209
955@noindent 1210@noindent
956If @code{window-combination-limit} is @code{nil}, splitting @code{W2} 1211If @code{window-combination-resize} is @code{nil}, splitting window
957into two windows, one above the other, yields 1212@code{W3} leaves the size of @code{W2} unchanged:
958 1213
959@smallexample 1214@smallexample
960@group 1215@group
@@ -962,171 +1217,50 @@ into two windows, one above the other, yields
962 | ____________________________________ | 1217 | ____________________________________ |
963 || || 1218 || ||
964 || || 1219 || ||
965 ||_________________W2_________________||
966 | ____________________________________ |
967 || || 1220 || ||
968 || || 1221 || ||
969 ||_________________W4_________________|| 1222 ||_________________W2_________________||
970 | ____________________________________ | 1223 | ____________________________________ |
971 || || 1224 || ||
972 || ||
973 ||_________________W3_________________|| 1225 ||_________________W3_________________||
1226 | ____________________________________ |
1227 || ||
1228 ||_________________W4_________________||
974 |__________________W1__________________| 1229 |__________________W1__________________|
975 1230
976@end group 1231@end group
977@end smallexample 1232@end smallexample
978 1233
979@noindent 1234@noindent
980The newly-created window, @code{W4}, shares the same internal window 1235If @code{window-combination-resize} is @code{t}, splitting @code{W3}
981@code{W1}. If @code{W4} is resized, it is allowed to resize the other 1236instead leaves all three live windows with approximately the same
982live window, @code{W3}. 1237height:
983
984 If @code{window-combination-limit} is @code{t}, splitting @code{W2}
985in the initial configuration would instead have produced this:
986 1238
987@smallexample 1239@smallexample
988@group 1240@group
989 ______________________________________ 1241 ______________________________________
990 | ____________________________________ | 1242 | ____________________________________ |
991 || __________________________________ || 1243 || ||
992 ||| ||| 1244 || ||
993 |||________________W2________________||| 1245 ||_________________W2_________________||
994 || __________________________________ ||
995 ||| |||
996 |||________________W4________________|||
997 ||_________________W5_________________||
998 | ____________________________________ | 1246 | ____________________________________ |
999 || || 1247 || ||
1000 || || 1248 || ||
1001 ||_________________W3_________________|| 1249 ||_________________W3_________________||
1250 | ____________________________________ |
1251 || ||
1252 || ||
1253 ||_________________W4_________________||
1002 |__________________W1__________________| 1254 |__________________W1__________________|
1003 1255
1004@end group 1256@end group
1005@end smallexample 1257@end smallexample
1006 1258
1007@noindent 1259@noindent
1008A new internal window @code{W5} has been created; its children are 1260Deleting any of the live windows @code{W2}, @code{W3} or @code{W4} will
1009@code{W2} and the new live window @code{W4}. Now, @code{W2} is the 1261distribute its space proportionally among the two remaining live
1010only sibling of @code{W4}, so resizing @code{W4} will resize 1262windows.
1011@code{W2}, leaving @code{W3} unaffected.
1012 1263
1013 For interactive use, Emacs provides two commands which always split
1014the selected window. These call @code{split-window} internally.
1015
1016@deffn Command split-window-right &optional size
1017This function splits the selected window into two side-by-side
1018windows, putting the selected window on the left. If @var{size} is
1019positive, the left window gets @var{size} columns; if @var{size} is
1020negative, the right window gets @minus{}@var{size} columns.
1021@end deffn
1022
1023@deffn Command split-window-below &optional size
1024This function splits the selected window into two windows, one above
1025the other, leaving the upper window selected. If @var{size} is
1026positive, the upper window gets @var{size} lines; if @var{size} is
1027negative, the lower window gets @minus{}@var{size} lines.
1028@end deffn
1029
1030@defopt split-window-keep-point
1031If the value of this variable is non-@code{nil} (the default),
1032@code{split-window-below} behaves as described above.
1033
1034If it is @code{nil}, @code{split-window-below} adjusts point in each
1035of the two windows to minimize redisplay. (This is useful on slow
1036terminals.) It selects whichever window contains the screen line that
1037point was previously on. Note that this only affects
1038@code{split-window-below}, not the lower-level @code{split-window}
1039function.
1040@end defopt
1041
1042@node Deleting Windows
1043@section Deleting Windows
1044@cindex deleting windows
1045
1046 @dfn{Deleting} a window removes it from the frame's window tree. If
1047the window is a live window, it disappears from the screen. If the
1048window is an internal window, its child windows are deleted too.
1049
1050 Even after a window is deleted, it continues to exist as a Lisp
1051object, until there are no more references to it. Window deletion can
1052be reversed, by restoring a saved window configuration (@pxref{Window
1053Configurations}).
1054
1055@deffn Command delete-window &optional window
1056This function removes @var{window} from display and returns
1057@code{nil}. If @var{window} is omitted or @code{nil}, it defaults to
1058the selected window. If deleting the window would leave no more
1059windows in the window tree (e.g. if it is the only live window in the
1060frame), an error is signaled.
1061
1062By default, the space taken up by @var{window} is given to one of its
1063adjacent sibling windows, if any. However, if the variable
1064@code{window-combination-resize} is non-@code{nil}, the space is
1065proportionally distributed among any remaining windows in the window
1066combination. @xref{Splitting Windows}.
1067
1068The behavior of this function may be altered by the window parameters
1069of @var{window}, so long as the variable
1070@code{ignore-window-parameters} is @code{nil}. If the value of
1071the @code{delete-window} window parameter is @code{t}, this function
1072ignores all other window parameters. Otherwise, if the value of the
1073@code{delete-window} window parameter is a function, that function is
1074called with the argument @var{window}, in lieu of the usual action of
1075@code{delete-window}. Otherwise, this function obeys the
1076@code{window-atom} or @code{window-side} window parameter, if any.
1077@xref{Window Parameters}.
1078@end deffn
1079
1080@deffn Command delete-other-windows &optional window
1081This function makes @var{window} fill its frame, by deleting other
1082windows as necessary. If @var{window} is omitted or @code{nil}, it
1083defaults to the selected window. The return value is @code{nil}.
1084
1085The behavior of this function may be altered by the window parameters
1086of @var{window}, so long as the variable
1087@code{ignore-window-parameters} is @code{nil}. If the value of
1088the @code{delete-other-windows} window parameter is @code{t}, this
1089function ignores all other window parameters. Otherwise, if the value
1090of the @code{delete-other-windows} window parameter is a function,
1091that function is called with the argument @var{window}, in lieu of the
1092usual action of @code{delete-other-windows}. Otherwise, this function
1093obeys the @code{window-atom} or @code{window-side} window parameter,
1094if any. @xref{Window Parameters}.
1095@end deffn
1096
1097@deffn Command delete-windows-on &optional buffer-or-name frame
1098This function deletes all windows showing @var{buffer-or-name}, by
1099calling @code{delete-window} on those windows. @var{buffer-or-name}
1100should be a buffer, or the name of a buffer; if omitted or @code{nil},
1101it defaults to the current buffer. If there are no windows showing
1102the specified buffer, this function does nothing. If the specified
1103buffer is a minibuffer, an error is signaled.
1104
1105If there is a dedicated window showing the buffer, and that window is
1106the only one on its frame, this function also deletes that frame if it
1107is not the only frame on the terminal.
1108
1109The optional argument @var{frame} specifies which frames to operate
1110on:
1111
1112@itemize @bullet
1113@item @code{nil}
1114means operate on all frames.
1115@item @code{t}
1116means operate on the selected frame.
1117@item @code{visible}
1118means operate on all visible frames.
1119@item @code{0}
1120means operate on all visible or iconified frames.
1121@item A frame
1122means operate on that frame.
1123@end itemize
1124
1125Note that this argument does not have the same meaning as in other
1126functions which scan all live windows (@pxref{Cyclic Window
1127Ordering}). Specifically, the meanings of @code{t} and @code{nil} here
1128are the opposite of what they are in those other functions.
1129@end deffn
1130 1264
1131@node Selecting Windows 1265@node Selecting Windows
1132@section Selecting Windows 1266@section Selecting Windows
@@ -1550,6 +1684,26 @@ normally tries to display the buffer in some other window, by invoking
1550instead. 1684instead.
1551@end deffn 1685@end deffn
1552 1686
1687By default, @code{switch-to-buffer} sets @code{window-point} of the
1688window used to the buffer's position of @code{point}. This behavior can
1689be tuned using the following option.
1690
1691@defopt switch-to-buffer-preserve-window-point
1692If this variable is @code{nil}, @code{switch-to-buffer} displays the
1693buffer specified by @var{buffer-or-name} at the position of that
1694buffer's @code{point}. If this variable is @code{already-displayed}, it
1695tries to display the buffer at its previous position in the selected
1696window, provided the buffer is currently displayed in some other window
1697on any visible or iconified frame. If this variable is @code{t},
1698@code{switch-to-buffer} unconditionally tries to display the buffer at
1699its previous position in the selected window.
1700
1701This variable is ignored if the buffer is already displayed in the
1702selected window or never appeared in it before, or if
1703@code{switch-to-buffer} calls @code{pop-to-buffer} to display the
1704buffer.
1705@end defopt
1706
1553The next two functions are similar to @code{switch-to-buffer}, except 1707The next two functions are similar to @code{switch-to-buffer}, except
1554for the described features. 1708for the described features.
1555 1709
@@ -1775,9 +1929,51 @@ It actually performs the split by calling the function specified in
1775@code{split-window-preferred-function} (@pxref{Choosing Window 1929@code{split-window-preferred-function} (@pxref{Choosing Window
1776Options}). 1930Options}).
1777 1931
1778It can fail if no window splitting can be performed for some reason 1932The size of the new window can be adjusted by supplying
1779(e.g. if there is just one frame and it has an @code{unsplittable} 1933@code{window-height} and @code{window-width} entries in @var{alist}. To
1780frame parameter; @pxref{Buffer Parameters}). 1934adjust the window's height, use an entry whose @sc{car} is
1935@code{window-height} and whose @sc{cdr} is one of:
1936
1937@itemize @bullet
1938@item
1939@code{nil} means to leave the height of the new window alone.
1940
1941@item
1942A number specifies the desired height of the new window. An integer
1943number specifies the number of lines of the window. A floating point
1944number gives the fraction of the window's height with respect to the
1945height of the frame's root window.
1946
1947@item
1948If the @sc{cdr} specifies a function, that function is called with one
1949argument - the new window. The function is supposed to adjust the
1950height of the window; its return value is ignored. Suitable functions
1951are @code{shrink-window-if-larger-than-buffer} and
1952@code{fit-window-to-buffer}, see @ref{Resizing Windows}.
1953@end itemize
1954
1955To adjust the window's width, use an entry whose @sc{car} is
1956@code{window-width} and whose @sc{cdr} is one of:
1957
1958@itemize @bullet
1959@item
1960@code{nil} means to leave the width of the new window alone.
1961
1962@item
1963A number specifies the desired width of the new window. An integer
1964number specifies the number of columns of the window. A floating point
1965number gives the fraction of the window's width with respect to the
1966width of the frame's root window.
1967
1968@item
1969If the @sc{cdr} specifies a function, that function is called with one
1970argument - the new window. The function is supposed to adjust the width
1971of the window; its return value is ignored.
1972@end itemize
1973
1974This function can fail if no window splitting can be performed for some
1975reason (e.g. if there is just one frame and it has an
1976@code{unsplittable} frame parameter; @pxref{Buffer Parameters}).
1781@end defun 1977@end defun
1782 1978
1783@defun display-buffer-use-some-window buffer alist 1979@defun display-buffer-use-some-window buffer alist
@@ -1786,6 +1982,26 @@ window and displaying the buffer in that window. It can fail if all
1786windows are dedicated to another buffer (@pxref{Dedicated Windows}). 1982windows are dedicated to another buffer (@pxref{Dedicated Windows}).
1787@end defun 1983@end defun
1788 1984
1985@defun display-buffer-below-selected buffer alist
1986This function tries to display @var{buffer} in a window below the
1987selected window. This means to either split the selected window or
1988reuse the window below the selected one.
1989@end defun
1990
1991@defun display-buffer-in-previous-window buffer alist
1992This function tries to display @var{buffer} in a window previously
1993showing it. If @var{alist} has a non-@code{nil}
1994@code{inhibit-same-window} entry, the selected window is not eligible
1995for reuse. If @var{alist} contains a @code{reusable-frames} entry, its
1996value determines which frames to search for a suitable window as with
1997@code{display-buffer-reuse-window}.
1998
1999If @var{alist} has a @code{previous-window} entry, the window
2000specified by that entry will override any other window found by the
2001methods above, even if that window never showed @var{buffer} before.
2002@end defun
2003
2004
1789@node Choosing Window Options 2005@node Choosing Window Options
1790@section Additional Options for Displaying Buffers 2006@section Additional Options for Displaying Buffers
1791 2007
@@ -2086,45 +2302,77 @@ function @code{switch-to-prev-buffer} (@pxref{Window History}).
2086Finally, you might want to either bury (@pxref{The Buffer List}) or kill 2302Finally, you might want to either bury (@pxref{The Buffer List}) or kill
2087(@pxref{Killing Buffers}) the window's buffer. 2303(@pxref{Killing Buffers}) the window's buffer.
2088 2304
2089 The following function uses information on how the window for 2305 The following command uses information on how the window for
2090displaying the buffer was obtained in the first place, thus attempting to 2306displaying the buffer was obtained in the first place, thus attempting
2091automate the above decisions for you. 2307to automate the above decisions for you.
2092 2308
2093@deffn Command quit-window &optional kill window 2309@deffn Command quit-window &optional kill window
2094This command quits @var{window} and buries its buffer. The argument 2310This command quits @var{window} and buries its buffer. The argument
2095@var{window} must be a live window and defaults to the selected one. 2311@var{window} must be a live window and defaults to the selected one.
2096With prefix argument @var{kill} non-@code{nil}, it kills the buffer 2312With prefix argument @var{kill} non-@code{nil}, it kills the buffer
2097instead of burying it. 2313instead of burying it. It calls the function @code{quit-restore-window}
2098 2314described next to deal with the window and its buffer.
2099Quitting @var{window} means to proceed as follows: If @var{window} was
2100created specially for displaying its current buffer, delete @var{window}
2101provided its frame contains at least one other live window. If
2102@var{window} is the only window on its frame and there are other frames
2103on the frame's terminal, the value of @var{kill} determines how to
2104proceed with the window. If @var{kill} is @code{nil}, the fate of the
2105frame is determined by calling @code{frame-auto-hide-function} (see
2106below) with that frame as sole argument. If @var{kill} is
2107non-@code{nil}, the frame is deleted unconditionally.
2108
2109If @var{window} was reused for displaying its buffer, this command tries
2110to display the buffer previously shown in it. It also tries to restore
2111the window start (@pxref{Window Start and End}) and point (@pxref{Window
2112Point}) positions of the previously shown buffer. If, in addition, the
2113current buffer was temporarily resized, this command will also try to
2114restore the original height of @var{window}.
2115
2116The three cases described so far require that the buffer shown in
2117@var{window} is still the buffer displayed by the last buffer display
2118function for this window. If another buffer has been shown in the
2119meantime, or the buffer previously shown no longer exists, this command
2120calls @code{switch-to-prev-buffer} (@pxref{Window History}) to show some
2121other buffer instead.
2122@end deffn 2315@end deffn
2123 2316
2124The function @code{quit-window} bases its decisions on information 2317@defun quit-restore-window &optional window bury-or-kill
2125stored in @var{window}'s @code{quit-restore} window parameter 2318This function tries to restore the state of @var{window} that existed
2126(@pxref{Window Parameters}), and resets that parameter to @code{nil} 2319before its buffer was displayed in it. The optional argument
2127after it's done. 2320@var{window} must be a live window and defaults to the selected one.
2321
2322If @var{window} was created specially for displaying its buffer, this
2323function deletes @var{window} provided its frame contains at least one
2324other live window. If @var{window} is the only window on its frame and
2325there are other frames on the frame's terminal, the value of the
2326optional argument @var{bury-or-kill} determines how to proceed with the
2327window. If @var{bury-or-kill} equals @code{kill}, the frame is deleted
2328unconditionally. Otherwise, the fate of the frame is determined by
2329calling @code{frame-auto-hide-function} (see below) with that frame as
2330sole argument.
2331
2332Otherwise, this function tries to redisplay the buffer previously shown
2333in @var{window}. It also tries to restore the window start
2334(@pxref{Window Start and End}) and point (@pxref{Window Point})
2335positions of the previously shown buffer. If, in addition,
2336@var{window}'s buffer was temporarily resized, this function will also
2337try to restore the original height of @var{window}.
2338
2339The cases described so far require that the buffer shown in @var{window}
2340is still the buffer displayed by the last buffer display function for
2341this window. If another buffer has been shown in the meantime, or the
2342buffer previously shown no longer exists, this function calls
2343@code{switch-to-prev-buffer} (@pxref{Window History}) to show some other
2344buffer instead.
2345
2346The optional argument @var{bury-or-kill} specifes how to deal with
2347@var{window}'s buffer. The following values are handled:
2348
2349@table @code
2350@item nil
2351This means to not deal with the buffer in any particular way. As a
2352consequence, if @var{window} is not deleted, invoking
2353@code{switch-to-prev-buffer} will usually show the buffer again.
2354
2355@item append
2356This means that if @var{window} is not deleted, its buffer is moved to
2357the end of @var{window}'s list of previous buffers, so it's less likely
2358that a future invocation of @code{switch-to-prev-buffer} will switch to
2359it. Also, it moves the buffer to the end of the frame's buffer list.
2360
2361@item bury
2362This means that if @var{window} is not deleted, its buffer is removed
2363from @var{window}'s list of previous buffers. Also, it moves the buffer
2364to the end of the frame's buffer list. This value provides the most
2365reliable remedy to not have @code{switch-to-prev-buffer} switch to this
2366buffer again without killing the buffer.
2367
2368@item kill
2369This means to kill @var{window}'s buffer.
2370@end table
2371
2372@code{quit-restore-window} bases its decisions on information stored in
2373@var{window}'s @code{quit-restore} window parameter (@pxref{Window
2374Parameters}), and resets that parameter to @code{nil} after it's done.
2375@end defun
2128 2376
2129The following option specifies how to deal with a frame containing just 2377The following option specifies how to deal with a frame containing just
2130one window that should be either quit, or whose buffer should be buried. 2378one window that should be either quit, or whose buffer should be buried.
@@ -2135,10 +2383,9 @@ frames. This function is called with one argument---a frame.
2135 2383
2136The function specified here is called by @code{bury-buffer} (@pxref{The 2384The function specified here is called by @code{bury-buffer} (@pxref{The
2137Buffer List}) when the selected window is dedicated and shows the buffer 2385Buffer List}) when the selected window is dedicated and shows the buffer
2138that should be buried. It is also called by @code{quit-window} (see 2386to bury. It is also called by @code{quit-restore-window} (see above)
2139above) when the frame of the window that should be quit has been 2387when the frame of the window to quit has been specially created for
2140specially created for displaying that window's buffer and the buffer 2388displaying that window's buffer and the buffer is not killed.
2141should be buried.
2142 2389
2143The default is to call @code{iconify-frame} (@pxref{Visibility of 2390The default is to call @code{iconify-frame} (@pxref{Visibility of
2144Frames}). Alternatively, you may specify either @code{delete-frame} 2391Frames}). Alternatively, you may specify either @code{delete-frame}
@@ -2146,9 +2393,9 @@ Frames}). Alternatively, you may specify either @code{delete-frame}
2146@code{ignore} to leave the frame unchanged, or any other function that 2393@code{ignore} to leave the frame unchanged, or any other function that
2147can take a frame as its sole argument. 2394can take a frame as its sole argument.
2148 2395
2149Note that the function specified by this option is called if and only if 2396Note that the function specified by this option is called only if the
2150there is at least one other frame on the terminal of the frame it's 2397specified frame contains just one live window and there is at least one
2151supposed to handle, and that frame contains only one live window. 2398other frame on the same terminal.
2152@end defopt 2399@end defopt
2153 2400
2154 2401
@@ -3123,8 +3370,8 @@ frame into the root window of that very frame only).
3123 3370
3124@defun window-state-get &optional window writable 3371@defun window-state-get &optional window writable
3125This function returns the state of @var{window} as a Lisp object. The 3372This function returns the state of @var{window} as a Lisp object. The
3126argument @var{window} can be any window and defaults to the root window 3373argument @var{window} must be a valid window and defaults to the root
3127of the selected frame. 3374window of the selected frame.
3128 3375
3129If the optional argument @var{writable} is non-@code{nil}, this means to 3376If the optional argument @var{writable} is non-@code{nil}, this means to
3130not use markers for sampling positions like @code{window-point} or 3377not use markers for sampling positions like @code{window-point} or
@@ -3267,10 +3514,28 @@ from. It is installed by @code{window-state-get} (@pxref{Window
3267Configurations}). 3514Configurations}).
3268 3515
3269@item @code{quit-restore} 3516@item @code{quit-restore}
3270This parameter specifies what to do with a window when the buffer it 3517This parameter is installed by the buffer display functions
3271shows is not needed any more. It is installed by the buffer display 3518(@pxref{Choosing Window}) and consulted by @code{quit-restore-window}
3272functions (@pxref{Choosing Window}), and consulted by the function 3519(@pxref{Quitting Windows}). It contains four elements:
3273@code{quit-window} (@pxref{Quitting Windows}). 3520
3521The first element is one of the symbols @code{window} - meaning that the
3522window has been specially created by @code{display-buffer}, @code{frame}
3523- a separate frame has been created, @code{same} - the window has
3524displayed the same buffer before, or @code{other} - the window showed
3525another buffer before.
3526
3527The second element is either one of the symbols @code{window} or
3528@code{frame}, or a list whose elements are the buffer shown in the
3529window before, that buffer's window start and window point positions,
3530and the window's height at that time.
3531
3532The third element is the window selected at the time the parameter was
3533created. The function @code{quit-restore-window} tries to reselect that
3534window when it deletes the window passed to it as argument.
3535
3536The fourth element is the buffer whose display caused the creation of
3537this parameter. @code{quit-restore-window} deletes the specified window
3538only if it still shows that buffer.
3274@end table 3539@end table
3275 3540
3276There are additional parameters @code{window-atom} and @code{window-side}; 3541There are additional parameters @code{window-atom} and @code{window-side};