diff options
| author | Eli Zaretskii | 2012-11-13 16:17:18 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2012-11-13 16:17:18 +0200 |
| commit | 3c4ca7155293ffc2d04708007131bcbc882d8913 (patch) | |
| tree | 61787be8cd43b6fb3d5159852fbd186eea404de7 /doc/lispref | |
| parent | 5ade42a5114255c43117065494b96d480c1e1588 (diff) | |
| parent | c708524567662c8911c5ab2695acc7bda0383705 (diff) | |
| download | emacs-3c4ca7155293ffc2d04708007131bcbc882d8913.tar.gz emacs-3c4ca7155293ffc2d04708007131bcbc882d8913.zip | |
Merge from trunk.
Diffstat (limited to 'doc/lispref')
| -rw-r--r-- | doc/lispref/ChangeLog | 82 | ||||
| -rw-r--r-- | doc/lispref/control.texi | 13 | ||||
| -rw-r--r-- | doc/lispref/debugging.texi | 29 | ||||
| -rw-r--r-- | doc/lispref/edebug.texi | 4 | ||||
| -rw-r--r-- | doc/lispref/elisp.texi | 7 | ||||
| -rw-r--r-- | doc/lispref/errors.texi | 3 | ||||
| -rw-r--r-- | doc/lispref/frames.texi | 14 | ||||
| -rw-r--r-- | doc/lispref/lists.texi | 44 | ||||
| -rw-r--r-- | doc/lispref/objects.texi | 146 | ||||
| -rw-r--r-- | doc/lispref/os.texi | 49 | ||||
| -rw-r--r-- | doc/lispref/searching.texi | 27 | ||||
| -rw-r--r-- | doc/lispref/variables.texi | 123 | ||||
| -rw-r--r-- | doc/lispref/windows.texi | 755 |
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 @@ | |||
| 1 | 2012-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 | |||
| 16 | 2012-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 | |||
| 23 | 2012-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 | |||
| 36 | 2012-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 | |||
| 48 | 2012-11-10 Chong Yidong <cyd@gnu.org> | ||
| 49 | |||
| 50 | * frames.texi (Initial Parameters): Doc fix (Bug#12144). | ||
| 51 | |||
| 52 | 2012-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 | |||
| 59 | 2012-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 | |||
| 67 | 2012-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 | |||
| 1 | 2012-10-31 Glenn Morris <rgm@gnu.org> | 83 | 2012-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 | ||
| 829 | This function behaves exactly like @code{error}, except that it uses | ||
| 830 | the error symbol @code{user-error} rather than @code{error}. As the | ||
| 831 | name suggests, this is intended to report errors on the part of the | ||
| 832 | user, rather than errors in the code itself. For example, | ||
| 833 | if you try to use the command @code{Info-history-back} (@kbd{l}) to | ||
| 834 | move back beyond the start of your Info browsing history, Emacs | ||
| 835 | signals a @code{user-error}. Such errors do not cause entry to the | ||
| 836 | debugger, 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 | |||
| 117 | any of the regular expressions, then that error does not enter the | 117 | any of the regular expressions, then that error does not enter the |
| 118 | debugger. | 118 | debugger. |
| 119 | 119 | ||
| 120 | The normal value of this variable lists several errors that happen | 120 | The normal value of this variable includes @code{user-error}, as well |
| 121 | often during editing but rarely result from bugs in Lisp programs. | 121 | as several errors that happen often during editing but rarely result |
| 122 | However, ``rarely'' is not ``never''; if your program fails with an | 122 | from bugs in Lisp programs. However, ``rarely'' is not ``never''; if |
| 123 | error that matches this list, you may try changing this list to debug | 123 | your program fails with an error that matches this list, you may try |
| 124 | the error. The easiest way is usually to set | 124 | changing this list to debug the error. The easiest way is usually to |
| 125 | @code{debug-ignored-errors} to @code{nil}. | 125 | set @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 | ||
| 168 | If you set @code{debug-on-message} to a regular expression, | ||
| 169 | Emacs will enter the debugger if it displays a matching message in the | ||
| 170 | echo area. For example, this can be useful when trying to find the | ||
| 171 | cause 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 |
| 167 | file, use the option @samp{--debug-init}. This binds | 175 | file, 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 | |||
| 314 | as the error message and associated data, if it was invoked due to an | 322 | as the error message and associated data, if it was invoked due to an |
| 315 | error). | 323 | error). |
| 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, |
| 318 | Debugger mode, in which letters are defined as debugger commands. The | 327 | Debugger mode, in which letters are defined as debugger commands. The |
| 319 | usual Emacs editing commands are available; thus, you can switch windows | 328 | usual 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, | |||
| 322 | the debugger is a recursive editing level (@pxref{Recursive Editing}) | 331 | the debugger is a recursive editing level (@pxref{Recursive Editing}) |
| 323 | and it is wise to go back to the backtrace buffer and exit the debugger | 332 | and 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 |
| 325 | the debugger gets out of the recursive edit and kills the backtrace | 334 | the debugger gets out of the recursive edit and buries the backtrace |
| 326 | buffer. | 335 | buffer. (You can customize what the @kbd{q} command does with the |
| 336 | backtrace buffer by setting the variable @code{debugger-bury-or-kill}. | ||
| 337 | For example, set it to @code{kill} if you prefer to kill the buffer | ||
| 338 | rather than bury it. Consult the variable's documentation for more | ||
| 339 | possibilities.) | ||
| 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} |
| 329 | variable is temporarily set according to | 342 | variable 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. | |||
| 1211 | A single evaluated expression, which is instrumented. | 1211 | A 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. | 1214 | A generalized variable. @xref{Generalized Variables}. |
| 1215 | @c @findex edebug-unwrap | ||
| 1216 | A place to store a value, as in the Common Lisp @code{setf} construct. | ||
| 1217 | 1215 | ||
| 1218 | @item body | 1216 | @item body |
| 1219 | Short for @code{&rest form}. See @code{&rest} below. | 1217 | Short 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 | ||
| 505 | Generalized Variables | ||
| 506 | |||
| 507 | * Setting Generalized Variables:: The @code{setf} macro. | ||
| 508 | * Adding Generalized Variables:: Defining new @code{setf} forms. | ||
| 509 | |||
| 505 | Functions | 510 | Functions |
| 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 |
| 173 | The message is @samp{Undefined color}. @xref{Color Names}. | 173 | The message is @samp{Undefined color}. @xref{Color Names}. |
| 174 | 174 | ||
| 175 | @item user-error | ||
| 176 | The message is the empty string. @xref{Signaling Errors}. | ||
| 177 | |||
| 175 | @item void-function | 178 | @item void-function |
| 176 | The message is @samp{Symbol's function definition is void}. | 179 | The 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 | ||
| 422 | If these parameters specify a separate @dfn{minibuffer-only frame} with | ||
| 423 | @code{(minibuffer . nil)}, and you have not created one, Emacs creates | ||
| 424 | one for you. | ||
| 425 | |||
| 426 | @cindex minibuffer-only frame | 422 | @cindex minibuffer-only frame |
| 423 | If these parameters include @code{(minibuffer . nil)}, that indicates | ||
| 424 | that the initial frame should have no minibuffer. In this case, Emacs | ||
| 425 | creates a separate @dfn{minibuffer-only frame} as well. | ||
| 426 | |||
| 427 | @defopt minibuffer-frame-alist | 427 | @defopt minibuffer-frame-alist |
| 428 | This variable's value is an alist of parameter values used when | 428 | This variable's value is an alist of parameter values used when |
| 429 | creating an initial minibuffer-only frame. This is the | 429 | creating an initial minibuffer-only frame (i.e.@: the minibuffer-only |
| 430 | minibuffer-only frame that Emacs creates if @code{initial-frame-alist} | 430 | frame that Emacs creates if @code{initial-frame-alist} specifies a |
| 431 | specifies a frame with no minibuffer. | 431 | frame 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 |
| 237 | This macro is a way of examining the @sc{car} of a list, | 237 | This macro provides a convenient way to examine the @sc{car} of a |
| 238 | and taking it off the list, all at once. | 238 | list, 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, | 239 | stored in @var{listname}. It removes the first element from the list, |
| 240 | @c but generalized variables have not been introduced yet. | 240 | saves the @sc{cdr} into @var{listname}, then returns the removed |
| 241 | (In fact, this macro can act on generalized variables, not just lists. | 241 | element. |
| 242 | @xref{Generalized Variables}.) | 242 | |
| 243 | 243 | In the simplest case, @var{listname} is an unquoted symbol naming a | |
| 244 | It operates on the list which is stored in the symbol @var{listname}. | 244 | list; in that case, this macro is equivalent to @w{@code{(prog1 |
| 245 | It removes this element from the list by setting @var{listname} | 245 | (car listname) (setq listname (cdr listname)))}}. |
| 246 | to the @sc{cdr} of its old value---but it also returns the @sc{car} | ||
| 247 | of that list, which is the element being removed. | ||
| 248 | 246 | ||
| 249 | @example | 247 | @example |
| 250 | x | 248 | x |
| @@ -255,7 +253,10 @@ x | |||
| 255 | @result{} (b c) | 253 | @result{} (b c) |
| 256 | @end example | 254 | @end example |
| 257 | 255 | ||
| 258 | @noindent | 256 | More generally, @var{listname} can be a generalized variable. In that |
| 257 | case, this macro saves into @var{listname} using @code{setf}. | ||
| 258 | @xref{Generalized Variables}. | ||
| 259 | |||
| 259 | For the @code{push} macro, which adds an element to a list, | 260 | For 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 |
| 684 | to modify a list which is stored in a variable. | 685 | to modify a list which is stored in a variable. |
| 685 | 686 | ||
| 686 | @defmac push newelt listname | 687 | @defmac push element listname |
| 687 | This macro provides an alternative way to write | 688 | This macro creates a new list whose @sc{car} is @var{element} and |
| 688 | @code{(setq @var{listname} (cons @var{newelt} @var{listname}))}. | 689 | whose @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, | 690 | list in @var{listname}. In the simplest case, @var{listname} is an |
| 690 | @c but generalized variables have not been introduced yet. | 691 | unquoted symbol naming a list, and this macro is equivalent |
| 691 | (In fact, this macro can act on generalized variables, not just lists. | 692 | to @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 | 703 | More generally, @code{listname} can be a generalized variable. In |
| 704 | that case, this macro does the equivalent of @w{@code{(setf | ||
| 705 | @var{listname} (cons @var{element} @var{listname}))}}. | ||
| 706 | @xref{Generalized Variables}. | ||
| 707 | |||
| 704 | For the @code{pop} macro, which removes the first element from a list, | 708 | For 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.) | |||
| 351 | control characters, Emacs provides several types of escape syntax that | 351 | control characters, Emacs provides several types of escape syntax that |
| 352 | you can use to specify non-@acronym{ASCII} text characters. | 352 | you 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 | ||
| 357 | code point @samp{U+@var{nnnn}} (by convention, Unicode code points are | ||
| 358 | given in hexadecimal). There is a slightly different syntax for | ||
| 359 | specifying characters with code points higher than | ||
| 360 | @code{U+@var{ffff}}: @code{\U00@var{nnnnnn}} represents the character | ||
| 361 | whose code point is @samp{U+@var{nnnnnn}}. The Unicode Standard only | ||
| 362 | defines code points up to @samp{U+@var{10ffff}}, so if you specify a | ||
| 363 | code point higher than that, Emacs signals an error. | ||
| 364 | |||
| 365 | This peculiar and inconvenient syntax was adopted for compatibility | ||
| 366 | with other programming languages. Unlike some other languages, Emacs | ||
| 367 | Lisp 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. |
| 373 | character code in either octal or hex. To use octal, write a question | 358 | @code{?\u@var{nnnn}} represents a character with Unicode code point |
| 374 | mark 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 |
| 375 | octal digits); thus, @samp{?\101} for the character @kbd{A}, | 360 | number with exactly four digits. The backslash indicates that the |
| 376 | @samp{?\001} for the character @kbd{C-a}, and @code{?\002} for the | 361 | subsequent characters form an escape sequence, and the @samp{u} |
| 377 | character @kbd{C-b}. Although this syntax can represent any | 362 | specifies a Unicode escape sequence. |
| 378 | @acronym{ASCII} character, it is preferred only when the precise octal | 363 | |
| 379 | value is more important than the @acronym{ASCII} representation. | 364 | There is a slightly different syntax for specifying Unicode |
| 380 | 365 | characters 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 | 368 | number. 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 | 370 | that, 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}, | 373 | codes. A hexadecimal escape sequence consists of a backslash, |
| 389 | and the hexadecimal character code. You can use any number of hex | 374 | @samp{x}, and the hexadecimal character code. Thus, @samp{?\x41} is |
| 390 | digits, so you can represent any character code in this way. | 375 | the character @kbd{A}, @samp{?\x1} is the character @kbd{C-a}, and |
| 391 | Thus, @samp{?\x41} for the character @kbd{A}, @samp{?\x1} for the | 376 | @code{?\xe0} is the character |
| 392 | character @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 |
| 383 | You can use any number of hex digits, so you can represent any | ||
| 384 | character code in this way. | ||
| 385 | |||
| 386 | @cindex octal character code | ||
| 387 | Thirdly, you can specify characters by their character code in | ||
| 388 | octal. An octal escape sequence consists of a backslash followed by | ||
| 389 | up to three octal digits; thus, @samp{?\101} for the character | ||
| 390 | @kbd{A}, @samp{?\001} for the character @kbd{C-a}, and @code{?\002} | ||
| 391 | for the character @kbd{C-b}. Only characters up to octal code 777 can | ||
| 392 | be specified this way. | ||
| 393 | |||
| 394 | These escape sequences may also be used in strings. @xref{Non-ASCII | ||
| 395 | in 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} |
| 1030 | string constant by writing it literally. There are two text | 1027 | characters in Emacs strings: multibyte and unibyte (@pxref{Text |
| 1031 | representations for non-@acronym{ASCII} characters in Emacs strings | 1028 | Representations}). Roughly speaking, unibyte strings store raw bytes, |
| 1032 | (and in buffers): unibyte and multibyte (@pxref{Text | 1029 | while multibyte strings store human-readable text. Each character in |
| 1033 | Representations}). If the string constant is read from a multibyte | 1030 | a unibyte string is a byte, i.e.@: its value is between 0 and 255. By |
| 1034 | source, such as a multibyte buffer or string, or a file that would be | 1031 | contrast, each character in a multibyte string may have a value |
| 1035 | visited as multibyte, then Emacs reads the non-@acronym{ASCII} | 1032 | between 0 to 4194303 (@pxref{Character Type}). In both cases, |
| 1036 | character as a multibyte character and automatically makes the string | 1033 | characters above 127 are non-@acronym{ASCII}. |
| 1037 | a multibyte string. If the string constant is read from a unibyte | 1034 | |
| 1038 | source, then Emacs reads the non-@acronym{ASCII} character as unibyte, | 1035 | You can include a non-@acronym{ASCII} character in a string constant |
| 1039 | and makes the string unibyte. | 1036 | by writing it literally. If the string constant is read from a |
| 1040 | 1037 | multibyte source, such as a multibyte buffer or string, or a file that | |
| 1041 | Instead of writing a non-@acronym{ASCII} character literally into a | 1038 | would be visited as multibyte, then Emacs reads each |
| 1042 | multibyte string, you can write it as its character code using a hex | 1039 | non-@acronym{ASCII} character as a multibyte character and |
| 1043 | escape, @samp{\x@var{nnnnnnn}}, with as many digits as necessary. | 1040 | automatically makes the string a multibyte string. If the string |
| 1044 | (Multibyte non-@acronym{ASCII} character codes are all greater than | 1041 | constant is read from a unibyte source, then Emacs reads the |
| 1045 | 256.) You can also specify a character in a multibyte string using | 1042 | non-@acronym{ASCII} character as unibyte, and makes the string |
| 1046 | the @samp{\u} or @samp{\U} Unicode escape syntax (@pxref{General | 1043 | unibyte. |
| 1047 | Escape Syntax}). In either case, any character which is not a valid | 1044 | |
| 1048 | hex digit terminates the construct. If the next character in the | 1045 | Instead of writing a character literally into a multibyte string, |
| 1049 | string could be interpreted as a hex digit, write @w{@samp{\ }} | 1046 | you 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} | ||
| 1051 | character), Emacs automatically assumes that it is multibyte. | ||
| 1052 | |||
| 1053 | You can also use hexadecimal escape sequences (@samp{\x@var{n}}) and | ||
| 1054 | octal escape sequences (@samp{\@var{n}}) in string constants. | ||
| 1055 | @strong{But beware:} If a string constant contains hexadecimal or | ||
| 1056 | octal escape sequences, and these escape sequences all specify unibyte | ||
| 1057 | characters (i.e.@: less than 256), and there are no other literal | ||
| 1058 | non-@acronym{ASCII} characters or Unicode-style escape sequences in | ||
| 1059 | the string, then Emacs automatically assumes that it is a unibyte | ||
| 1060 | string. That is to say, it assumes that all non-@acronym{ASCII} | ||
| 1061 | characters occurring in the string are 8-bit raw bytes. | ||
| 1062 | |||
| 1063 | In hexadecimal and octal escape sequences, the escaped character | ||
| 1064 | code may contain a variable number of digits, so the first subsequent | ||
| 1065 | character which is not a valid hexadecimal or octal digit terminates | ||
| 1066 | the escape sequence. If the next character in a string could be | ||
| 1067 | interpreted 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 |
| 1052 | accent. @w{@samp{\ }} in a string constant is just like | 1070 | accent. @w{@samp{\ }} in a string constant is just like |
| 1053 | backslash-newline; it does not contribute any character to the string, | 1071 | backslash-newline; it does not contribute any character to the string, |
| 1054 | but it does terminate the preceding hex escape. Using any hex escape | 1072 | but it does terminate any preceding hex escape. |
| 1055 | in a string (even for an @acronym{ASCII} character) automatically | ||
| 1056 | forces the string to be multibyte. | ||
| 1057 | |||
| 1058 | You can represent a unibyte non-@acronym{ASCII} character with its | ||
| 1059 | character code, which must be in the range from 128 (0200 octal) to | ||
| 1060 | 255 (0377 octal). If you write all such character codes in octal and | ||
| 1061 | the string contains no other characters forcing it to be multibyte, | ||
| 1062 | this 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. | |||
| 2276 | The supported keywords and values are as follows: | 2276 | The supported keywords and values are as follows: |
| 2277 | 2277 | ||
| 2278 | @table @code | 2278 | @table @code |
| 2279 | @item :bus @var{bus} | ||
| 2280 | The 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} |
| 2280 | The notification title. | 2284 | The notification title. |
| 2281 | 2285 | ||
| 2282 | @item :body @var{text} | 2286 | @item :body @var{text} |
| 2283 | The notification body text. Depending on the implementation of the | 2287 | The notification body text. Depending on the implementation of the |
| 2284 | notification server, the text could contain HTML markups, like | 2288 | notification 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 |
| 2290 | characters must be encoded, as @samp{"Contact | ||
| 2291 | <postmaster@@localhost>!"}. | ||
| 2286 | 2292 | ||
| 2287 | @item :app-name @var{name} | 2293 | @item :app-name @var{name} |
| 2288 | The name of the application sending the notification. The default is | 2294 | The 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 | |||
| 2317 | interpreted as icon name. | 2323 | interpreted as icon name. |
| 2318 | 2324 | ||
| 2319 | @item :category @var{category} | 2325 | @item :category @var{category} |
| 2320 | The type of notification this is, a string. | 2326 | The type of notification this is, a string. See the |
| 2327 | @uref{http://developer.gnome.org/notification-spec/#categories, | ||
| 2328 | Desktop Notifications Specification} for a list of standard | ||
| 2329 | categories. | ||
| 2321 | 2330 | ||
| 2322 | @item :desktop-entry @var{filename} | 2331 | @item :desktop-entry @var{filename} |
| 2323 | This specifies the name of the desktop filename representing the | 2332 | This 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 |
| 2424 | This function closes a notification with identifier @var{id}. | 2433 | This 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 |
| 2428 | Returns the capabilities of the notification server, a list of strings. | 2439 | Returns the capabilities of the notification server, a list of |
| 2429 | The following capabilities can be expected: | 2440 | symbols. @var{bus} can be a string denoting a D-Bus connection, the |
| 2441 | default is @code{:session}. The following capabilities can be | ||
| 2442 | expected: | ||
| 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 | ||
| 2480 | Return 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 | ||
| 2487 | The product name of the server. | ||
| 2488 | |||
| 2489 | @item vendor | ||
| 2490 | The vendor name. For example, @samp{"KDE"}, @samp{"GNOME"}. | ||
| 2491 | |||
| 2492 | @item version | ||
| 2493 | The server's version number. | ||
| 2494 | |||
| 2495 | @item spec-version | ||
| 2496 | The specification version the server is compliant with. | ||
| 2497 | @end table | ||
| 2498 | |||
| 2499 | If @var{SPEC_VERSION} is @code{nil}, the server supports a | ||
| 2500 | specification 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. | 1313 | This 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 | 1317 | This stands for the text that matched the @var{n}th subexpression in |
| 1318 | matched the @var{n}th subexpression in the original regexp. | 1318 | the original regexp. Subexpressions are those expressions grouped |
| 1319 | Subexpressions are those expressions grouped inside @samp{\(@dots{}\)}. | 1319 | inside @samp{\(@dots{}\)}. If the @var{n}th subexpression never |
| 1320 | If the @var{n}th subexpression never matched, an empty string is substituted. | 1320 | matched, 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. | 1324 | This stands for a single @samp{\} in the replacement text. |
| 1325 | |||
| 1326 | @item @samp{\?} | ||
| 1327 | This stands for itself (for compatibility with @code{replace-regexp} | ||
| 1328 | and related commands; @pxref{Regexp Replacement,,, emacs, The GNU | ||
| 1329 | Emacs Manual}). | ||
| 1325 | @end table | 1330 | @end table |
| 1326 | 1331 | ||
| 1327 | These substitutions occur after case conversion, if any, | 1332 | @noindent |
| 1328 | so the strings they substitute are never case-converted. | 1333 | Any other character following @samp{\} signals an error. |
| 1334 | |||
| 1335 | The substitutions performed by @samp{\&} and @samp{\@var{n}} occur | ||
| 1336 | after case conversion, if any. Therefore, the strings they substitute | ||
| 1337 | are never case-converted. | ||
| 1329 | 1338 | ||
| 1330 | If @var{subexp} is non-@code{nil}, that says to replace just | 1339 | If @var{subexp} is non-@code{nil}, that says to replace just |
| 1331 | subexpression number @var{subexp} of the regexp that was matched, not | 1340 | subexpression 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 | ||
| 1266 | This macro creates a buffer-local binding in the current buffer for | ||
| 1267 | @var{variable}, and gives it the buffer-local value @var{value}. It | ||
| 1268 | is 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 |
| 1266 | This function marks @var{variable} (a symbol) automatically | 1273 | This function marks @var{variable} (a symbol) automatically |
| 1267 | buffer-local, so that any subsequent attempt to set it will make it | 1274 | buffer-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 | ||
| 1308 | This macro defines @var{variable} as a variable with initial value | ||
| 1309 | @var{value} and @var{docstring}, and marks it as automatically | ||
| 1310 | buffer-local. It is equivalent to calling @code{defvar} followed by | ||
| 1311 | @code{make-variable-buffer-local}. @var{variable} should be an | ||
| 1312 | unquoted symbol. | ||
| 1313 | @end defmac | ||
| 1314 | |||
| 1300 | @defun local-variable-p variable &optional buffer | 1315 | @defun local-variable-p variable &optional buffer |
| 1301 | This returns @code{t} if @var{variable} is buffer-local in buffer | 1316 | This 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 | |||
| 1958 | of arrays, properties of symbols, and many other locations are also | 1972 | of arrays, properties of symbols, and many other locations are also |
| 1959 | places where Lisp values are stored. | 1973 | places where Lisp values are stored. |
| 1960 | 1974 | ||
| 1961 | @c FIXME? Not sure this is a useful analogy... | ||
| 1962 | Generalized variables are analogous to ``lvalues'' in the C | 1975 | Generalized variables are analogous to ``lvalues'' in the C |
| 1963 | language, where @samp{x = a[i]} gets an element from an array | 1976 | language, where @samp{x = a[i]} gets an element from an array |
| 1964 | and @samp{a[i] = x} stores an element using the same notation. | 1977 | and @samp{a[i] = x} stores an element using the same notation. |
| 1965 | Just as certain forms like @code{a[i]} can be lvalues in C, there | 1978 | Just as certain forms like @code{a[i]} can be lvalues in C, there |
| 1966 | is a set of forms that can be generalized variables in Lisp. | 1979 | is 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 | |||
| 1968 | The @code{setf} macro is the most basic way to operate on generalized | 1989 | The @code{setf} macro is the most basic way to operate on generalized |
| 1969 | variables. The @code{setf} form is like @code{setq}, except that it | 1990 | variables. The @code{setf} form is like @code{setq}, except that it |
| 1970 | accepts arbitrary place forms on the left side rather than just | 1991 | accepts 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. | |||
| 1998 | A call to any of the following standard Lisp functions: | 2019 | A call to any of the following standard Lisp functions: |
| 1999 | 2020 | ||
| 2000 | @smallexample | 2021 | @smallexample |
| 2001 | car cdr nth nthcdr | 2022 | aref cddr symbol-function |
| 2002 | caar cadr cdar cddr | 2023 | car elt symbol-plist |
| 2003 | aref elt get gethash | 2024 | caar get symbol-value |
| 2004 | symbol-function symbol-value symbol-plist | 2025 | cadr gethash |
| 2026 | cdr nth | ||
| 2027 | cdar nthcdr | ||
| 2005 | @end smallexample | 2028 | @end smallexample |
| 2006 | 2029 | ||
| 2007 | @item | 2030 | @item |
| 2008 | The following Emacs-specific functions are also @code{setf}-able: | 2031 | A call to any of the following Emacs-specific functions: |
| 2009 | 2032 | ||
| 2010 | @smallexample | 2033 | @smallexample |
| 2011 | default-value process-get | 2034 | default-value process-get |
| @@ -2022,8 +2045,8 @@ process-filter | |||
| 2022 | @end itemize | 2045 | @end itemize |
| 2023 | 2046 | ||
| 2024 | @noindent | 2047 | @noindent |
| 2025 | Using 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. | 2049 | does 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. |
| 2029 | Note that for @code{nthcdr}, the list argument of the function must | 2052 | Note 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. | |||
| 2049 | The @file{cl-lib} library defines various extensions for generalized | 2072 | The @file{cl-lib} library defines various extensions for generalized |
| 2050 | variables, including additional @code{setf} places. | 2073 | variables, 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 | |||
| 2080 | This section describes how to define new forms that @code{setf} can | ||
| 2081 | operate on. | ||
| 2082 | |||
| 2083 | @defmac gv-define-simple-setter name setter &optional fix-return | ||
| 2084 | This macro enables you to easily define @code{setf} methods for simple | ||
| 2085 | cases. @var{name} is the name of a function, macro, or special form. | ||
| 2086 | You can use this macro whenever @var{name} has a directly | ||
| 2087 | corresponding @var{setter} function that updates it, e.g., | ||
| 2088 | @code{(gv-define-simple-setter car setcar)}. | ||
| 2089 | |||
| 2090 | This macro translates a call of the form | ||
| 2091 | |||
| 2092 | @example | ||
| 2093 | (setf (@var{name} @var{args}@dots{}) @var{value}) | ||
| 2094 | @end example | ||
| 2095 | |||
| 2096 | into | ||
| 2097 | @example | ||
| 2098 | (@var{setter} @var{args}@dots{} @var{value}) | ||
| 2099 | @end example | ||
| 2100 | |||
| 2101 | @noindent | ||
| 2102 | Such a @code{setf} call is documented to return @var{value}. This is | ||
| 2103 | no problem with, e.g., @code{car} and @code{setcar}, because | ||
| 2104 | @code{setcar} returns the value that it set. If your @var{setter} | ||
| 2105 | function does not return @var{value}, use a non-@code{nil} value for | ||
| 2106 | the @var{fix-return} argument of @code{gv-define-simple-setter}. This | ||
| 2107 | expands into something equivalent to | ||
| 2108 | @example | ||
| 2109 | (let ((temp @var{value})) | ||
| 2110 | (@var{setter} @var{args}@dots{} temp) | ||
| 2111 | temp) | ||
| 2112 | @end example | ||
| 2113 | so ensuring that it returns the correct result. | ||
| 2114 | @end defmac | ||
| 2115 | |||
| 2116 | |||
| 2117 | @defmac gv-define-setter name arglist &rest body | ||
| 2118 | This macro allows for more complex @code{setf} expansions than the | ||
| 2119 | previous form. You may need to use this form, for example, if there | ||
| 2120 | is no simple setter function to call, or if there is one but it | ||
| 2121 | requires different arguments to the place form. | ||
| 2122 | |||
| 2123 | This macro expands the form | ||
| 2124 | @code{(setf (@var{name} @var{args}@dots{}) @var{value})} by | ||
| 2125 | first binding the @code{setf} argument forms | ||
| 2126 | @code{(@var{value} @var{args}@dots{})} according to @var{arglist}, | ||
| 2127 | and then executing @var{body}. @var{body} should return a Lisp | ||
| 2128 | form that does the assignment, and finally returns the value that was | ||
| 2129 | set. 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. | ||
| 2140 | For more control over the expansion, see the macro @code{gv-define-expander}. | ||
| 2141 | The macro @code{gv-letplace} can be useful in defining macros that | ||
| 2142 | perform similarly to @code{setf}; for example, the @code{incf} macro | ||
| 2143 | of 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'', | ||
| 2149 | whose names are lists @code{(setf @var{name})} rather than symbols. | ||
| 2150 | For example, @code{(defun (setf foo) @dots{})} defines the function | ||
| 2151 | that is used when @code{setf} is applied to @code{foo}. Emacs does | ||
| 2152 | not support this. It is a compile-time error to use @code{setf} on a | ||
| 2153 | form that has not already had an appropriate expansion defined. In | ||
| 2154 | Common 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. | |||
| 587 | The choice of which window edges this function alters depends on the | 589 | The choice of which window edges this function alters depends on the |
| 588 | values of the option @code{window-combination-resize} and the | 590 | values of the option @code{window-combination-resize} and the |
| 589 | combination limits of the involved windows; in some cases, it may alter | 591 | combination limits of the involved windows; in some cases, it may alter |
| 590 | both edges. @xref{Splitting Windows}. To resize by moving only the | 592 | both edges. @xref{Recombining Windows}. To resize by moving only the |
| 591 | bottom or right edge of a window, use the function | 593 | bottom 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 | |||
| 795 | window @var{W3}. A new internal window @var{W1} is created, becoming | 797 | window @var{W3}. A new internal window @var{W1} is created, becoming |
| 796 | the new root window. | 798 | the new root window. |
| 797 | 799 | ||
| 798 | @defopt window-combination-resize | 800 | For interactive use, Emacs provides two commands which always split |
| 799 | If this variable is @code{nil}, @code{split-window} can only split a | 801 | the selected window. These call @code{split-window} internally. |
| 800 | window (denoted by @var{window}) if @var{window}'s screen area is large | ||
| 801 | enough to accommodate both itself and the new window. | ||
| 802 | 802 | ||
| 803 | If this variable is @code{t}, @code{split-window} tries to resize all | 803 | @deffn Command split-window-right &optional size |
| 804 | windows that are part of the same combination as @var{window}, in order | 804 | This function splits the selected window into two side-by-side |
| 805 | to accommodate the new window. In particular, this may allow | 805 | windows, 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 | 806 | positive, the left window gets @var{size} columns; if @var{size} is |
| 807 | window or too small to ordinarily split. Furthermore, subsequently | 807 | negative, the right window gets @minus{}@var{size} columns. |
| 808 | resizing or deleting @var{window} may resize all other windows in its | 808 | @end deffn |
| 809 | combination. | ||
| 810 | 809 | ||
| 811 | The default is @code{nil}. Other values are reserved for future use. | 810 | @deffn Command split-window-below &optional size |
| 812 | The value of this variable is ignored when | 811 | This function splits the selected window into two windows, one above |
| 813 | @code{window-combination-limit} is non-@code{nil} (see below). | 812 | the other, leaving the upper window selected. If @var{size} is |
| 813 | positive, the upper window gets @var{size} lines; if @var{size} is | ||
| 814 | negative, the lower window gets @minus{}@var{size} lines. | ||
| 815 | @end deffn | ||
| 816 | |||
| 817 | @defopt split-window-keep-point | ||
| 818 | If the value of this variable is non-@code{nil} (the default), | ||
| 819 | @code{split-window-below} behaves as described above. | ||
| 820 | |||
| 821 | If it is @code{nil}, @code{split-window-below} adjusts point in each | ||
| 822 | of the two windows to minimize redisplay. (This is useful on slow | ||
| 823 | terminals.) It selects whichever window contains the screen line that | ||
| 824 | point was previously on. Note that this only affects | ||
| 825 | @code{split-window-below}, not the lower-level @code{split-window} | ||
| 826 | function. | ||
| 814 | @end defopt | 827 | @end defopt |
| 815 | 828 | ||
| 816 | To illustrate the effect of @code{window-combination-resize}, | 829 | @node Deleting Windows |
| 817 | consider 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 | ||
| 834 | the window is a live window, it disappears from the screen. If the | ||
| 835 | window 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 | ||
| 838 | object, until there are no more references to it. Window deletion can | ||
| 839 | be reversed, by restoring a saved window configuration (@pxref{Window | ||
| 840 | Configurations}). | ||
| 841 | |||
| 842 | @deffn Command delete-window &optional window | ||
| 843 | This function removes @var{window} from display and returns | ||
| 844 | @code{nil}. If @var{window} is omitted or @code{nil}, it defaults to | ||
| 845 | the selected window. If deleting the window would leave no more | ||
| 846 | windows in the window tree (e.g. if it is the only live window in the | ||
| 847 | frame), an error is signaled. | ||
| 848 | |||
| 849 | By default, the space taken up by @var{window} is given to one of its | ||
| 850 | adjacent sibling windows, if any. However, if the variable | ||
| 851 | @code{window-combination-resize} is non-@code{nil}, the space is | ||
| 852 | proportionally distributed among any remaining windows in the window | ||
| 853 | combination. @xref{Recombining Windows}. | ||
| 854 | |||
| 855 | The behavior of this function may be altered by the window parameters | ||
| 856 | of @var{window}, so long as the variable | ||
| 857 | @code{ignore-window-parameters} is @code{nil}. If the value of | ||
| 858 | the @code{delete-window} window parameter is @code{t}, this function | ||
| 859 | ignores all other window parameters. Otherwise, if the value of the | ||
| 860 | @code{delete-window} window parameter is a function, that function is | ||
| 861 | called 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 | ||
| 868 | This function makes @var{window} fill its frame, by deleting other | ||
| 869 | windows as necessary. If @var{window} is omitted or @code{nil}, it | ||
| 870 | defaults to the selected window. The return value is @code{nil}. | ||
| 871 | |||
| 872 | The behavior of this function may be altered by the window parameters | ||
| 873 | of @var{window}, so long as the variable | ||
| 874 | @code{ignore-window-parameters} is @code{nil}. If the value of | ||
| 875 | the @code{delete-other-windows} window parameter is @code{t}, this | ||
| 876 | function ignores all other window parameters. Otherwise, if the value | ||
| 877 | of the @code{delete-other-windows} window parameter is a function, | ||
| 878 | that function is called with the argument @var{window}, in lieu of the | ||
| 879 | usual action of @code{delete-other-windows}. Otherwise, this function | ||
| 880 | obeys the @code{window-atom} or @code{window-side} window parameter, | ||
| 881 | if any. @xref{Window Parameters}. | ||
| 882 | @end deffn | ||
| 883 | |||
| 884 | @deffn Command delete-windows-on &optional buffer-or-name frame | ||
| 885 | This function deletes all windows showing @var{buffer-or-name}, by | ||
| 886 | calling @code{delete-window} on those windows. @var{buffer-or-name} | ||
| 887 | should be a buffer, or the name of a buffer; if omitted or @code{nil}, | ||
| 888 | it defaults to the current buffer. If there are no windows showing | ||
| 889 | the specified buffer, this function does nothing. If the specified | ||
| 890 | buffer is a minibuffer, an error is signaled. | ||
| 891 | |||
| 892 | If there is a dedicated window showing the buffer, and that window is | ||
| 893 | the only one on its frame, this function also deletes that frame if it | ||
| 894 | is not the only frame on the terminal. | ||
| 895 | |||
| 896 | The optional argument @var{frame} specifies which frames to operate | ||
| 897 | on: | ||
| 898 | |||
| 899 | @itemize @bullet | ||
| 900 | @item @code{nil} | ||
| 901 | means operate on all frames. | ||
| 902 | @item @code{t} | ||
| 903 | means operate on the selected frame. | ||
| 904 | @item @code{visible} | ||
| 905 | means operate on all visible frames. | ||
| 906 | @item @code{0} | ||
| 907 | means operate on all visible or iconified frames. | ||
| 908 | @item A frame | ||
| 909 | means operate on that frame. | ||
| 910 | @end itemize | ||
| 911 | |||
| 912 | Note that this argument does not have the same meaning as in other | ||
| 913 | functions which scan all live windows (@pxref{Cyclic Window | ||
| 914 | Ordering}). Specifically, the meanings of @code{t} and @code{nil} here | ||
| 915 | are the opposite of what they are in those other functions. | ||
| 916 | @end deffn | ||
| 917 | |||
| 918 | |||
| 919 | @node Recombining Windows | ||
| 920 | @section Recombining Windows | ||
| 921 | |||
| 922 | When deleting the last sibling of a window @code{W}, its parent window | ||
| 923 | is deleted too, with @code{W} replacing it in the window tree. This | ||
| 924 | means that @code{W} must be recombined with its parent's siblings to | ||
| 925 | form a new window combination (@pxref{Windows and Frames}). In some | ||
| 926 | occasions, deleting a live window may even entail the deletion of two | ||
| 927 | internal 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 | ||
| 949 | Deleting @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 | ||
| 952 | combination 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 | ||
| 956 | was used to preserve a combination embedded in a combination of the same | ||
| 957 | type. Such embeddings make sense to assure that when you split a window | ||
| 958 | and subsequently delete the new window, Emacs reestablishes the layout | ||
| 959 | of 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 |
| 840 | If @code{window-combination-resize} is @code{nil}, splitting window | 985 | Split @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 |
| 864 | If @code{window-combination-resize} is @code{t}, splitting @code{W3} | 1008 | Now, when enlarging a window vertically, Emacs tries to obtain the |
| 865 | instead leaves all three live windows with approximately the same | 1009 | corresponding space from its lower sibling, provided such a window |
| 866 | height: | 1010 | exists. 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 | ||
| 1034 | Deleting @code{W4} will now give its entire space to @code{W2}, | ||
| 1035 | including 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 | ||
| 1058 | This can be counterintutive, in particular if @code{W4} were used for | ||
| 1059 | displaying a buffer only temporarily (@pxref{Temporary Displays}), and | ||
| 1060 | you want to continue working with the initial layout. | ||
| 1061 | |||
| 1062 | The 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 |
| 889 | If the value of this variable is @code{t}, the @code{split-window} | 1066 | This variable controls whether splitting a window shall make a new |
| 890 | function always creates a new internal window. If the value is | 1067 | parent 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 | ||
| 1071 | This means that the new live window is allowed to share the existing | ||
| 892 | parent window, if one exists, provided the split occurs in the same | 1072 | parent window, if one exists, provided the split occurs in the same |
| 893 | direction as the existing window combination (otherwise, a new | 1073 | direction as the existing window combination (otherwise, a new internal |
| 894 | internal window is created anyway). The default is @code{nil}. Other | 1074 | window is created anyway). |
| 895 | values are reserved for future use. | 1075 | |
| 896 | 1076 | @item window-size | |
| 897 | Thus, if the value of this variable is at all times @code{t}, then at | 1077 | In this case @code{display-buffer} makes a new parent window if it is |
| 898 | all times every window tree is a binary tree (a tree where each window | 1078 | passed a @code{window-height} or @code{window-width} entry in the |
| 899 | except the root window has exactly one sibling). | 1079 | @var{alist} argument (@pxref{Display Action Functions}). |
| 900 | 1080 | ||
| 901 | Furthermore, @code{split-window} calls | 1081 | @item temp-buffer |
| 902 | @code{set-window-combination-limit} on the newly-created internal | 1082 | This value causes the creation of a new parent window when a window is |
| 903 | window, recording the current value of this variable. This affects | 1083 | split for showing a temporary buffer (@pxref{Temporary Displays}) only. |
| 904 | how the window tree is rearranged when the child windows are deleted | 1084 | |
| 905 | (see below). | 1085 | @item display-buffer |
| 1086 | This means that when @code{display-buffer} (@pxref{Choosing Window}) | ||
| 1087 | splits a window it always makes a new parent window. | ||
| 1088 | |||
| 1089 | @item t | ||
| 1090 | In this case a new parent window is always created when splitting a | ||
| 1091 | window. Thus, if the value of this variable is at all times @code{t}, | ||
| 1092 | then at all times every window tree is a binary tree (a tree where each | ||
| 1093 | window except the root window has exactly one sibling). | ||
| 1094 | @end table | ||
| 1095 | |||
| 1096 | The default is @code{nil}. Other values are reserved for future use. | ||
| 1097 | |||
| 1098 | If, as a consequence of this variable's setting, @code{split-window} | ||
| 1099 | makes a new parent window, it also calls | ||
| 1100 | @code{set-window-combination-limit} (see below) on the newly-created | ||
| 1101 | internal window. This affects how the window tree is rearranged when | ||
| 1102 | the 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 | ||
| 1106 | the 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 | ||
| 1129 | A 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 | ||
| 1131 | sibling of @code{W4}, so enlarging @code{W4} will try to shrink | ||
| 1132 | @code{W2}, leaving @code{W3} unaffected. Observe that @code{W5} | ||
| 1133 | represents a vertical combination of two windows embedded in the | ||
| 1134 | vertical 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 |
| 910 | This functions sets the @dfn{combination limit} of the window | 1138 | This functions sets the @dfn{combination limit} of the window |
| @@ -912,25 +1140,52 @@ This functions sets the @dfn{combination limit} of the window | |||
| 912 | function @code{window-combination-limit}. See below for its effects; | 1140 | function @code{window-combination-limit}. See below for its effects; |
| 913 | note that it is only meaningful for internal windows. The | 1141 | note 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 |
| 915 | the value of the variable @code{window-combination-limit} as | 1143 | it @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 |
| 920 | This function returns the combination limit for @var{window}. | 1148 | This function returns the combination limit for @var{window}. |
| 921 | 1149 | ||
| 922 | The combination limit is meaningful only for an internal window. If | 1150 | The combination limit is meaningful only for an internal window. If it |
| 923 | it is @code{nil}, then Emacs is allowed to automatically delete | 1151 | is @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 |
| 925 | child windows of @var{window} with its sibling windows to form a new | 1153 | child windows of @var{window} with its sibling windows to form a new |
| 926 | window combination. If the combination limit is @code{t}, the child | 1154 | window combination. If the combination limit is @code{t}, the child |
| 927 | windows of @var{window} are never automatically re-combined with its | 1155 | windows of @var{window} are never automatically recombined with its |
| 928 | siblings. | 1156 | siblings. |
| 1157 | |||
| 1158 | If, in the configuration shown at the beginning of this section, the | ||
| 1159 | combination 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}, | 1164 | Alternatively, the problems sketched above can be avoided by always |
| 932 | consider the following configuration (throughout this example, we will | 1165 | resizing all windows in the same combination whenever one of its windows |
| 933 | assume that @code{window-combination-resize} is @code{nil}): | 1166 | is split or deleted. This also permits to split windows that would be |
| 1167 | otherwise too small for such an operation. | ||
| 1168 | |||
| 1169 | @defopt window-combination-resize | ||
| 1170 | If this variable is @code{nil}, @code{split-window} can only split a | ||
| 1171 | window (denoted by @var{window}) if @var{window}'s screen area is large | ||
| 1172 | enough to accommodate both itself and the new window. | ||
| 1173 | |||
| 1174 | If this variable is @code{t}, @code{split-window} tries to resize all | ||
| 1175 | windows that are part of the same combination as @var{window}, in order | ||
| 1176 | to accommodate the new window. In particular, this may allow | ||
| 1177 | @code{split-window} to succeed even if @var{window} is a fixed-size | ||
| 1178 | window or too small to ordinarily split. Furthermore, subsequently | ||
| 1179 | resizing or deleting @var{window} may resize all other windows in its | ||
| 1180 | combination. | ||
| 1181 | |||
| 1182 | The default is @code{nil}. Other values are reserved for future use. | ||
| 1183 | The 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 | ||
| 1188 | the 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 |
| 956 | If @code{window-combination-limit} is @code{nil}, splitting @code{W2} | 1211 | If @code{window-combination-resize} is @code{nil}, splitting window |
| 957 | into 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 |
| 980 | The newly-created window, @code{W4}, shares the same internal window | 1235 | If @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 | 1236 | instead leaves all three live windows with approximately the same |
| 982 | live window, @code{W3}. | 1237 | height: |
| 983 | |||
| 984 | If @code{window-combination-limit} is @code{t}, splitting @code{W2} | ||
| 985 | in 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 |
| 1008 | A new internal window @code{W5} has been created; its children are | 1260 | Deleting 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 | 1261 | distribute its space proportionally among the two remaining live |
| 1010 | only sibling of @code{W4}, so resizing @code{W4} will resize | 1262 | windows. |
| 1011 | @code{W2}, leaving @code{W3} unaffected. | ||
| 1012 | 1263 | ||
| 1013 | For interactive use, Emacs provides two commands which always split | ||
| 1014 | the selected window. These call @code{split-window} internally. | ||
| 1015 | |||
| 1016 | @deffn Command split-window-right &optional size | ||
| 1017 | This function splits the selected window into two side-by-side | ||
| 1018 | windows, putting the selected window on the left. If @var{size} is | ||
| 1019 | positive, the left window gets @var{size} columns; if @var{size} is | ||
| 1020 | negative, the right window gets @minus{}@var{size} columns. | ||
| 1021 | @end deffn | ||
| 1022 | |||
| 1023 | @deffn Command split-window-below &optional size | ||
| 1024 | This function splits the selected window into two windows, one above | ||
| 1025 | the other, leaving the upper window selected. If @var{size} is | ||
| 1026 | positive, the upper window gets @var{size} lines; if @var{size} is | ||
| 1027 | negative, the lower window gets @minus{}@var{size} lines. | ||
| 1028 | @end deffn | ||
| 1029 | |||
| 1030 | @defopt split-window-keep-point | ||
| 1031 | If the value of this variable is non-@code{nil} (the default), | ||
| 1032 | @code{split-window-below} behaves as described above. | ||
| 1033 | |||
| 1034 | If it is @code{nil}, @code{split-window-below} adjusts point in each | ||
| 1035 | of the two windows to minimize redisplay. (This is useful on slow | ||
| 1036 | terminals.) It selects whichever window contains the screen line that | ||
| 1037 | point was previously on. Note that this only affects | ||
| 1038 | @code{split-window-below}, not the lower-level @code{split-window} | ||
| 1039 | function. | ||
| 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 | ||
| 1047 | the window is a live window, it disappears from the screen. If the | ||
| 1048 | window 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 | ||
| 1051 | object, until there are no more references to it. Window deletion can | ||
| 1052 | be reversed, by restoring a saved window configuration (@pxref{Window | ||
| 1053 | Configurations}). | ||
| 1054 | |||
| 1055 | @deffn Command delete-window &optional window | ||
| 1056 | This function removes @var{window} from display and returns | ||
| 1057 | @code{nil}. If @var{window} is omitted or @code{nil}, it defaults to | ||
| 1058 | the selected window. If deleting the window would leave no more | ||
| 1059 | windows in the window tree (e.g. if it is the only live window in the | ||
| 1060 | frame), an error is signaled. | ||
| 1061 | |||
| 1062 | By default, the space taken up by @var{window} is given to one of its | ||
| 1063 | adjacent sibling windows, if any. However, if the variable | ||
| 1064 | @code{window-combination-resize} is non-@code{nil}, the space is | ||
| 1065 | proportionally distributed among any remaining windows in the window | ||
| 1066 | combination. @xref{Splitting Windows}. | ||
| 1067 | |||
| 1068 | The behavior of this function may be altered by the window parameters | ||
| 1069 | of @var{window}, so long as the variable | ||
| 1070 | @code{ignore-window-parameters} is @code{nil}. If the value of | ||
| 1071 | the @code{delete-window} window parameter is @code{t}, this function | ||
| 1072 | ignores all other window parameters. Otherwise, if the value of the | ||
| 1073 | @code{delete-window} window parameter is a function, that function is | ||
| 1074 | called 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 | ||
| 1081 | This function makes @var{window} fill its frame, by deleting other | ||
| 1082 | windows as necessary. If @var{window} is omitted or @code{nil}, it | ||
| 1083 | defaults to the selected window. The return value is @code{nil}. | ||
| 1084 | |||
| 1085 | The behavior of this function may be altered by the window parameters | ||
| 1086 | of @var{window}, so long as the variable | ||
| 1087 | @code{ignore-window-parameters} is @code{nil}. If the value of | ||
| 1088 | the @code{delete-other-windows} window parameter is @code{t}, this | ||
| 1089 | function ignores all other window parameters. Otherwise, if the value | ||
| 1090 | of the @code{delete-other-windows} window parameter is a function, | ||
| 1091 | that function is called with the argument @var{window}, in lieu of the | ||
| 1092 | usual action of @code{delete-other-windows}. Otherwise, this function | ||
| 1093 | obeys the @code{window-atom} or @code{window-side} window parameter, | ||
| 1094 | if any. @xref{Window Parameters}. | ||
| 1095 | @end deffn | ||
| 1096 | |||
| 1097 | @deffn Command delete-windows-on &optional buffer-or-name frame | ||
| 1098 | This function deletes all windows showing @var{buffer-or-name}, by | ||
| 1099 | calling @code{delete-window} on those windows. @var{buffer-or-name} | ||
| 1100 | should be a buffer, or the name of a buffer; if omitted or @code{nil}, | ||
| 1101 | it defaults to the current buffer. If there are no windows showing | ||
| 1102 | the specified buffer, this function does nothing. If the specified | ||
| 1103 | buffer is a minibuffer, an error is signaled. | ||
| 1104 | |||
| 1105 | If there is a dedicated window showing the buffer, and that window is | ||
| 1106 | the only one on its frame, this function also deletes that frame if it | ||
| 1107 | is not the only frame on the terminal. | ||
| 1108 | |||
| 1109 | The optional argument @var{frame} specifies which frames to operate | ||
| 1110 | on: | ||
| 1111 | |||
| 1112 | @itemize @bullet | ||
| 1113 | @item @code{nil} | ||
| 1114 | means operate on all frames. | ||
| 1115 | @item @code{t} | ||
| 1116 | means operate on the selected frame. | ||
| 1117 | @item @code{visible} | ||
| 1118 | means operate on all visible frames. | ||
| 1119 | @item @code{0} | ||
| 1120 | means operate on all visible or iconified frames. | ||
| 1121 | @item A frame | ||
| 1122 | means operate on that frame. | ||
| 1123 | @end itemize | ||
| 1124 | |||
| 1125 | Note that this argument does not have the same meaning as in other | ||
| 1126 | functions which scan all live windows (@pxref{Cyclic Window | ||
| 1127 | Ordering}). Specifically, the meanings of @code{t} and @code{nil} here | ||
| 1128 | are 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 | |||
| 1550 | instead. | 1684 | instead. |
| 1551 | @end deffn | 1685 | @end deffn |
| 1552 | 1686 | ||
| 1687 | By default, @code{switch-to-buffer} sets @code{window-point} of the | ||
| 1688 | window used to the buffer's position of @code{point}. This behavior can | ||
| 1689 | be tuned using the following option. | ||
| 1690 | |||
| 1691 | @defopt switch-to-buffer-preserve-window-point | ||
| 1692 | If this variable is @code{nil}, @code{switch-to-buffer} displays the | ||
| 1693 | buffer specified by @var{buffer-or-name} at the position of that | ||
| 1694 | buffer's @code{point}. If this variable is @code{already-displayed}, it | ||
| 1695 | tries to display the buffer at its previous position in the selected | ||
| 1696 | window, provided the buffer is currently displayed in some other window | ||
| 1697 | on any visible or iconified frame. If this variable is @code{t}, | ||
| 1698 | @code{switch-to-buffer} unconditionally tries to display the buffer at | ||
| 1699 | its previous position in the selected window. | ||
| 1700 | |||
| 1701 | This variable is ignored if the buffer is already displayed in the | ||
| 1702 | selected window or never appeared in it before, or if | ||
| 1703 | @code{switch-to-buffer} calls @code{pop-to-buffer} to display the | ||
| 1704 | buffer. | ||
| 1705 | @end defopt | ||
| 1706 | |||
| 1553 | The next two functions are similar to @code{switch-to-buffer}, except | 1707 | The next two functions are similar to @code{switch-to-buffer}, except |
| 1554 | for the described features. | 1708 | for 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 |
| 1776 | Options}). | 1930 | Options}). |
| 1777 | 1931 | ||
| 1778 | It can fail if no window splitting can be performed for some reason | 1932 | The 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 |
| 1780 | frame parameter; @pxref{Buffer Parameters}). | 1934 | adjust 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 | ||
| 1942 | A number specifies the desired height of the new window. An integer | ||
| 1943 | number specifies the number of lines of the window. A floating point | ||
| 1944 | number gives the fraction of the window's height with respect to the | ||
| 1945 | height of the frame's root window. | ||
| 1946 | |||
| 1947 | @item | ||
| 1948 | If the @sc{cdr} specifies a function, that function is called with one | ||
| 1949 | argument - the new window. The function is supposed to adjust the | ||
| 1950 | height of the window; its return value is ignored. Suitable functions | ||
| 1951 | are @code{shrink-window-if-larger-than-buffer} and | ||
| 1952 | @code{fit-window-to-buffer}, see @ref{Resizing Windows}. | ||
| 1953 | @end itemize | ||
| 1954 | |||
| 1955 | To 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 | ||
| 1963 | A number specifies the desired width of the new window. An integer | ||
| 1964 | number specifies the number of columns of the window. A floating point | ||
| 1965 | number gives the fraction of the window's width with respect to the | ||
| 1966 | width of the frame's root window. | ||
| 1967 | |||
| 1968 | @item | ||
| 1969 | If the @sc{cdr} specifies a function, that function is called with one | ||
| 1970 | argument - the new window. The function is supposed to adjust the width | ||
| 1971 | of the window; its return value is ignored. | ||
| 1972 | @end itemize | ||
| 1973 | |||
| 1974 | This function can fail if no window splitting can be performed for some | ||
| 1975 | reason (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 | |||
| 1786 | windows are dedicated to another buffer (@pxref{Dedicated Windows}). | 1982 | windows are dedicated to another buffer (@pxref{Dedicated Windows}). |
| 1787 | @end defun | 1983 | @end defun |
| 1788 | 1984 | ||
| 1985 | @defun display-buffer-below-selected buffer alist | ||
| 1986 | This function tries to display @var{buffer} in a window below the | ||
| 1987 | selected window. This means to either split the selected window or | ||
| 1988 | reuse the window below the selected one. | ||
| 1989 | @end defun | ||
| 1990 | |||
| 1991 | @defun display-buffer-in-previous-window buffer alist | ||
| 1992 | This function tries to display @var{buffer} in a window previously | ||
| 1993 | showing it. If @var{alist} has a non-@code{nil} | ||
| 1994 | @code{inhibit-same-window} entry, the selected window is not eligible | ||
| 1995 | for reuse. If @var{alist} contains a @code{reusable-frames} entry, its | ||
| 1996 | value determines which frames to search for a suitable window as with | ||
| 1997 | @code{display-buffer-reuse-window}. | ||
| 1998 | |||
| 1999 | If @var{alist} has a @code{previous-window} entry, the window | ||
| 2000 | specified by that entry will override any other window found by the | ||
| 2001 | methods 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}). | |||
| 2086 | Finally, you might want to either bury (@pxref{The Buffer List}) or kill | 2302 | Finally, 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 |
| 2090 | displaying the buffer was obtained in the first place, thus attempting to | 2306 | displaying the buffer was obtained in the first place, thus attempting |
| 2091 | automate the above decisions for you. | 2307 | to automate the above decisions for you. |
| 2092 | 2308 | ||
| 2093 | @deffn Command quit-window &optional kill window | 2309 | @deffn Command quit-window &optional kill window |
| 2094 | This command quits @var{window} and buries its buffer. The argument | 2310 | This 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. |
| 2096 | With prefix argument @var{kill} non-@code{nil}, it kills the buffer | 2312 | With prefix argument @var{kill} non-@code{nil}, it kills the buffer |
| 2097 | instead of burying it. | 2313 | instead of burying it. It calls the function @code{quit-restore-window} |
| 2098 | 2314 | described next to deal with the window and its buffer. | |
| 2099 | Quitting @var{window} means to proceed as follows: If @var{window} was | ||
| 2100 | created specially for displaying its current buffer, delete @var{window} | ||
| 2101 | provided 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 | ||
| 2103 | on the frame's terminal, the value of @var{kill} determines how to | ||
| 2104 | proceed with the window. If @var{kill} is @code{nil}, the fate of the | ||
| 2105 | frame is determined by calling @code{frame-auto-hide-function} (see | ||
| 2106 | below) with that frame as sole argument. If @var{kill} is | ||
| 2107 | non-@code{nil}, the frame is deleted unconditionally. | ||
| 2108 | |||
| 2109 | If @var{window} was reused for displaying its buffer, this command tries | ||
| 2110 | to display the buffer previously shown in it. It also tries to restore | ||
| 2111 | the window start (@pxref{Window Start and End}) and point (@pxref{Window | ||
| 2112 | Point}) positions of the previously shown buffer. If, in addition, the | ||
| 2113 | current buffer was temporarily resized, this command will also try to | ||
| 2114 | restore the original height of @var{window}. | ||
| 2115 | |||
| 2116 | The three cases described so far require that the buffer shown in | ||
| 2117 | @var{window} is still the buffer displayed by the last buffer display | ||
| 2118 | function for this window. If another buffer has been shown in the | ||
| 2119 | meantime, or the buffer previously shown no longer exists, this command | ||
| 2120 | calls @code{switch-to-prev-buffer} (@pxref{Window History}) to show some | ||
| 2121 | other buffer instead. | ||
| 2122 | @end deffn | 2315 | @end deffn |
| 2123 | 2316 | ||
| 2124 | The function @code{quit-window} bases its decisions on information | 2317 | @defun quit-restore-window &optional window bury-or-kill |
| 2125 | stored in @var{window}'s @code{quit-restore} window parameter | 2318 | This function tries to restore the state of @var{window} that existed |
| 2126 | (@pxref{Window Parameters}), and resets that parameter to @code{nil} | 2319 | before its buffer was displayed in it. The optional argument |
| 2127 | after it's done. | 2320 | @var{window} must be a live window and defaults to the selected one. |
| 2321 | |||
| 2322 | If @var{window} was created specially for displaying its buffer, this | ||
| 2323 | function deletes @var{window} provided its frame contains at least one | ||
| 2324 | other live window. If @var{window} is the only window on its frame and | ||
| 2325 | there are other frames on the frame's terminal, the value of the | ||
| 2326 | optional argument @var{bury-or-kill} determines how to proceed with the | ||
| 2327 | window. If @var{bury-or-kill} equals @code{kill}, the frame is deleted | ||
| 2328 | unconditionally. Otherwise, the fate of the frame is determined by | ||
| 2329 | calling @code{frame-auto-hide-function} (see below) with that frame as | ||
| 2330 | sole argument. | ||
| 2331 | |||
| 2332 | Otherwise, this function tries to redisplay the buffer previously shown | ||
| 2333 | in @var{window}. It also tries to restore the window start | ||
| 2334 | (@pxref{Window Start and End}) and point (@pxref{Window Point}) | ||
| 2335 | positions of the previously shown buffer. If, in addition, | ||
| 2336 | @var{window}'s buffer was temporarily resized, this function will also | ||
| 2337 | try to restore the original height of @var{window}. | ||
| 2338 | |||
| 2339 | The cases described so far require that the buffer shown in @var{window} | ||
| 2340 | is still the buffer displayed by the last buffer display function for | ||
| 2341 | this window. If another buffer has been shown in the meantime, or the | ||
| 2342 | buffer previously shown no longer exists, this function calls | ||
| 2343 | @code{switch-to-prev-buffer} (@pxref{Window History}) to show some other | ||
| 2344 | buffer instead. | ||
| 2345 | |||
| 2346 | The 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 | ||
| 2351 | This means to not deal with the buffer in any particular way. As a | ||
| 2352 | consequence, if @var{window} is not deleted, invoking | ||
| 2353 | @code{switch-to-prev-buffer} will usually show the buffer again. | ||
| 2354 | |||
| 2355 | @item append | ||
| 2356 | This means that if @var{window} is not deleted, its buffer is moved to | ||
| 2357 | the end of @var{window}'s list of previous buffers, so it's less likely | ||
| 2358 | that a future invocation of @code{switch-to-prev-buffer} will switch to | ||
| 2359 | it. Also, it moves the buffer to the end of the frame's buffer list. | ||
| 2360 | |||
| 2361 | @item bury | ||
| 2362 | This means that if @var{window} is not deleted, its buffer is removed | ||
| 2363 | from @var{window}'s list of previous buffers. Also, it moves the buffer | ||
| 2364 | to the end of the frame's buffer list. This value provides the most | ||
| 2365 | reliable remedy to not have @code{switch-to-prev-buffer} switch to this | ||
| 2366 | buffer again without killing the buffer. | ||
| 2367 | |||
| 2368 | @item kill | ||
| 2369 | This 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 | ||
| 2374 | Parameters}), and resets that parameter to @code{nil} after it's done. | ||
| 2375 | @end defun | ||
| 2128 | 2376 | ||
| 2129 | The following option specifies how to deal with a frame containing just | 2377 | The following option specifies how to deal with a frame containing just |
| 2130 | one window that should be either quit, or whose buffer should be buried. | 2378 | one 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 | ||
| 2136 | The function specified here is called by @code{bury-buffer} (@pxref{The | 2384 | The function specified here is called by @code{bury-buffer} (@pxref{The |
| 2137 | Buffer List}) when the selected window is dedicated and shows the buffer | 2385 | Buffer List}) when the selected window is dedicated and shows the buffer |
| 2138 | that should be buried. It is also called by @code{quit-window} (see | 2386 | to bury. It is also called by @code{quit-restore-window} (see above) |
| 2139 | above) when the frame of the window that should be quit has been | 2387 | when the frame of the window to quit has been specially created for |
| 2140 | specially created for displaying that window's buffer and the buffer | 2388 | displaying that window's buffer and the buffer is not killed. |
| 2141 | should be buried. | ||
| 2142 | 2389 | ||
| 2143 | The default is to call @code{iconify-frame} (@pxref{Visibility of | 2390 | The default is to call @code{iconify-frame} (@pxref{Visibility of |
| 2144 | Frames}). Alternatively, you may specify either @code{delete-frame} | 2391 | Frames}). 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 |
| 2147 | can take a frame as its sole argument. | 2394 | can take a frame as its sole argument. |
| 2148 | 2395 | ||
| 2149 | Note that the function specified by this option is called if and only if | 2396 | Note that the function specified by this option is called only if the |
| 2150 | there is at least one other frame on the terminal of the frame it's | 2397 | specified frame contains just one live window and there is at least one |
| 2151 | supposed to handle, and that frame contains only one live window. | 2398 | other 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 |
| 3125 | This function returns the state of @var{window} as a Lisp object. The | 3372 | This function returns the state of @var{window} as a Lisp object. The |
| 3126 | argument @var{window} can be any window and defaults to the root window | 3373 | argument @var{window} must be a valid window and defaults to the root |
| 3127 | of the selected frame. | 3374 | window of the selected frame. |
| 3128 | 3375 | ||
| 3129 | If the optional argument @var{writable} is non-@code{nil}, this means to | 3376 | If the optional argument @var{writable} is non-@code{nil}, this means to |
| 3130 | not use markers for sampling positions like @code{window-point} or | 3377 | not 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 | |||
| 3267 | Configurations}). | 3514 | Configurations}). |
| 3268 | 3515 | ||
| 3269 | @item @code{quit-restore} | 3516 | @item @code{quit-restore} |
| 3270 | This parameter specifies what to do with a window when the buffer it | 3517 | This parameter is installed by the buffer display functions |
| 3271 | shows is not needed any more. It is installed by the buffer display | 3518 | (@pxref{Choosing Window}) and consulted by @code{quit-restore-window} |
| 3272 | functions (@pxref{Choosing Window}), and consulted by the function | 3519 | (@pxref{Quitting Windows}). It contains four elements: |
| 3273 | @code{quit-window} (@pxref{Quitting Windows}). | 3520 | |
| 3521 | The first element is one of the symbols @code{window} - meaning that the | ||
| 3522 | window has been specially created by @code{display-buffer}, @code{frame} | ||
| 3523 | - a separate frame has been created, @code{same} - the window has | ||
| 3524 | displayed the same buffer before, or @code{other} - the window showed | ||
| 3525 | another buffer before. | ||
| 3526 | |||
| 3527 | The 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 | ||
| 3529 | window before, that buffer's window start and window point positions, | ||
| 3530 | and the window's height at that time. | ||
| 3531 | |||
| 3532 | The third element is the window selected at the time the parameter was | ||
| 3533 | created. The function @code{quit-restore-window} tries to reselect that | ||
| 3534 | window when it deletes the window passed to it as argument. | ||
| 3535 | |||
| 3536 | The fourth element is the buffer whose display caused the creation of | ||
| 3537 | this parameter. @code{quit-restore-window} deletes the specified window | ||
| 3538 | only if it still shows that buffer. | ||
| 3274 | @end table | 3539 | @end table |
| 3275 | 3540 | ||
| 3276 | There are additional parameters @code{window-atom} and @code{window-side}; | 3541 | There are additional parameters @code{window-atom} and @code{window-side}; |