aboutsummaryrefslogtreecommitdiffstats
path: root/doc/lispref
diff options
context:
space:
mode:
Diffstat (limited to 'doc/lispref')
-rw-r--r--doc/lispref/ChangeLog32
-rw-r--r--doc/lispref/display.texi17
-rw-r--r--doc/lispref/internals.texi295
-rw-r--r--doc/lispref/keymaps.texi84
-rw-r--r--doc/lispref/windows.texi112
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 @@
12012-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
92012-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
202012-11-15 Stefan Monnier <monnier@iro.umontreal.ca>
21
22 * keymaps.texi (Translation Keymaps): Add a subsection "Interaction
23 with normal keymaps".
24
252012-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
12012-11-13 Glenn Morris <rgm@gnu.org> 332012-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.
2009Underline with the foreground color of the face. 2009Underline with the foreground color of the face.
2010 2010
2011@item @var{color} 2011@item @var{color}
2012Underline in color @var{color}; which should be either a string 2012Underline in color @var{color}, a string specifying a color.
2013specifying a color, or the symbol @code{foreground-color}, meaning the
2014foreground 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},
2016meaning 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
2020use a straight or wavy line. Omitting the attribute @code{:style} 2019use 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
2408This sets the @code{:underline} attribute of @var{face} to 2407This 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
2471This function returns the @code{:underline} attribute of face @var{face}. 2472This function returns non-@code{nil} if face @var{face} specifies
2473a 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
2475This function returns the @code{:inverse-video} attribute of face @var{face}. 2477This function returns non-@code{nil} if face @var{face} specifies
2478a 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
227frame are managed as if they were vectors. The corresponding C data 227frame are managed as if they were vectors. The corresponding C data
228structures include the @code{struct vectorlike_header} field whose 228structures 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 230and an information about how many @code{Lisp_Object} fields this structure
231a killed buffer), and @code{header.next.vector} points to the next 231contains and what the size of the rest data is. This information is
232vector in a free list. If a vector is small (smaller than or equal to 232needed to calculate the memory footprint of an object, and used
233@code{VBLOCK_BYTES_MAX} bytes, see @file{alloc.c}), then 233by 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
284spontaneously if you use more than @code{gc-cons-threshold} bytes of 283spontaneously if you use more than @code{gc-cons-threshold} bytes of
285Lisp data since the previous garbage collection.) 284Lisp 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
288information: 287use, where each entry has the form @samp{(@var{name} @var{size} @var{used})}
288or @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
291of those objects that were found live in the heap, and optional @var{free} is
292the number of those objects that are not live but that Emacs keeps around for
293future 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
303Here is an example: 309Here 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
315Here is a table explaining each element: 321Below is a table explaining each element. Note that last @code{heap} entry
322is optional and present only if an underlying @code{malloc} implementation
323provides @code{mallinfo} function.
316 324
317@table @var 325@table @var
326@item cons-size
327Internal size of a cons cell, i.e.@: @code{sizeof (struct Lisp_Cons)}.
328
318@item used-conses 329@item used-conses
319The number of cons cells in use. 330The number of cons cells in use.
320 331
321@item free-conses 332@item free-conses
322The number of cons cells for which space has been obtained from the 333The number of cons cells for which space has been obtained from
323operating system, but that are not currently being used. 334the operating system, but that are not currently being used.
324 335
325@item used-syms 336@item symbol-size
337Internal size of a symbol, i.e.@: @code{sizeof (struct Lisp_Symbol)}.
338
339@item used-symbols
326The number of symbols in use. 340The number of symbols in use.
327 341
328@item free-syms 342@item free-symbols
329The number of symbols for which space has been obtained from the 343The number of symbols for which space has been obtained from
330operating system, but that are not currently being used. 344the operating system, but that are not currently being used.
345
346@item misc-size
347Internal size of a miscellaneous entity, i.e.@:
348@code{sizeof (union Lisp_Misc)}, which is a size of the
349largest type enumerated in @code{enum Lisp_Misc_Type}.
331 350
332@item used-miscs 351@item used-miscs
333The number of miscellaneous objects in use. These include markers and 352The number of miscellaneous objects in use. These include markers
334overlays, plus certain objects not visible to users. 353and overlays, plus certain objects not visible to users.
335 354
336@item free-miscs 355@item free-miscs
337The number of miscellaneous objects for which space has been obtained 356The number of miscellaneous objects for which space has been obtained
338from the operating system, but that are not currently being used. 357from the operating system, but that are not currently being used.
339 358
340@item used-string-chars 359@item string-size
341The total size of all strings, in characters. 360Internal size of a string header, i.e.@: @code{sizeof (struct Lisp_String)}.
361
362@item used-strings
363The number of string headers in use.
364
365@item free-strings
366The number of string headers for which space has been obtained
367from the operating system, but that are not currently being used.
368
369@item byte-size
370This is used for convenience and equals to @code{sizeof (char)}.
371
372@item used-bytes
373The total size of all string data in bytes.
374
375@item vector-size
376Internal size of a vector header, i.e.@: @code{sizeof (struct Lisp_Vector)}.
342 377
343@item used-vector-slots 378@item used-vectors
344The total number of elements of existing vectors. 379The number of vector headers allocated from the vector blocks.
380
381@item slot-size
382Internal size of a vector slot, always equal to @code{sizeof (Lisp_Object)}.
383
384@item used-slots
385The number of slots in all used vectors.
386
387@item free-slots
388The number of free slots in all vector blocks.
389
390@item float-size
391Internal 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
347The number of floats in use. 395The number of floats in use.
348 396
349@item free-floats 397@item free-floats
350The number of floats for which space has been obtained from the 398The number of floats for which space has been obtained from
351operating system, but that are not currently being used. 399the operating system, but that are not currently being used.
400
401@item interval-size
402Internal size of an interval object, i.e.@: @code{sizeof (struct interval)}.
352 403
353@item used-intervals 404@item used-intervals
354The number of intervals in use. Intervals are an internal 405The number of intervals in use.
355data structure used for representing text properties.
356 406
357@item free-intervals 407@item free-intervals
358The number of intervals for which space has been obtained 408The number of intervals for which space has been obtained from
359from the operating system, but that are not currently being used. 409the operating system, but that are not currently being used.
360 410
361@item used-strings 411@item buffer-size
362The number of strings in use. 412Internal 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
365The number of string headers for which the space was obtained from the 416The number of buffer objects in use. This includes killed buffers
366operating system, but which are currently not in use. (A string 417invisible to users, i.e.@: all buffers in @code{all_buffers} list.
367object consists of a header and the storage for the string text 418
368itself; the latter is only allocated when the string is created.) 419@item unit-size
420The unit of heap space measurement, always equal to 1024 bytes.
421
422@item total-size
423Total heap size, in @var{unit-size} units.
424
425@item free-size
426Heap space which is not currently used, in @var{unit-size} units.
369@end table 427@end table
370 428
371If there was overflow in pure space (@pxref{Pure Storage}), 429If 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
389The value of this variable is the number of bytes of storage that must 447The value of this variable is the number of bytes of storage that must
390be allocated for Lisp objects after one garbage collection in order to 448be allocated for Lisp objects after one garbage collection in order to
391trigger another garbage collection. A cons cell counts as eight bytes, 449trigger another garbage collection. You can use the result returned by
392a 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
393on; space allocated to the contents of buffers does not count. Note 451object type; space allocated to the contents of buffers does not count.
394that the subsequent garbage collection does not happen immediately when 452Note that the subsequent garbage collection does not happen immediately
395the threshold is exhausted, but only the next time the Lisp evaluator is 453when the threshold is exhausted, but only the next time the Lisp interpreter
396called. 454is called.
397 455
398The initial threshold value is 800,000. If you specify a larger 456The initial threshold value is @code{GC_DEFAULT_THRESHOLD}, defined in
399value, garbage collection will happen less often. This reduces the 457@file{alloc.c}. Since it's defined in @code{word_size} units, the value
400amount of time spent garbage collecting, but increases total memory use. 458is 400,000 for the default 32-bit configuration and 800,000 for the 64-bit
401You may want to do this when running a program that creates lots of 459one. If you specify a larger value, garbage collection will happen less
402Lisp data. 460often. This reduces the amount of time spent garbage collecting, but
403 461increases total memory use. You may want to do this when running a program
404You can make collections more frequent by specifying a smaller value, 462that creates lots of Lisp data.
405down to 10,000. A value less than 10,000 will remain in effect only 463
406until the subsequent garbage collection, at which time 464You can make collections more frequent by specifying a smaller value, down
407@code{garbage-collect} will set the threshold back to 10,000. 465to 1/10th of @code{GC_DEFAULT_THRESHOLD}. A value less than this minimum
466will remain in effect only until the subsequent garbage collection, at which
467time @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
639the number of Lisp arguments, it must have exactly two C arguments: 699the number of Lisp arguments, it must have exactly two C arguments:
640the first is the number of Lisp arguments, and the second is the 700the first is the number of Lisp arguments, and the second is the
641address of a block containing their values. These have types 701address 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
704can determine the actual data type only at run time; so if you want
705a primitive to accept only a certain type of argument, you must check
706the 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 889cells, integers and stirngs, are common to nearly all Lisp dialects. Some
825data are stored in a heap and the only access that programs have to it 890others, like markers and buffers, are quite special and needed to provide
826is through pointers. Each pointer is 32 bits wide on 32-bit machines, 891the basic support to write editor commands in Lisp. To implement such
827and 64 bits wide on 64-bit machines; three of these bits are used for 892a variety of object types and provide an efficient way to pass objects between
828the tag that identifies the object's type, and the remainder are used 893the subsystems of an interpreter, there is a set of C data structures and
829to address the object. 894a 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
832possible 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 898initialized variable of such a type always holds the value of one of the
834variables have type @code{Lisp_Object}, which means they can hold any 899following basic data types: integer, symbol, string, cons cell, float,
835type of Lisp value; you can determine the actual data type only at run 900vectorlike or miscellaneous object. Each of these data types has the
836time. The same is true for function arguments; if you want a function 901corresponding tag value. All tags are enumerated by @code{enum Lisp_Type}
837to accept only a certain type of argument, you must check the type 902and placed into a 3-bit bitfield of the @code{Lisp_Object}. The rest of the
838explicitly using a suitable predicate (@pxref{Type Predicates}). 903bits is the value itself. Integer values are immediate, i.e.@: directly
839@cindex type checking internals 904represented by those @dfn{value bits}, and all other objects are represented
905by the C pointers to a corresponding object allocated from the heap. Width
906of the @code{Lisp_Object} is platform- and configuration-dependent: usually
907it's equal to the width of an underlying platform pointer (i.e.@: 32-bit on
908a 32-bit machine and 64-bit on a 64-bit one), but also there is a special
909configuration where @code{Lisp_Object} is 64-bit but all pointers are 32-bit.
910The latter trick was designed to overcome the limited range of values for
911Lisp 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
915the basic data types beyond integers:
916
917@table @code
918@item struct Lisp_Cons
919Cons cell, an object used to construct lists.
920
921@item struct Lisp_String
922String, the basic object to represent a sequence of characters.
923
924@item struct Lisp_Vector
925Array, a fixed-size set of Lisp objects which may be accessed by an index.
926
927@item struct Lisp_Symbol
928Symbol, the unique-named entity commonly used as an identifier.
929
930@item struct Lisp_Float
931Floating point value.
932
933@item union Lisp_Misc
934Miscellaneous 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.
938Since 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
940by @code{enum pvec_type}, and nearly all complex objects like windows, buffers,
941frames, and processes fall into this category. The rest of special types,
942including markers and overlays, are enumerated by @code{enum Lisp_Misc_Type}
943and form the set of subtypes of @code{Lisp_Misc}.
944
945 Below there is a description of a few subtypes of @code{Lisp_Vectorlike}.
946Buffer object represents the text to display and edit. Window is the part
947of display structure which shows the buffer or used as a container to
948recursively place other windows on the same frame. (Do not confuse Emacs Lisp
949window object with the window as an entity managed by the user interface
950system like X; in Emacs terminology, the latter is called frame.) Finally,
951process 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
915A @code{struct vectorlike_header} structure where @code{header.next} 1027A header of type @code{struct vectorlike_header} is common to all
916points to the next buffer, in the chain of all buffers (including 1028vectorlike objects.
917killed buffers). This chain is used only for garbage collection, in
918order to collect killed buffers properly. Note that vectors, and most
919kinds of objects allocated as vectors, are all on one chain, but
920buffers are on a separate chain of their own.
921 1029
922@item own_text 1030@item own_text
923A @code{struct buffer_text} structure that ordinarily holds the buffer 1031A @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
928ordinary buffer, this is the @code{own_text} field above. In an 1036ordinary buffer, this is the @code{own_text} field above. In an
929indirect buffer, this is the @code{own_text} field of the base buffer. 1037indirect buffer, this is the @code{own_text} field of the base buffer.
930 1038
1039@item next
1040A pointer to the next buffer, in the chain of all buffers, including
1041killed buffers. This chain is used only for allocation and garbage
1042collection, in order to collect killed buffers properly.
1043
931@item pt 1044@item pt
932@itemx pt_byte 1045@itemx pt_byte
933The character and byte positions of point in a buffer. 1046The 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}
666text or overlay property. If that is non-@code{nil}, it is the first 666text or overlay property. If that is non-@code{nil}, it is the first
667keymap to be processed, in normal circumstances. 667keymap to be processed, in normal circumstances. Next comes
668any 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
670other keymaps for some of those. The variable 672other 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
770symbolic prefix event followed by a mouse event, that event's position 773symbolic prefix event followed by a mouse event, that event's position
771is used instead of point and the current buffer. Mouse events on an 774is used instead of point and the current buffer. Mouse events on an
772embedded string use non-@code{nil} text properties from that string 775embedded string use non-@code{nil} text properties from that string
773instead of the buffer. 776instead of the buffer. @var{temp-map} is a pseudo variable that
777represents 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
776keymap is a function, the search is over. However if the keymap entry 780keymap 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
958This function adds @var{keymap} as a temporary keymap that takes
959precedence over most other keymaps. It does not take precedence over
960the ``overriding'' maps (see above); and unlike them, if no match for
961a key is found in @var{keymap}, the search continues.
962
963Normally, @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}
965is used. @var{pred} can also be a function of no arguments: if it returns
966non-@code{nil} then @var{keymap} stays active.
967
968For 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.
1540being read, as it is read, against @code{input-decode-map}, then 1559being 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 1562These keymaps have the same structure as other keymaps, but they are used
1544This variable holds a keymap that describes the character sequences sent 1563differently: they specify translations to make while reading key sequences,
1545by function keys on an ordinary character terminal. This keymap has the 1564rather than bindings for key sequences.
1546same structure as other keymaps, but is used differently: it specifies
1547translations to make while reading key sequences, rather than bindings
1548for key sequences.
1549 1565
1550If @code{input-decode-map} ``binds'' a key sequence @var{k} to a vector 1566If 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
1552key sequence, it is replaced with the events in @var{v}. 1568key 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
1562this back into @kbd{C-c @key{PF1}}, which it returns as the vector 1578this 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
1582This variable holds a keymap that describes the character sequences sent
1583by function keys on an ordinary character terminal.
1584
1565The value of @code{input-decode-map} is usually set up automatically 1585The value of @code{input-decode-map} is usually set up automatically
1566according to the terminal's Terminfo or Termcap entry, but sometimes 1586according to the terminal's Terminfo or Termcap entry, but sometimes
1567those need help from terminal-specific Lisp files. Emacs comes with 1587those 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
1651translations listed above. @xref{Terminal I/O Encoding}. However, in 1669translations listed above. @xref{Terminal I/O Encoding}.
1652future Emacs versions, character set decoding may be done at an 1670
1653earlier stage. 1671@subsection Interaction with normal keymaps
1672
1673The end of a key sequence is detected when that key sequence either is bound
1674to a command, or when Emacs determines that no additional event can lead
1675to a sequence that is bound to a command.
1676
1677This means that, while @code{input-decode-map} and @code{key-translation-map}
1678apply regardless of whether the original key sequence would have a binding, the
1679presence of such a binding can still prevent translation from taking place.
1680For 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}},
1684leaving @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
1686to decide whether the user really pressed @kbd{@key{ESC}} or @kbd{@key{PF1}}.
1687
1688For that reason, it is better to avoid binding commands to key sequences where
1689the end of the key sequence is a prefix of a key translation. The main such
1690problematic 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
1058This can be counterintutive, in particular if @code{W4} were used for 1058This can be counterintuitive, in particular if @code{W4} were used for
1059displaying a buffer only temporarily (@pxref{Temporary Displays}), and 1059displaying a buffer only temporarily (@pxref{Temporary Displays}), and
1060you want to continue working with the initial layout. 1060you 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
1766unless @var{norecord} is non-@code{nil}. 1766unless @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
1854The value of this option is an alist mapping regular expressions to 1855The value of this option is an alist mapping conditions to display
1855display actions. If the name of the buffer passed to 1856actions. Each condition may be either a regular expression matching a
1856@code{display-buffer} matches a regular expression in this alist, then 1857buffer name or a function that takes two arguments - a buffer name and
1857@code{display-buffer} uses the corresponding display action. 1858the @var{action} argument passed to @code{display-buffer}. If the name
1859of the buffer passed to @code{display-buffer} either matches a regular
1860expression in this alist or the function specified by a condition
1861returns non-@code{nil}, then @code{display-buffer} uses the
1862corresponding 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
1912current terminal. @xref{Choosing Window Options}. 1918current terminal. @xref{Choosing Window Options}.
1913 1919
1914If this function chooses a window on another frame, it makes that 1920If this function chooses a window on another frame, it makes that frame
1915frame visible and raises it if necessary. 1921visible and, unless @var{alist} contains an @code{inhibit-switch-frame}
1922entry (@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
1980This function tries to display @var{buffer} by choosing an existing
1981window and displaying the buffer in that window. It can fail if all
1982windows 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
1986This function tries to display @var{buffer} in a window below the 1987This function tries to display @var{buffer} in a window below the
1987selected window. This means to either split the selected window or 1988selected window. This means to either split the selected window or use
1988reuse the window below the selected one. 1989the window below the selected one. If it does create a new window, it
1990will 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
2001methods above, even if that window never showed @var{buffer} before. 2004methods 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
2008This function tries to display @var{buffer} by choosing an existing
2009window and displaying the buffer in that window. It can fail if all
2010windows are dedicated to another buffer (@pxref{Dedicated Windows}).
2011@end defun
2012
2013To illustrate the use of action functions, consider the following
2014example.
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
2029Evaluating the form above will cause @code{display-buffer} to proceed as
2030follows: If `*foo*' already appears on a visible or iconified frame, it
2031will reuse its window. Otherwise, it will try to pop up a new window
2032or, if that is impossible, a new frame. If all these steps fail, it
2033will 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
2037popped-up window as follows: If the window is part of a vertical
2038combination, it will set its height to ten lines. Note that if, instead
2039of the number ``10'', we specified the function
2040@code{fit-window-to-buffer}, @code{display-buffer} would come up with a
2041one-line window to fit the empty buffer. If the window is part of a
2042horizontal combination, it sets its width to 40 columns. Whether a new
2043window is vertically or horizontally combined depends on the shape of
2044the window split and the values of
2045@code{split-window-preferred-function}, @code{split-height-threshold}
2046and @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
2071Evaluating this form will cause @code{display-buffer} to first try
2072reusing a window showing @code{*foo*} on the selected frame.
2073If no such window exists, it will try to split the selected window or,
2074if 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
2077selected one is dedicated to its buffer, @code{display-buffer} will
2078proceed as described in the previous example. Note, however, that when
2079it tries to adjust the height of any reused or popped-up window, it will
2080in any case try to set its number of lines to ``5'' since that value
2081overrides the corresponding specification in the @var{action} argument
2082of @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
2344buffer instead. 2424buffer instead.
2345 2425
2346The optional argument @var{bury-or-kill} specifes how to deal with 2426The 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