diff options
Diffstat (limited to 'doc/lispref')
| -rw-r--r-- | doc/lispref/ChangeLog | 32 | ||||
| -rw-r--r-- | doc/lispref/display.texi | 17 | ||||
| -rw-r--r-- | doc/lispref/internals.texi | 295 | ||||
| -rw-r--r-- | doc/lispref/keymaps.texi | 84 | ||||
| -rw-r--r-- | doc/lispref/windows.texi | 112 |
5 files changed, 403 insertions, 137 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 6d6ddf4da9a..8c1a863371b 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,3 +1,35 @@ | |||
| 1 | 2012-11-16 Martin Rudalics <rudalics@gmx.at> | ||
| 2 | |||
| 3 | * windows.texi (Choosing Window): Rewrite description of | ||
| 4 | display-buffer-alist (Bug#12167). | ||
| 5 | (Display Action Functions): Mention inhibit-switch-frame. Fix | ||
| 6 | description of display-buffer-below-selected. Reorder actions. | ||
| 7 | Add example (Bug#12848). | ||
| 8 | |||
| 9 | 2012-11-16 Glenn Morris <rgm@gnu.org> | ||
| 10 | |||
| 11 | * display.texi (Face Attributes): Fix :underline COLOR description. | ||
| 12 | (Attribute Functions): Update for set-face-underline rename. | ||
| 13 | Tweak descriptions of face-underline-p, face-inverse-video-p. | ||
| 14 | |||
| 15 | * keymaps.texi (Searching Keymaps, Tool Bar): Untabify examples, | ||
| 16 | so they align better in info. | ||
| 17 | (Active Keymaps, Searching Keymaps, Controlling Active Maps): | ||
| 18 | Document set-temporary-overlay-map. | ||
| 19 | |||
| 20 | 2012-11-15 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 21 | |||
| 22 | * keymaps.texi (Translation Keymaps): Add a subsection "Interaction | ||
| 23 | with normal keymaps". | ||
| 24 | |||
| 25 | 2012-11-15 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 26 | |||
| 27 | * internals.texi (Garbage Collection): Update descriptions | ||
| 28 | of vectorlike_header, garbage-collect and gc-cons-threshold. | ||
| 29 | (Object Internals): Explain Lisp_Object layout and the basics | ||
| 30 | of an internal type system. | ||
| 31 | (Buffer Internals): Update description of struct buffer. | ||
| 32 | |||
| 1 | 2012-11-13 Glenn Morris <rgm@gnu.org> | 33 | 2012-11-13 Glenn Morris <rgm@gnu.org> |
| 2 | 34 | ||
| 3 | * variables.texi (Adding Generalized Variables): | 35 | * variables.texi (Adding Generalized Variables): |
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 68701a47126..9fedd162da6 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi | |||
| @@ -2009,12 +2009,11 @@ Don't underline. | |||
| 2009 | Underline with the foreground color of the face. | 2009 | Underline with the foreground color of the face. |
| 2010 | 2010 | ||
| 2011 | @item @var{color} | 2011 | @item @var{color} |
| 2012 | Underline in color @var{color}; which should be either a string | 2012 | Underline in color @var{color}, a string specifying a color. |
| 2013 | specifying a color, or the symbol @code{foreground-color}, meaning the | ||
| 2014 | foreground color of the face. | ||
| 2015 | 2013 | ||
| 2016 | @item @code{(:color @var{color} :style @var{style})} | 2014 | @item @code{(:color @var{color} :style @var{style})} |
| 2017 | @var{color} is as described above. Omitting the attribute | 2015 | @var{color} is either a string, or the symbol @code{foreground-color}, |
| 2016 | meaning the foreground color of the face. Omitting the attribute | ||
| 2018 | @code{:color} means to use the foreground color of the face. | 2017 | @code{:color} means to use the foreground color of the face. |
| 2019 | @var{style} should be a symbol @code{line} or @code{wave}, meaning to | 2018 | @var{style} should be a symbol @code{line} or @code{wave}, meaning to |
| 2020 | use a straight or wavy line. Omitting the attribute @code{:style} | 2019 | use a straight or wavy line. Omitting the attribute @code{:style} |
| @@ -2404,7 +2403,7 @@ This sets the @code{:slant} attribute of @var{face} to @var{normal} if | |||
| 2404 | @var{italic-p} is @code{nil}, and to @var{italic} otherwise. | 2403 | @var{italic-p} is @code{nil}, and to @var{italic} otherwise. |
| 2405 | @end defun | 2404 | @end defun |
| 2406 | 2405 | ||
| 2407 | @defun set-face-underline-p face underline &optional frame | 2406 | @defun set-face-underline face underline &optional frame |
| 2408 | This sets the @code{:underline} attribute of @var{face} to | 2407 | This sets the @code{:underline} attribute of @var{face} to |
| 2409 | @var{underline}. | 2408 | @var{underline}. |
| 2410 | @end defun | 2409 | @end defun |
| @@ -2467,12 +2466,16 @@ attribute of @var{face} is @code{italic} or @code{oblique}, and | |||
| 2467 | @code{nil} otherwise. | 2466 | @code{nil} otherwise. |
| 2468 | @end defun | 2467 | @end defun |
| 2469 | 2468 | ||
| 2469 | @c Note the weasel words. A face that inherits from an underlined | ||
| 2470 | @c face but does not specify :underline will return nil. | ||
| 2470 | @defun face-underline-p face &optional frame | 2471 | @defun face-underline-p face &optional frame |
| 2471 | This function returns the @code{:underline} attribute of face @var{face}. | 2472 | This function returns non-@code{nil} if face @var{face} specifies |
| 2473 | a non-@code{nil} @code{:underline} attribute. | ||
| 2472 | @end defun | 2474 | @end defun |
| 2473 | 2475 | ||
| 2474 | @defun face-inverse-video-p face &optional frame | 2476 | @defun face-inverse-video-p face &optional frame |
| 2475 | This function returns the @code{:inverse-video} attribute of face @var{face}. | 2477 | This function returns non-@code{nil} if face @var{face} specifies |
| 2478 | a non-@code{nil} @code{:inverse-video} attribute. | ||
| 2476 | @end defun | 2479 | @end defun |
| 2477 | 2480 | ||
| 2478 | @node Displaying Faces | 2481 | @node Displaying Faces |
diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi index 1459f52d979..2a2846921c5 100644 --- a/doc/lispref/internals.texi +++ b/doc/lispref/internals.texi | |||
| @@ -226,12 +226,11 @@ of 8k bytes, and small vectors are packed into blocks of 4k bytes). | |||
| 226 | Beyond the basic vector, a lot of objects like window, buffer, and | 226 | Beyond the basic vector, a lot of objects like window, buffer, and |
| 227 | frame are managed as if they were vectors. The corresponding C data | 227 | frame are managed as if they were vectors. The corresponding C data |
| 228 | structures include the @code{struct vectorlike_header} field whose | 228 | structures include the @code{struct vectorlike_header} field whose |
| 229 | @code{next} field points to the next object in the chain: | 229 | @code{size} member contains the subtype enumerated by @code{enum pvec_type} |
| 230 | @code{header.next.buffer} points to the next buffer (which could be | 230 | and an information about how many @code{Lisp_Object} fields this structure |
| 231 | a killed buffer), and @code{header.next.vector} points to the next | 231 | contains and what the size of the rest data is. This information is |
| 232 | vector in a free list. If a vector is small (smaller than or equal to | 232 | needed to calculate the memory footprint of an object, and used |
| 233 | @code{VBLOCK_BYTES_MAX} bytes, see @file{alloc.c}), then | 233 | by the vector allocation code while iterating over the vector blocks. |
| 234 | @code{header.next.nbytes} contains the vector size in bytes. | ||
| 235 | 234 | ||
| 236 | @cindex garbage collection | 235 | @cindex garbage collection |
| 237 | It is quite common to use some storage for a while, then release it | 236 | It is quite common to use some storage for a while, then release it |
| @@ -284,88 +283,147 @@ the amount of space in use. (Garbage collection can also occur | |||
| 284 | spontaneously if you use more than @code{gc-cons-threshold} bytes of | 283 | spontaneously if you use more than @code{gc-cons-threshold} bytes of |
| 285 | Lisp data since the previous garbage collection.) | 284 | Lisp data since the previous garbage collection.) |
| 286 | 285 | ||
| 287 | @code{garbage-collect} returns a list containing the following | 286 | @code{garbage-collect} returns a list with information on amount of space in |
| 288 | information: | 287 | use, where each entry has the form @samp{(@var{name} @var{size} @var{used})} |
| 288 | or @samp{(@var{name} @var{size} @var{used} @var{free})}. In the entry, | ||
| 289 | @var{name} is a symbol describing the kind of objects this entry represents, | ||
| 290 | @var{size} is the number of bytes used by each one, @var{used} is the number | ||
| 291 | of those objects that were found live in the heap, and optional @var{free} is | ||
| 292 | the number of those objects that are not live but that Emacs keeps around for | ||
| 293 | future allocations. So an overall result is: | ||
| 289 | 294 | ||
| 290 | @example | 295 | @example |
| 291 | @group | 296 | ((@code{conses} @var{cons-size} @var{used-conse} @var{free-conses}) |
| 292 | ((@var{used-conses} . @var{free-conses}) | 297 | (@code{symbols} @var{symbol-size} @var{used-symbols} @var{free-symbols}) |
| 293 | (@var{used-syms} . @var{free-syms}) | 298 | (@code{miscs} @var{misc-size} @var{used-miscs} @var{free-miscs}) |
| 294 | @end group | 299 | (@code{strings} @var{string-size} @var{used-strings} @var{free-strings}) |
| 295 | (@var{used-miscs} . @var{free-miscs}) | 300 | (@code{string-bytes} @var{byte-size} @var{used-bytes}) |
| 296 | @var{used-string-chars} | 301 | (@code{vectors} @var{vector-size} @var{used-vectors}) |
| 297 | @var{used-vector-slots} | 302 | (@code{vector-slots} @var{slot-size} @var{used-slots} @var{free-slots}) |
| 298 | (@var{used-floats} . @var{free-floats}) | 303 | (@code{floats} @var{float-size} @var{used-floats} @var{free-floats}) |
| 299 | (@var{used-intervals} . @var{free-intervals}) | 304 | (@code{intervals} @var{interval-size} @var{used-intervals} @var{free-intervals}) |
| 300 | (@var{used-strings} . @var{free-strings})) | 305 | (@code{buffers} @var{buffer-size} @var{used-buffers}) |
| 306 | (@code{heap} @var{unit-size} @var{total-size} @var{free-size})) | ||
| 301 | @end example | 307 | @end example |
| 302 | 308 | ||
| 303 | Here is an example: | 309 | Here is an example: |
| 304 | 310 | ||
| 305 | @example | 311 | @example |
| 306 | @group | ||
| 307 | (garbage-collect) | 312 | (garbage-collect) |
| 308 | @result{} ((106886 . 13184) (9769 . 0) | 313 | @result{} ((conses 16 49126 8058) (symbols 48 14607 0) |
| 309 | (7731 . 4651) 347543 121628 | 314 | (miscs 40 34 56) (strings 32 2942 2607) |
| 310 | (31 . 94) (1273 . 168) | 315 | (string-bytes 1 78607) (vectors 16 7247) |
| 311 | (25474 . 3569)) | 316 | (vector-slots 8 341609 29474) (floats 8 71 102) |
| 312 | @end group | 317 | (intervals 56 27 26) (buffers 944 8) |
| 318 | (heap 1024 11715 2678)) | ||
| 313 | @end example | 319 | @end example |
| 314 | 320 | ||
| 315 | Here is a table explaining each element: | 321 | Below is a table explaining each element. Note that last @code{heap} entry |
| 322 | is optional and present only if an underlying @code{malloc} implementation | ||
| 323 | provides @code{mallinfo} function. | ||
| 316 | 324 | ||
| 317 | @table @var | 325 | @table @var |
| 326 | @item cons-size | ||
| 327 | Internal size of a cons cell, i.e.@: @code{sizeof (struct Lisp_Cons)}. | ||
| 328 | |||
| 318 | @item used-conses | 329 | @item used-conses |
| 319 | The number of cons cells in use. | 330 | The number of cons cells in use. |
| 320 | 331 | ||
| 321 | @item free-conses | 332 | @item free-conses |
| 322 | The number of cons cells for which space has been obtained from the | 333 | The number of cons cells for which space has been obtained from |
| 323 | operating system, but that are not currently being used. | 334 | the operating system, but that are not currently being used. |
| 324 | 335 | ||
| 325 | @item used-syms | 336 | @item symbol-size |
| 337 | Internal size of a symbol, i.e.@: @code{sizeof (struct Lisp_Symbol)}. | ||
| 338 | |||
| 339 | @item used-symbols | ||
| 326 | The number of symbols in use. | 340 | The number of symbols in use. |
| 327 | 341 | ||
| 328 | @item free-syms | 342 | @item free-symbols |
| 329 | The number of symbols for which space has been obtained from the | 343 | The number of symbols for which space has been obtained from |
| 330 | operating system, but that are not currently being used. | 344 | the operating system, but that are not currently being used. |
| 345 | |||
| 346 | @item misc-size | ||
| 347 | Internal size of a miscellaneous entity, i.e.@: | ||
| 348 | @code{sizeof (union Lisp_Misc)}, which is a size of the | ||
| 349 | largest type enumerated in @code{enum Lisp_Misc_Type}. | ||
| 331 | 350 | ||
| 332 | @item used-miscs | 351 | @item used-miscs |
| 333 | The number of miscellaneous objects in use. These include markers and | 352 | The number of miscellaneous objects in use. These include markers |
| 334 | overlays, plus certain objects not visible to users. | 353 | and overlays, plus certain objects not visible to users. |
| 335 | 354 | ||
| 336 | @item free-miscs | 355 | @item free-miscs |
| 337 | The number of miscellaneous objects for which space has been obtained | 356 | The number of miscellaneous objects for which space has been obtained |
| 338 | from the operating system, but that are not currently being used. | 357 | from the operating system, but that are not currently being used. |
| 339 | 358 | ||
| 340 | @item used-string-chars | 359 | @item string-size |
| 341 | The total size of all strings, in characters. | 360 | Internal size of a string header, i.e.@: @code{sizeof (struct Lisp_String)}. |
| 361 | |||
| 362 | @item used-strings | ||
| 363 | The number of string headers in use. | ||
| 364 | |||
| 365 | @item free-strings | ||
| 366 | The number of string headers for which space has been obtained | ||
| 367 | from the operating system, but that are not currently being used. | ||
| 368 | |||
| 369 | @item byte-size | ||
| 370 | This is used for convenience and equals to @code{sizeof (char)}. | ||
| 371 | |||
| 372 | @item used-bytes | ||
| 373 | The total size of all string data in bytes. | ||
| 374 | |||
| 375 | @item vector-size | ||
| 376 | Internal size of a vector header, i.e.@: @code{sizeof (struct Lisp_Vector)}. | ||
| 342 | 377 | ||
| 343 | @item used-vector-slots | 378 | @item used-vectors |
| 344 | The total number of elements of existing vectors. | 379 | The number of vector headers allocated from the vector blocks. |
| 380 | |||
| 381 | @item slot-size | ||
| 382 | Internal size of a vector slot, always equal to @code{sizeof (Lisp_Object)}. | ||
| 383 | |||
| 384 | @item used-slots | ||
| 385 | The number of slots in all used vectors. | ||
| 386 | |||
| 387 | @item free-slots | ||
| 388 | The number of free slots in all vector blocks. | ||
| 389 | |||
| 390 | @item float-size | ||
| 391 | Internal size of a float object, i.e.@: @code{sizeof (struct Lisp_Float)}. | ||
| 392 | (Do not confuse it with the native platform @code{float} or @code{double}.) | ||
| 345 | 393 | ||
| 346 | @item used-floats | 394 | @item used-floats |
| 347 | The number of floats in use. | 395 | The number of floats in use. |
| 348 | 396 | ||
| 349 | @item free-floats | 397 | @item free-floats |
| 350 | The number of floats for which space has been obtained from the | 398 | The number of floats for which space has been obtained from |
| 351 | operating system, but that are not currently being used. | 399 | the operating system, but that are not currently being used. |
| 400 | |||
| 401 | @item interval-size | ||
| 402 | Internal size of an interval object, i.e.@: @code{sizeof (struct interval)}. | ||
| 352 | 403 | ||
| 353 | @item used-intervals | 404 | @item used-intervals |
| 354 | The number of intervals in use. Intervals are an internal | 405 | The number of intervals in use. |
| 355 | data structure used for representing text properties. | ||
| 356 | 406 | ||
| 357 | @item free-intervals | 407 | @item free-intervals |
| 358 | The number of intervals for which space has been obtained | 408 | The number of intervals for which space has been obtained from |
| 359 | from the operating system, but that are not currently being used. | 409 | the operating system, but that are not currently being used. |
| 360 | 410 | ||
| 361 | @item used-strings | 411 | @item buffer-size |
| 362 | The number of strings in use. | 412 | Internal size of a buffer, i.e.@: @code{sizeof (struct buffer)}. |
| 413 | (Do not confuse with the value returned by @code{buffer-size} function.) | ||
| 363 | 414 | ||
| 364 | @item free-strings | 415 | @item used-buffers |
| 365 | The number of string headers for which the space was obtained from the | 416 | The number of buffer objects in use. This includes killed buffers |
| 366 | operating system, but which are currently not in use. (A string | 417 | invisible to users, i.e.@: all buffers in @code{all_buffers} list. |
| 367 | object consists of a header and the storage for the string text | 418 | |
| 368 | itself; the latter is only allocated when the string is created.) | 419 | @item unit-size |
| 420 | The unit of heap space measurement, always equal to 1024 bytes. | ||
| 421 | |||
| 422 | @item total-size | ||
| 423 | Total heap size, in @var{unit-size} units. | ||
| 424 | |||
| 425 | @item free-size | ||
| 426 | Heap space which is not currently used, in @var{unit-size} units. | ||
| 369 | @end table | 427 | @end table |
| 370 | 428 | ||
| 371 | If there was overflow in pure space (@pxref{Pure Storage}), | 429 | If there was overflow in pure space (@pxref{Pure Storage}), |
| @@ -388,23 +446,25 @@ careful writing them. | |||
| 388 | @defopt gc-cons-threshold | 446 | @defopt gc-cons-threshold |
| 389 | The value of this variable is the number of bytes of storage that must | 447 | The value of this variable is the number of bytes of storage that must |
| 390 | be allocated for Lisp objects after one garbage collection in order to | 448 | be allocated for Lisp objects after one garbage collection in order to |
| 391 | trigger another garbage collection. A cons cell counts as eight bytes, | 449 | trigger another garbage collection. You can use the result returned by |
| 392 | a string as one byte per character plus a few bytes of overhead, and so | 450 | @code{garbage-collect} to get an information about size of the particular |
| 393 | on; space allocated to the contents of buffers does not count. Note | 451 | object type; space allocated to the contents of buffers does not count. |
| 394 | that the subsequent garbage collection does not happen immediately when | 452 | Note that the subsequent garbage collection does not happen immediately |
| 395 | the threshold is exhausted, but only the next time the Lisp evaluator is | 453 | when the threshold is exhausted, but only the next time the Lisp interpreter |
| 396 | called. | 454 | is called. |
| 397 | 455 | ||
| 398 | The initial threshold value is 800,000. If you specify a larger | 456 | The initial threshold value is @code{GC_DEFAULT_THRESHOLD}, defined in |
| 399 | value, garbage collection will happen less often. This reduces the | 457 | @file{alloc.c}. Since it's defined in @code{word_size} units, the value |
| 400 | amount of time spent garbage collecting, but increases total memory use. | 458 | is 400,000 for the default 32-bit configuration and 800,000 for the 64-bit |
| 401 | You may want to do this when running a program that creates lots of | 459 | one. If you specify a larger value, garbage collection will happen less |
| 402 | Lisp data. | 460 | often. This reduces the amount of time spent garbage collecting, but |
| 403 | 461 | increases total memory use. You may want to do this when running a program | |
| 404 | You can make collections more frequent by specifying a smaller value, | 462 | that creates lots of Lisp data. |
| 405 | down to 10,000. A value less than 10,000 will remain in effect only | 463 | |
| 406 | until the subsequent garbage collection, at which time | 464 | You can make collections more frequent by specifying a smaller value, down |
| 407 | @code{garbage-collect} will set the threshold back to 10,000. | 465 | to 1/10th of @code{GC_DEFAULT_THRESHOLD}. A value less than this minimum |
| 466 | will remain in effect only until the subsequent garbage collection, at which | ||
| 467 | time @code{garbage-collect} will set the threshold back to the minimum. | ||
| 408 | @end defopt | 468 | @end defopt |
| 409 | 469 | ||
| 410 | @defopt gc-cons-percentage | 470 | @defopt gc-cons-percentage |
| @@ -639,7 +699,12 @@ in the file @file{lisp.h}.) If the primitive has no upper limit on | |||
| 639 | the number of Lisp arguments, it must have exactly two C arguments: | 699 | the number of Lisp arguments, it must have exactly two C arguments: |
| 640 | the first is the number of Lisp arguments, and the second is the | 700 | the first is the number of Lisp arguments, and the second is the |
| 641 | address of a block containing their values. These have types | 701 | address of a block containing their values. These have types |
| 642 | @code{int} and @w{@code{Lisp_Object *}} respectively. | 702 | @code{int} and @w{@code{Lisp_Object *}} respectively. Since |
| 703 | @code{Lisp_Object} can hold any Lisp object of any data type, you | ||
| 704 | can determine the actual data type only at run time; so if you want | ||
| 705 | a primitive to accept only a certain type of argument, you must check | ||
| 706 | the type explicitly using a suitable predicate (@pxref{Type Predicates}). | ||
| 707 | @cindex type checking internals | ||
| 643 | 708 | ||
| 644 | @cindex @code{GCPRO} and @code{UNGCPRO} | 709 | @cindex @code{GCPRO} and @code{UNGCPRO} |
| 645 | @cindex protect C variables from garbage collection | 710 | @cindex protect C variables from garbage collection |
| @@ -820,23 +885,70 @@ knows about it. | |||
| 820 | @section Object Internals | 885 | @section Object Internals |
| 821 | @cindex object internals | 886 | @cindex object internals |
| 822 | 887 | ||
| 823 | @c FIXME Is this still true? Does --with-wide-int affect anything? | 888 | Emacs Lisp provides a rich set of the data types. Some of them, like cons |
| 824 | GNU Emacs Lisp manipulates many different types of data. The actual | 889 | cells, integers and stirngs, are common to nearly all Lisp dialects. Some |
| 825 | data are stored in a heap and the only access that programs have to it | 890 | others, like markers and buffers, are quite special and needed to provide |
| 826 | is through pointers. Each pointer is 32 bits wide on 32-bit machines, | 891 | the basic support to write editor commands in Lisp. To implement such |
| 827 | and 64 bits wide on 64-bit machines; three of these bits are used for | 892 | a variety of object types and provide an efficient way to pass objects between |
| 828 | the tag that identifies the object's type, and the remainder are used | 893 | the subsystems of an interpreter, there is a set of C data structures and |
| 829 | to address the object. | 894 | a special type to represent the pointers to all of them, which is known as |
| 830 | 895 | @dfn{tagged pointer}. | |
| 831 | Because Lisp objects are represented as tagged pointers, it is always | 896 | |
| 832 | possible to determine the Lisp data type of any object. The C data type | 897 | In C, the tagged pointer is an object of type @code{Lisp_Object}. Any |
| 833 | @code{Lisp_Object} can hold any Lisp object of any data type. Ordinary | 898 | initialized variable of such a type always holds the value of one of the |
| 834 | variables have type @code{Lisp_Object}, which means they can hold any | 899 | following basic data types: integer, symbol, string, cons cell, float, |
| 835 | type of Lisp value; you can determine the actual data type only at run | 900 | vectorlike or miscellaneous object. Each of these data types has the |
| 836 | time. The same is true for function arguments; if you want a function | 901 | corresponding tag value. All tags are enumerated by @code{enum Lisp_Type} |
| 837 | to accept only a certain type of argument, you must check the type | 902 | and placed into a 3-bit bitfield of the @code{Lisp_Object}. The rest of the |
| 838 | explicitly using a suitable predicate (@pxref{Type Predicates}). | 903 | bits is the value itself. Integer values are immediate, i.e.@: directly |
| 839 | @cindex type checking internals | 904 | represented by those @dfn{value bits}, and all other objects are represented |
| 905 | by the C pointers to a corresponding object allocated from the heap. Width | ||
| 906 | of the @code{Lisp_Object} is platform- and configuration-dependent: usually | ||
| 907 | it's equal to the width of an underlying platform pointer (i.e.@: 32-bit on | ||
| 908 | a 32-bit machine and 64-bit on a 64-bit one), but also there is a special | ||
| 909 | configuration where @code{Lisp_Object} is 64-bit but all pointers are 32-bit. | ||
| 910 | The latter trick was designed to overcome the limited range of values for | ||
| 911 | Lisp integers on a 32-bit system by using 64-bit @code{long long} type for | ||
| 912 | @code{Lisp_Object}. | ||
| 913 | |||
| 914 | The following C data structures are defined in @file{lisp.h} to represent | ||
| 915 | the basic data types beyond integers: | ||
| 916 | |||
| 917 | @table @code | ||
| 918 | @item struct Lisp_Cons | ||
| 919 | Cons cell, an object used to construct lists. | ||
| 920 | |||
| 921 | @item struct Lisp_String | ||
| 922 | String, the basic object to represent a sequence of characters. | ||
| 923 | |||
| 924 | @item struct Lisp_Vector | ||
| 925 | Array, a fixed-size set of Lisp objects which may be accessed by an index. | ||
| 926 | |||
| 927 | @item struct Lisp_Symbol | ||
| 928 | Symbol, the unique-named entity commonly used as an identifier. | ||
| 929 | |||
| 930 | @item struct Lisp_Float | ||
| 931 | Floating point value. | ||
| 932 | |||
| 933 | @item union Lisp_Misc | ||
| 934 | Miscellaneous kinds of objects which don't fit into any of the above. | ||
| 935 | @end table | ||
| 936 | |||
| 937 | These types are the first-class citizens of an internal type system. | ||
| 938 | Since the tag space is limited, all other types are the subtypes of either | ||
| 939 | @code{Lisp_Vectorlike} or @code{Lisp_Misc}. Vector subtypes are enumerated | ||
| 940 | by @code{enum pvec_type}, and nearly all complex objects like windows, buffers, | ||
| 941 | frames, and processes fall into this category. The rest of special types, | ||
| 942 | including markers and overlays, are enumerated by @code{enum Lisp_Misc_Type} | ||
| 943 | and form the set of subtypes of @code{Lisp_Misc}. | ||
| 944 | |||
| 945 | Below there is a description of a few subtypes of @code{Lisp_Vectorlike}. | ||
| 946 | Buffer object represents the text to display and edit. Window is the part | ||
| 947 | of display structure which shows the buffer or used as a container to | ||
| 948 | recursively place other windows on the same frame. (Do not confuse Emacs Lisp | ||
| 949 | window object with the window as an entity managed by the user interface | ||
| 950 | system like X; in Emacs terminology, the latter is called frame.) Finally, | ||
| 951 | process object is used to manage the subprocesses. | ||
| 840 | 952 | ||
| 841 | @menu | 953 | @menu |
| 842 | * Buffer Internals:: Components of a buffer structure. | 954 | * Buffer Internals:: Components of a buffer structure. |
| @@ -912,12 +1024,8 @@ Some of the fields of @code{struct buffer} are: | |||
| 912 | 1024 | ||
| 913 | @table @code | 1025 | @table @code |
| 914 | @item header | 1026 | @item header |
| 915 | A @code{struct vectorlike_header} structure where @code{header.next} | 1027 | A header of type @code{struct vectorlike_header} is common to all |
| 916 | points to the next buffer, in the chain of all buffers (including | 1028 | vectorlike objects. |
| 917 | killed buffers). This chain is used only for garbage collection, in | ||
| 918 | order to collect killed buffers properly. Note that vectors, and most | ||
| 919 | kinds of objects allocated as vectors, are all on one chain, but | ||
| 920 | buffers are on a separate chain of their own. | ||
| 921 | 1029 | ||
| 922 | @item own_text | 1030 | @item own_text |
| 923 | A @code{struct buffer_text} structure that ordinarily holds the buffer | 1031 | A @code{struct buffer_text} structure that ordinarily holds the buffer |
| @@ -928,6 +1036,11 @@ A pointer to the @code{buffer_text} structure for this buffer. In an | |||
| 928 | ordinary buffer, this is the @code{own_text} field above. In an | 1036 | ordinary buffer, this is the @code{own_text} field above. In an |
| 929 | indirect buffer, this is the @code{own_text} field of the base buffer. | 1037 | indirect buffer, this is the @code{own_text} field of the base buffer. |
| 930 | 1038 | ||
| 1039 | @item next | ||
| 1040 | A pointer to the next buffer, in the chain of all buffers, including | ||
| 1041 | killed buffers. This chain is used only for allocation and garbage | ||
| 1042 | collection, in order to collect killed buffers properly. | ||
| 1043 | |||
| 931 | @item pt | 1044 | @item pt |
| 932 | @itemx pt_byte | 1045 | @itemx pt_byte |
| 933 | The character and byte positions of point in a buffer. | 1046 | The character and byte positions of point in a buffer. |
diff --git a/doc/lispref/keymaps.texi b/doc/lispref/keymaps.texi index f658f7e66fb..d01ecba4bed 100644 --- a/doc/lispref/keymaps.texi +++ b/doc/lispref/keymaps.texi | |||
| @@ -664,7 +664,9 @@ additional active keymaps through the variable | |||
| 664 | 664 | ||
| 665 | The highest precedence normal keymap comes from the @code{keymap} | 665 | The highest precedence normal keymap comes from the @code{keymap} |
| 666 | text or overlay property. If that is non-@code{nil}, it is the first | 666 | text or overlay property. If that is non-@code{nil}, it is the first |
| 667 | keymap to be processed, in normal circumstances. | 667 | keymap to be processed, in normal circumstances. Next comes |
| 668 | any keymap added by the function @code{set-temporary-overlay-map}. | ||
| 669 | @xref{Controlling Active Maps}. | ||
| 668 | 670 | ||
| 669 | However, there are also special ways for programs to substitute | 671 | However, there are also special ways for programs to substitute |
| 670 | other keymaps for some of those. The variable | 672 | other keymaps for some of those. The variable |
| @@ -753,12 +755,13 @@ them: | |||
| 753 | (overriding-local-map | 755 | (overriding-local-map |
| 754 | (@var{find-in} overriding-local-map)) | 756 | (@var{find-in} overriding-local-map)) |
| 755 | ((or (@var{find-in} (get-char-property (point) 'keymap)) | 757 | ((or (@var{find-in} (get-char-property (point) 'keymap)) |
| 756 | (@var{find-in-any} emulation-mode-map-alists) | 758 | (@var{find-in} @var{temp-map}) |
| 757 | (@var{find-in-any} minor-mode-overriding-map-alist) | 759 | (@var{find-in-any} emulation-mode-map-alists) |
| 758 | (@var{find-in-any} minor-mode-map-alist) | 760 | (@var{find-in-any} minor-mode-overriding-map-alist) |
| 759 | (if (get-text-property (point) 'local-map) | 761 | (@var{find-in-any} minor-mode-map-alist) |
| 760 | (@var{find-in} (get-char-property (point) 'local-map)) | 762 | (if (get-text-property (point) 'local-map) |
| 761 | (@var{find-in} (current-local-map)))))) | 763 | (@var{find-in} (get-char-property (point) 'local-map)) |
| 764 | (@var{find-in} (current-local-map)))))) | ||
| 762 | (@var{find-in} (current-global-map))) | 765 | (@var{find-in} (current-global-map))) |
| 763 | @end lisp | 766 | @end lisp |
| 764 | 767 | ||
| @@ -770,7 +773,8 @@ Lookup}.) If the key sequence starts with a mouse event, or a | |||
| 770 | symbolic prefix event followed by a mouse event, that event's position | 773 | symbolic prefix event followed by a mouse event, that event's position |
| 771 | is used instead of point and the current buffer. Mouse events on an | 774 | is used instead of point and the current buffer. Mouse events on an |
| 772 | embedded string use non-@code{nil} text properties from that string | 775 | embedded string use non-@code{nil} text properties from that string |
| 773 | instead of the buffer. | 776 | instead of the buffer. @var{temp-map} is a pseudo variable that |
| 777 | represents the effect of a @code{set-temporary-overlay-map} call. | ||
| 774 | 778 | ||
| 775 | When a match is found (@pxref{Key Lookup}), if the binding in the | 779 | When a match is found (@pxref{Key Lookup}), if the binding in the |
| 776 | keymap is a function, the search is over. However if the keymap entry | 780 | keymap is a function, the search is over. However if the keymap entry |
| @@ -950,6 +954,21 @@ are used before @code{minor-mode-map-alist} and | |||
| 950 | @code{minor-mode-overriding-map-alist}. | 954 | @code{minor-mode-overriding-map-alist}. |
| 951 | @end defvar | 955 | @end defvar |
| 952 | 956 | ||
| 957 | @defun set-temporary-overlay-map keymap &optional keep | ||
| 958 | This function adds @var{keymap} as a temporary keymap that takes | ||
| 959 | precedence over most other keymaps. It does not take precedence over | ||
| 960 | the ``overriding'' maps (see above); and unlike them, if no match for | ||
| 961 | a key is found in @var{keymap}, the search continues. | ||
| 962 | |||
| 963 | Normally, @var{keymap} is used only once. If the optional argument | ||
| 964 | @var{pred} is @code{t}, the map stays active if a key from @var{keymap} | ||
| 965 | is used. @var{pred} can also be a function of no arguments: if it returns | ||
| 966 | non-@code{nil} then @var{keymap} stays active. | ||
| 967 | |||
| 968 | For a pseudo-Lisp description of exactly how and when this keymap applies, | ||
| 969 | @pxref{Searching Keymaps}. | ||
| 970 | @end defun | ||
| 971 | |||
| 953 | @node Key Lookup | 972 | @node Key Lookup |
| 954 | @section Key Lookup | 973 | @section Key Lookup |
| 955 | @cindex key lookup | 974 | @cindex key lookup |
| @@ -1540,14 +1559,11 @@ sequence, to translate certain event sequences into others. | |||
| 1540 | being read, as it is read, against @code{input-decode-map}, then | 1559 | being read, as it is read, against @code{input-decode-map}, then |
| 1541 | @code{local-function-key-map}, and then against @code{key-translation-map}. | 1560 | @code{local-function-key-map}, and then against @code{key-translation-map}. |
| 1542 | 1561 | ||
| 1543 | @defvar input-decode-map | 1562 | These keymaps have the same structure as other keymaps, but they are used |
| 1544 | This variable holds a keymap that describes the character sequences sent | 1563 | differently: they specify translations to make while reading key sequences, |
| 1545 | by function keys on an ordinary character terminal. This keymap has the | 1564 | rather than bindings for key sequences. |
| 1546 | same structure as other keymaps, but is used differently: it specifies | ||
| 1547 | translations to make while reading key sequences, rather than bindings | ||
| 1548 | for key sequences. | ||
| 1549 | 1565 | ||
| 1550 | If @code{input-decode-map} ``binds'' a key sequence @var{k} to a vector | 1566 | If one of these keymaps ``binds'' a key sequence @var{k} to a vector |
| 1551 | @var{v}, then when @var{k} appears as a subsequence @emph{anywhere} in a | 1567 | @var{v}, then when @var{k} appears as a subsequence @emph{anywhere} in a |
| 1552 | key sequence, it is replaced with the events in @var{v}. | 1568 | key sequence, it is replaced with the events in @var{v}. |
| 1553 | 1569 | ||
| @@ -1562,6 +1578,10 @@ Thus, typing @kbd{C-c @key{PF1}} sends the character sequence @kbd{C-c | |||
| 1562 | this back into @kbd{C-c @key{PF1}}, which it returns as the vector | 1578 | this back into @kbd{C-c @key{PF1}}, which it returns as the vector |
| 1563 | @code{[?\C-c pf1]}. | 1579 | @code{[?\C-c pf1]}. |
| 1564 | 1580 | ||
| 1581 | @defvar input-decode-map | ||
| 1582 | This variable holds a keymap that describes the character sequences sent | ||
| 1583 | by function keys on an ordinary character terminal. | ||
| 1584 | |||
| 1565 | The value of @code{input-decode-map} is usually set up automatically | 1585 | The value of @code{input-decode-map} is usually set up automatically |
| 1566 | according to the terminal's Terminfo or Termcap entry, but sometimes | 1586 | according to the terminal's Terminfo or Termcap entry, but sometimes |
| 1567 | those need help from terminal-specific Lisp files. Emacs comes with | 1587 | those need help from terminal-specific Lisp files. Emacs comes with |
| @@ -1636,8 +1656,6 @@ to turn the character that follows into a Hyper character: | |||
| 1636 | (let ((symbol (if (symbolp e) e (car e)))) | 1656 | (let ((symbol (if (symbolp e) e (car e)))) |
| 1637 | (setq symbol (intern (concat string | 1657 | (setq symbol (intern (concat string |
| 1638 | (symbol-name symbol)))) | 1658 | (symbol-name symbol)))) |
| 1639 | @end group | ||
| 1640 | @group | ||
| 1641 | (if (symbolp e) | 1659 | (if (symbolp e) |
| 1642 | symbol | 1660 | symbol |
| 1643 | (cons symbol (cdr e))))) | 1661 | (cons symbol (cdr e))))) |
| @@ -1647,10 +1665,30 @@ to turn the character that follows into a Hyper character: | |||
| 1647 | @end example | 1665 | @end example |
| 1648 | 1666 | ||
| 1649 | If you have enabled keyboard character set decoding using | 1667 | If you have enabled keyboard character set decoding using |
| 1650 | @code{set-keyboard-coding-system}, decoding is done after the | 1668 | @code{set-keyboard-coding-system}, decoding is done before the |
| 1651 | translations listed above. @xref{Terminal I/O Encoding}. However, in | 1669 | translations listed above. @xref{Terminal I/O Encoding}. |
| 1652 | future Emacs versions, character set decoding may be done at an | 1670 | |
| 1653 | earlier stage. | 1671 | @subsection Interaction with normal keymaps |
| 1672 | |||
| 1673 | The end of a key sequence is detected when that key sequence either is bound | ||
| 1674 | to a command, or when Emacs determines that no additional event can lead | ||
| 1675 | to a sequence that is bound to a command. | ||
| 1676 | |||
| 1677 | This means that, while @code{input-decode-map} and @code{key-translation-map} | ||
| 1678 | apply regardless of whether the original key sequence would have a binding, the | ||
| 1679 | presence of such a binding can still prevent translation from taking place. | ||
| 1680 | For example, let us return to our VT100 example above and add a binding for | ||
| 1681 | @kbd{C-c @key{ESC}} to the global map; now when the user hits @kbd{C-c | ||
| 1682 | @key{PF1}} Emacs will fail to decode @kbd{C-c @key{ESC} O P} into @kbd{C-c | ||
| 1683 | @key{PF1}} because it will stop reading keys right after @kbd{C-x @key{ESC}}, | ||
| 1684 | leaving @kbd{O P} for later. This is in case the user really hit @kbd{C-c | ||
| 1685 | @key{ESC}}, in which case Emacs should not sit there waiting for the next key | ||
| 1686 | to decide whether the user really pressed @kbd{@key{ESC}} or @kbd{@key{PF1}}. | ||
| 1687 | |||
| 1688 | For that reason, it is better to avoid binding commands to key sequences where | ||
| 1689 | the end of the key sequence is a prefix of a key translation. The main such | ||
| 1690 | problematic suffixes/prefixes are @kbd{@key{ESC}}, @kbd{M-O} (which is really | ||
| 1691 | @kbd{@key{ESC} O}) and @kbd{M-[} (which is really @kbd{@key{ESC} [}). | ||
| 1654 | 1692 | ||
| 1655 | @node Key Binding Commands | 1693 | @node Key Binding Commands |
| 1656 | @section Commands for Binding Keys | 1694 | @section Commands for Binding Keys |
| @@ -2629,8 +2667,8 @@ By default, the global map binds @code{[tool-bar]} as follows: | |||
| 2629 | 2667 | ||
| 2630 | @example | 2668 | @example |
| 2631 | (global-set-key [tool-bar] | 2669 | (global-set-key [tool-bar] |
| 2632 | `(menu-item ,(purecopy "tool bar") ignore | 2670 | `(menu-item ,(purecopy "tool bar") ignore |
| 2633 | :filter tool-bar-make-keymap)) | 2671 | :filter tool-bar-make-keymap)) |
| 2634 | @end example | 2672 | @end example |
| 2635 | 2673 | ||
| 2636 | @noindent | 2674 | @noindent |
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi index bb02b1d54fd..efbfebc670f 100644 --- a/doc/lispref/windows.texi +++ b/doc/lispref/windows.texi | |||
| @@ -1055,7 +1055,7 @@ including the space earlier stolen from @code{W3}. | |||
| 1055 | @end smallexample | 1055 | @end smallexample |
| 1056 | 1056 | ||
| 1057 | @noindent | 1057 | @noindent |
| 1058 | This can be counterintutive, in particular if @code{W4} were used for | 1058 | This can be counterintuitive, in particular if @code{W4} were used for |
| 1059 | displaying a buffer only temporarily (@pxref{Temporary Displays}), and | 1059 | displaying a buffer only temporarily (@pxref{Temporary Displays}), and |
| 1060 | you want to continue working with the initial layout. | 1060 | you want to continue working with the initial layout. |
| 1061 | 1061 | ||
| @@ -1766,6 +1766,7 @@ Like @code{switch-to-buffer}, this function updates the buffer list | |||
| 1766 | unless @var{norecord} is non-@code{nil}. | 1766 | unless @var{norecord} is non-@code{nil}. |
| 1767 | @end deffn | 1767 | @end deffn |
| 1768 | 1768 | ||
| 1769 | |||
| 1769 | @node Choosing Window | 1770 | @node Choosing Window |
| 1770 | @section Choosing a Window for Display | 1771 | @section Choosing a Window for Display |
| 1771 | 1772 | ||
| @@ -1851,10 +1852,14 @@ default value is empty, i.e. @code{(nil . nil)}. | |||
| 1851 | @end defvar | 1852 | @end defvar |
| 1852 | 1853 | ||
| 1853 | @defopt display-buffer-alist | 1854 | @defopt display-buffer-alist |
| 1854 | The value of this option is an alist mapping regular expressions to | 1855 | The value of this option is an alist mapping conditions to display |
| 1855 | display actions. If the name of the buffer passed to | 1856 | actions. Each condition may be either a regular expression matching a |
| 1856 | @code{display-buffer} matches a regular expression in this alist, then | 1857 | buffer name or a function that takes two arguments - a buffer name and |
| 1857 | @code{display-buffer} uses the corresponding display action. | 1858 | the @var{action} argument passed to @code{display-buffer}. If the name |
| 1859 | of the buffer passed to @code{display-buffer} either matches a regular | ||
| 1860 | expression in this alist or the function specified by a condition | ||
| 1861 | returns non-@code{nil}, then @code{display-buffer} uses the | ||
| 1862 | corresponding display action to display the buffer. | ||
| 1858 | @end defopt | 1863 | @end defopt |
| 1859 | 1864 | ||
| 1860 | @defopt display-buffer-base-action | 1865 | @defopt display-buffer-base-action |
| @@ -1868,6 +1873,7 @@ This display action specifies the fallback behavior for | |||
| 1868 | @code{display-buffer} if no other display actions are given. | 1873 | @code{display-buffer} if no other display actions are given. |
| 1869 | @end defvr | 1874 | @end defvr |
| 1870 | 1875 | ||
| 1876 | |||
| 1871 | @node Display Action Functions | 1877 | @node Display Action Functions |
| 1872 | @section Action Functions for @code{display-buffer} | 1878 | @section Action Functions for @code{display-buffer} |
| 1873 | 1879 | ||
| @@ -1911,8 +1917,9 @@ normally searches just the selected frame; however, if the variable | |||
| 1911 | @code{pop-up-frames} is non-@code{nil}, it searches all frames on the | 1917 | @code{pop-up-frames} is non-@code{nil}, it searches all frames on the |
| 1912 | current terminal. @xref{Choosing Window Options}. | 1918 | current terminal. @xref{Choosing Window Options}. |
| 1913 | 1919 | ||
| 1914 | If this function chooses a window on another frame, it makes that | 1920 | If this function chooses a window on another frame, it makes that frame |
| 1915 | frame visible and raises it if necessary. | 1921 | visible and, unless @var{alist} contains an @code{inhibit-switch-frame} |
| 1922 | entry (@pxref{Choosing Window Options}), raises that frame if necessary. | ||
| 1916 | @end defun | 1923 | @end defun |
| 1917 | 1924 | ||
| 1918 | @defun display-buffer-pop-up-frame buffer alist | 1925 | @defun display-buffer-pop-up-frame buffer alist |
| @@ -1976,16 +1983,12 @@ reason (e.g. if there is just one frame and it has an | |||
| 1976 | @code{unsplittable} frame parameter; @pxref{Buffer Parameters}). | 1983 | @code{unsplittable} frame parameter; @pxref{Buffer Parameters}). |
| 1977 | @end defun | 1984 | @end defun |
| 1978 | 1985 | ||
| 1979 | @defun display-buffer-use-some-window buffer alist | ||
| 1980 | This function tries to display @var{buffer} by choosing an existing | ||
| 1981 | window and displaying the buffer in that window. It can fail if all | ||
| 1982 | windows are dedicated to another buffer (@pxref{Dedicated Windows}). | ||
| 1983 | @end defun | ||
| 1984 | |||
| 1985 | @defun display-buffer-below-selected buffer alist | 1986 | @defun display-buffer-below-selected buffer alist |
| 1986 | This function tries to display @var{buffer} in a window below the | 1987 | 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 | selected window. This means to either split the selected window or use |
| 1988 | reuse the window below the selected one. | 1989 | the window below the selected one. If it does create a new window, it |
| 1990 | will also adjust its size provided @var{alist} contains a suitable | ||
| 1991 | @code{window-height} or @code{window-width} entry, see above. | ||
| 1989 | @end defun | 1992 | @end defun |
| 1990 | 1993 | ||
| 1991 | @defun display-buffer-in-previous-window buffer alist | 1994 | @defun display-buffer-in-previous-window buffer alist |
| @@ -2001,6 +2004,83 @@ specified by that entry will override any other window found by the | |||
| 2001 | methods above, even if that window never showed @var{buffer} before. | 2004 | methods above, even if that window never showed @var{buffer} before. |
| 2002 | @end defun | 2005 | @end defun |
| 2003 | 2006 | ||
| 2007 | @defun display-buffer-use-some-window buffer alist | ||
| 2008 | This function tries to display @var{buffer} by choosing an existing | ||
| 2009 | window and displaying the buffer in that window. It can fail if all | ||
| 2010 | windows are dedicated to another buffer (@pxref{Dedicated Windows}). | ||
| 2011 | @end defun | ||
| 2012 | |||
| 2013 | To illustrate the use of action functions, consider the following | ||
| 2014 | example. | ||
| 2015 | |||
| 2016 | @example | ||
| 2017 | @group | ||
| 2018 | (display-buffer | ||
| 2019 | (get-buffer-create "*foo*") | ||
| 2020 | '((display-buffer-reuse-window | ||
| 2021 | display-buffer-pop-up-window | ||
| 2022 | display-buffer-pop-up-frame) | ||
| 2023 | (reusable-frames . 0) | ||
| 2024 | (window-height . 10) (window-width . 40))) | ||
| 2025 | @end group | ||
| 2026 | @end example | ||
| 2027 | |||
| 2028 | @noindent | ||
| 2029 | Evaluating the form above will cause @code{display-buffer} to proceed as | ||
| 2030 | follows: If `*foo*' already appears on a visible or iconified frame, it | ||
| 2031 | will reuse its window. Otherwise, it will try to pop up a new window | ||
| 2032 | or, if that is impossible, a new frame. If all these steps fail, it | ||
| 2033 | will try to use some existing window. | ||
| 2034 | |||
| 2035 | Furthermore, @code{display-buffer} will try to adjust a reused window | ||
| 2036 | (provided `*foo*' was put by @code{display-buffer} there before) or a | ||
| 2037 | popped-up window as follows: If the window is part of a vertical | ||
| 2038 | combination, it will set its height to ten lines. Note that if, instead | ||
| 2039 | of the number ``10'', we specified the function | ||
| 2040 | @code{fit-window-to-buffer}, @code{display-buffer} would come up with a | ||
| 2041 | one-line window to fit the empty buffer. If the window is part of a | ||
| 2042 | horizontal combination, it sets its width to 40 columns. Whether a new | ||
| 2043 | window is vertically or horizontally combined depends on the shape of | ||
| 2044 | the window split and the values of | ||
| 2045 | @code{split-window-preferred-function}, @code{split-height-threshold} | ||
| 2046 | and @code{split-width-threshold} (@pxref{Choosing Window Options}). | ||
| 2047 | |||
| 2048 | Now suppose we combine this call with a preexisting setup for | ||
| 2049 | `display-buffer-alist' as follows. | ||
| 2050 | |||
| 2051 | @example | ||
| 2052 | @group | ||
| 2053 | (let ((display-buffer-alist | ||
| 2054 | (cons | ||
| 2055 | '("\\*foo\\*" | ||
| 2056 | (display-buffer-reuse-window display-buffer-below-selected) | ||
| 2057 | (reusable-frames) | ||
| 2058 | (window-height . 5)) | ||
| 2059 | display-buffer-alist))) | ||
| 2060 | (display-buffer | ||
| 2061 | (get-buffer-create "*foo*") | ||
| 2062 | '((display-buffer-reuse-window | ||
| 2063 | display-buffer-pop-up-window | ||
| 2064 | display-buffer-pop-up-frame) | ||
| 2065 | (reusable-frames . 0) | ||
| 2066 | (window-height . 10) (window-width . 40)))) | ||
| 2067 | @end group | ||
| 2068 | @end example | ||
| 2069 | |||
| 2070 | @noindent | ||
| 2071 | Evaluating this form will cause @code{display-buffer} to first try | ||
| 2072 | reusing a window showing @code{*foo*} on the selected frame. | ||
| 2073 | If no such window exists, it will try to split the selected window or, | ||
| 2074 | if that is impossible, use the window below the selected window. | ||
| 2075 | |||
| 2076 | If there's no window below the selected one, or the window below the | ||
| 2077 | selected one is dedicated to its buffer, @code{display-buffer} will | ||
| 2078 | proceed as described in the previous example. Note, however, that when | ||
| 2079 | it tries to adjust the height of any reused or popped-up window, it will | ||
| 2080 | in any case try to set its number of lines to ``5'' since that value | ||
| 2081 | overrides the corresponding specification in the @var{action} argument | ||
| 2082 | of @code{display-buffer}. | ||
| 2083 | |||
| 2004 | 2084 | ||
| 2005 | @node Choosing Window Options | 2085 | @node Choosing Window Options |
| 2006 | @section Additional Options for Displaying Buffers | 2086 | @section Additional Options for Displaying Buffers |
| @@ -2343,7 +2423,7 @@ buffer previously shown no longer exists, this function calls | |||
| 2343 | @code{switch-to-prev-buffer} (@pxref{Window History}) to show some other | 2423 | @code{switch-to-prev-buffer} (@pxref{Window History}) to show some other |
| 2344 | buffer instead. | 2424 | buffer instead. |
| 2345 | 2425 | ||
| 2346 | The optional argument @var{bury-or-kill} specifes how to deal with | 2426 | The optional argument @var{bury-or-kill} specifies how to deal with |
| 2347 | @var{window}'s buffer. The following values are handled: | 2427 | @var{window}'s buffer. The following values are handled: |
| 2348 | 2428 | ||
| 2349 | @table @code | 2429 | @table @code |