aboutsummaryrefslogtreecommitdiffstats
path: root/lispref/objects.texi
diff options
context:
space:
mode:
authorRichard M. Stallman1998-04-20 17:43:57 +0000
committerRichard M. Stallman1998-04-20 17:43:57 +0000
commit969fe9b5696c9d9d31f2faf1ca2e8af107013dcb (patch)
tree5d7d0399caf410b5c4849aa9d43352b18f68d4c9 /lispref/objects.texi
parentb933f645ac70a31659f364cabf7da730d27eb244 (diff)
downloademacs-969fe9b5696c9d9d31f2faf1ca2e8af107013dcb.tar.gz
emacs-969fe9b5696c9d9d31f2faf1ca2e8af107013dcb.zip
*** empty log message ***
Diffstat (limited to 'lispref/objects.texi')
-rw-r--r--lispref/objects.texi335
1 files changed, 187 insertions, 148 deletions
diff --git a/lispref/objects.texi b/lispref/objects.texi
index 66734920de9..ea1e8fb1632 100644
--- a/lispref/objects.texi
+++ b/lispref/objects.texi
@@ -25,7 +25,7 @@ but not for ``the'' type of an object.
25which all other types are constructed, are called @dfn{primitive 25which all other types are constructed, are called @dfn{primitive
26types}. Each object belongs to one and only one primitive type. These 26types}. Each object belongs to one and only one primitive type. These
27types include @dfn{integer}, @dfn{float}, @dfn{cons}, @dfn{symbol}, 27types include @dfn{integer}, @dfn{float}, @dfn{cons}, @dfn{symbol},
28@dfn{string}, @dfn{vector}, @dfn{subr}, @dfn{byte-code function}, and 28@dfn{string}, @dfn{vector}, @dfn{subr}, @dfn{byte-code function}, plus
29several special types, such as @dfn{buffer}, that are related to 29several special types, such as @dfn{buffer}, that are related to
30editing. (@xref{Editing Types}.) 30editing. (@xref{Editing Types}.)
31 31
@@ -69,8 +69,9 @@ input accepted by the Lisp reader (the function @code{read}) for that
69object. @xref{Read and Print}. 69object. @xref{Read and Print}.
70 70
71 Most objects have more than one possible read syntax. Some types of 71 Most objects have more than one possible read syntax. Some types of
72object have no read syntax; except for these cases, the printed 72object have no read syntax, since it may not make sense to enter objects
73representation of an object is also a read syntax for it. 73of these types directly in a Lisp program. Except for these cases, the
74printed representation of an object is also a read syntax for it.
74 75
75 In other languages, an expression is text; it has no other form. In 76 In other languages, an expression is text; it has no other form. In
76Lisp, an expression is primarily a Lisp object and only secondarily the 77Lisp, an expression is primarily a Lisp object and only secondarily the
@@ -80,14 +81,12 @@ mind, or you will occasionally be very confused.
80 81
81@cindex hash notation 82@cindex hash notation
82 Every type has a printed representation. Some types have no read 83 Every type has a printed representation. Some types have no read
83syntax, since it may not make sense to enter objects of these types 84syntax---for example, the buffer type has none. Objects of these types
84directly in a Lisp program. For example, the buffer type does not have 85are printed in @dfn{hash notation}: the characters @samp{#<} followed by
85a read syntax. Objects of these types are printed in @dfn{hash 86a descriptive string (typically the type name followed by the name of
86notation}: the characters @samp{#<} followed by a descriptive string 87the object), and closed with a matching @samp{>}. Hash notation cannot
87(typically the type name followed by the name of the object), and closed 88be read at all, so the Lisp reader signals the error
88with a matching @samp{>}. Hash notation cannot be read at all, so the 89@code{invalid-read-syntax} whenever it encounters @samp{#<}.
89Lisp reader signals the error @code{invalid-read-syntax} whenever it
90encounters @samp{#<}.
91@kindex invalid-read-syntax 90@kindex invalid-read-syntax
92 91
93@example 92@example
@@ -190,8 +189,7 @@ leading @samp{+} or a final @samp{.}.
1901 ; @r{The integer 1.} 1891 ; @r{The integer 1.}
1911. ; @r{Also The integer 1.} 1901. ; @r{Also The integer 1.}
192+1 ; @r{Also the integer 1.} 191+1 ; @r{Also the integer 1.}
193268435457 ; @r{Also the integer 1!} 192268435457 ; @r{Also the integer 1 on a 28-bit implementation.}
194 ; @r{ (on a 28-bit implementation)}
195@end group 193@end group
196@end example 194@end example
197 195
@@ -226,9 +224,10 @@ characters. @xref{String Type}.
226 224
227 Characters in strings, buffers, and files are currently limited to the 225 Characters in strings, buffers, and files are currently limited to the
228range of 0 to 524287---nineteen bits. But not all values in that range 226range of 0 to 524287---nineteen bits. But not all values in that range
229are valid character codes. Characters that represent keyboard input 227are valid character codes. Codes 0 through 127 are ASCII codes; the
230have a much wider range, so they can modifier keys such as Control, Meta 228rest are non-ASCII (@pxref{Non-ASCII Characters}). Characters that represent
231and Shift. 229keyboard input have a much wider range, to encode modifier keys such as
230Control, Meta and Shift.
232 231
233@cindex read syntax for characters 232@cindex read syntax for characters
234@cindex printed representation for characters 233@cindex printed representation for characters
@@ -283,7 +282,7 @@ respectively. Thus,
283?\a @result{} 7 ; @r{@kbd{C-g}} 282?\a @result{} 7 ; @r{@kbd{C-g}}
284?\b @result{} 8 ; @r{backspace, @key{BS}, @kbd{C-h}} 283?\b @result{} 8 ; @r{backspace, @key{BS}, @kbd{C-h}}
285?\t @result{} 9 ; @r{tab, @key{TAB}, @kbd{C-i}} 284?\t @result{} 9 ; @r{tab, @key{TAB}, @kbd{C-i}}
286?\n @result{} 10 ; @r{newline, @key{LFD}, @kbd{C-j}} 285?\n @result{} 10 ; @r{newline, @kbd{C-j}}
287?\v @result{} 11 ; @r{vertical tab, @kbd{C-k}} 286?\v @result{} 11 ; @r{vertical tab, @kbd{C-k}}
288?\f @result{} 12 ; @r{formfeed character, @kbd{C-l}} 287?\f @result{} 12 ; @r{formfeed character, @kbd{C-l}}
289?\r @result{} 13 ; @r{carriage return, @key{RET}, @kbd{C-m}} 288?\r @result{} 13 ; @r{carriage return, @key{RET}, @kbd{C-m}}
@@ -314,9 +313,9 @@ equivalent to @samp{?\^I} and to @samp{?\^i}:
314that exist in @sc{ASCII}; but for keyboard input purposes, you can turn 313that exist in @sc{ASCII}; but for keyboard input purposes, you can turn
315any character into a control character with @samp{C-}. The character 314any character into a control character with @samp{C-}. The character
316codes for these non-@sc{ASCII} control characters include the 315codes for these non-@sc{ASCII} control characters include the
317@iftex 316@tex
318$2^{26}$ 317$2^{26}$
319@end iftex 318@end tex
320@ifinfo 319@ifinfo
3212**26 3202**26
322@end ifinfo 321@end ifinfo
@@ -334,21 +333,22 @@ the control equivalent of @kbd{?}:
334 333
335@noindent 334@noindent
336As a result, it is currently not possible to represent the character 335As a result, it is currently not possible to represent the character
337@kbd{Control-?}, which is a meaningful input character under X. It is 336@kbd{Control-?}, which is a meaningful input character under X, using
338not easy to change this as various Lisp files refer to @key{DEL} in this 337@samp{\C-}. It is not easy to change this, as various Lisp files refer
339way. 338to @key{DEL} in this way.
340 339
341 For representing control characters to be found in files or strings, 340 For representing control characters to be found in files or strings,
342we recommend the @samp{^} syntax; for control characters in keyboard 341we recommend the @samp{^} syntax; for control characters in keyboard
343input, we prefer the @samp{C-} syntax. This does not affect the meaning 342input, we prefer the @samp{C-} syntax. Which one you use does not
344of the program, but may guide the understanding of people who read it. 343affect the meaning of the program, but may guide the understanding of
344people who read it.
345 345
346@cindex meta characters 346@cindex meta characters
347 A @dfn{meta character} is a character typed with the @key{META} 347 A @dfn{meta character} is a character typed with the @key{META}
348modifier key. The integer that represents such a character has the 348modifier key. The integer that represents such a character has the
349@iftex 349@tex
350$2^{27}$ 350$2^{27}$
351@end iftex 351@end tex
352@ifinfo 352@ifinfo
3532**27 3532**27
354@end ifinfo 354@end ifinfo
@@ -357,9 +357,9 @@ use high bits for this and other modifiers to make possible a wide range
357of basic character codes. 357of basic character codes.
358 358
359 In a string, the 359 In a string, the
360@iftex 360@tex
361$2^{7}$ 361$2^{7}$
362@end iftex 362@end tex
363@ifinfo 363@ifinfo
3642**7 3642**7
365@end ifinfo 365@end ifinfo
@@ -380,15 +380,15 @@ or as @samp{?\M-\101}. Likewise, you can write @kbd{C-M-b} as
380for example, @sc{ASCII} distinguishes between the characters @samp{a} 380for example, @sc{ASCII} distinguishes between the characters @samp{a}
381and @samp{A}. But @sc{ASCII} has no way to represent whether a control 381and @samp{A}. But @sc{ASCII} has no way to represent whether a control
382character is upper case or lower case. Emacs uses the 382character is upper case or lower case. Emacs uses the
383@iftex 383@tex
384$2^{25}$ 384$2^{25}$
385@end iftex 385@end tex
386@ifinfo 386@ifinfo
3872**25 3872**25
388@end ifinfo 388@end ifinfo
389bit to indicate that the shift key was used for typing a control 389bit to indicate that the shift key was used in typing a control
390character. This distinction is possible only when you use X terminals 390character. This distinction is possible only when you use X terminals
391or other special terminals; ordinary terminals do not indicate the 391or other special terminals; ordinary terminals do not report the
392distinction to the computer in any way. 392distinction to the computer in any way.
393 393
394@cindex hyper characters 394@cindex hyper characters
@@ -398,10 +398,10 @@ distinction to the computer in any way.
398in a character: @dfn{hyper}, @dfn{super} and @dfn{alt}. The syntaxes 398in a character: @dfn{hyper}, @dfn{super} and @dfn{alt}. The syntaxes
399for these bits are @samp{\H-}, @samp{\s-} and @samp{\A-}. Thus, 399for these bits are @samp{\H-}, @samp{\s-} and @samp{\A-}. Thus,
400@samp{?\H-\M-\A-x} represents @kbd{Alt-Hyper-Meta-x}. 400@samp{?\H-\M-\A-x} represents @kbd{Alt-Hyper-Meta-x}.
401@iftex 401@tex
402Numerically, the 402Numerically, the
403bit values are $2^{22}$ for alt, $2^{23}$ for super and $2^{24}$ for hyper. 403bit values are $2^{22}$ for alt, $2^{23}$ for super and $2^{24}$ for hyper.
404@end iftex 404@end tex
405@ifinfo 405@ifinfo
406Numerically, the 406Numerically, the
407bit values are 2**22 for alt, 2**23 for super and 2**24 for hyper. 407bit values are 2**22 for alt, 2**23 for super and 2**24 for hyper.
@@ -434,7 +434,7 @@ digits, so you can represent any character code in this way.
434Thus, @samp{?\x41} for the character @kbd{A}, @samp{?\x1} for the 434Thus, @samp{?\x41} for the character @kbd{A}, @samp{?\x1} for the
435character @kbd{C-a}, and @code{?\x8c0} for the character 435character @kbd{C-a}, and @code{?\x8c0} for the character
436@iftex 436@iftex
437@`a. 437@samp{@`a}.
438@end iftex 438@end iftex
439@ifinfo 439@ifinfo
440@samp{a} with grave accent. 440@samp{a} with grave accent.
@@ -478,7 +478,7 @@ backslash. In contrast to its use in strings, however, a backslash in
478the name of a symbol simply quotes the single character that follows the 478the name of a symbol simply quotes the single character that follows the
479backslash. For example, in a string, @samp{\t} represents a tab 479backslash. For example, in a string, @samp{\t} represents a tab
480character; in the name of a symbol, however, @samp{\t} merely quotes the 480character; in the name of a symbol, however, @samp{\t} merely quotes the
481letter @kbd{t}. To have a symbol with a tab character in its name, you 481letter @samp{t}. To have a symbol with a tab character in its name, you
482must actually use a tab (preceded with a backslash). But it's rare to 482must actually use a tab (preceded with a backslash). But it's rare to
483do such a thing. 483do such a thing.
484 484
@@ -525,26 +525,28 @@ elements. There are two kinds of sequence in Emacs Lisp, lists and
525arrays. Thus, an object of type list or of type array is also 525arrays. Thus, an object of type list or of type array is also
526considered a sequence. 526considered a sequence.
527 527
528 Arrays are further subdivided into strings and vectors. Vectors can 528 Arrays are further subdivided into strings, vectors, char-tables and
529hold elements of any type, but string elements must be characters in the 529bool-vectors. Vectors can hold elements of any type, but string
530range from 0 to 255. However, the characters in a string can have text 530elements must be characters, and bool-vector elements must be @code{t}
531properties like characters in a buffer (@pxref{Text Properties}); 531or @code{nil}. The characters in a string can have text properties like
532vectors do not support text properties even when their elements happen 532characters in a buffer (@pxref{Text Properties}); vectors and
533to be characters. 533bool-vectors do not support text properties even when their elements
534 534happen to be characters. Char-tables are like vectors except that they
535 Lists, strings and vectors are different, but they have important 535are indexed by any valid character code.
536similarities. For example, all have a length @var{l}, and all have 536
537elements which can be indexed from zero to @var{l} minus one. Also, 537 Lists, strings and the other array types are different, but they have
538several functions, called sequence functions, accept any kind of 538important similarities. For example, all have a length @var{l}, and all
539have elements which can be indexed from zero to @var{l} minus one.
540Several functions, called sequence functions, accept any kind of
539sequence. For example, the function @code{elt} can be used to extract 541sequence. For example, the function @code{elt} can be used to extract
540an element of a sequence, given its index. @xref{Sequences Arrays 542an element of a sequence, given its index. @xref{Sequences Arrays
541Vectors}. 543Vectors}.
542 544
543 It is impossible to read the same sequence twice, since sequences are 545 It is generally impossible to read the same sequence twice, since
544always created anew upon reading. If you read the read syntax for a 546sequences are always created anew upon reading. If you read the read
545sequence twice, you get two sequences with equal contents. There is one 547syntax for a sequence twice, you get two sequences with equal contents.
546exception: the empty list @code{()} always stands for the same object, 548There is one exception: the empty list @code{()} always stands for the
547@code{nil}. 549same object, @code{nil}.
548 550
549@node Cons Cell Type 551@node Cons Cell Type
550@subsection Cons Cell and List Types 552@subsection Cons Cell and List Types
@@ -596,8 +598,9 @@ violet buttercup)}:
596 598
597@example 599@example
598@group 600@group
599 ___ ___ ___ ___ ___ ___ 601 --- --- --- --- --- ---
600 |___|___|--> |___|___|--> |___|___|--> nil 602 | | |--> | | |--> | | |--> nil
603 --- --- --- --- --- ---
601 | | | 604 | | |
602 | | | 605 | | |
603 --> rose --> violet --> buttercup 606 --> rose --> violet --> buttercup
@@ -653,8 +656,9 @@ depicted with boxes and arrows:
653 656
654@example 657@example
655@group 658@group
656 ___ ___ ___ ___ 659 --- --- --- ---
657 |___|___|--> |___|___|--> nil 660 | | |--> | | |--> nil
661 --- --- --- ---
658 | | 662 | |
659 | | 663 | |
660 --> A --> nil 664 --> A --> nil
@@ -688,8 +692,9 @@ shows the pair @code{(rose . violet)}:
688 692
689@example 693@example
690@group 694@group
691 ___ ___ 695 --- ---
692 |___|___|--> violet 696 | | |--> violet
697 --- ---
693 | 698 |
694 | 699 |
695 --> rose 700 --> rose
@@ -703,8 +708,9 @@ chain of cons cells with a non-@code{nil} final @sc{cdr}. For example,
703 708
704@example 709@example
705@group 710@group
706 ___ ___ ___ ___ 711 --- --- --- ---
707 |___|___|--> |___|___|--> buttercup 712 | | |--> | | |--> buttercup
713 --- --- --- ---
708 | | 714 | |
709 | | 715 | |
710 --> rose --> violet 716 --> rose --> violet
@@ -720,8 +726,9 @@ and looks like this:
720 726
721@example 727@example
722@group 728@group
723 ___ ___ ___ ___ 729 --- --- --- ---
724 |___|___|--> |___|___|--> nil 730 | | |--> | | |--> nil
731 --- --- --- ---
725 | | 732 | |
726 | | 733 | |
727 --> rose --> violet 734 --> rose --> violet
@@ -735,8 +742,9 @@ It looks like this:
735 742
736@example 743@example
737@group 744@group
738 ___ ___ ___ ___ ___ ___ 745 --- --- --- --- --- ---
739 |___|___|--> |___|___|--> |___|___|--> nil 746 | | |--> | | |--> | | |--> nil
747 --- --- --- --- --- ---
740 | | | 748 | | |
741 | | | 749 | | |
742 --> rose --> violet --> buttercup 750 --> rose --> violet --> buttercup
@@ -775,27 +783,35 @@ functions that work on alists.
775 783
776 An @dfn{array} is composed of an arbitrary number of slots for 784 An @dfn{array} is composed of an arbitrary number of slots for
777referring to other Lisp objects, arranged in a contiguous block of 785referring to other Lisp objects, arranged in a contiguous block of
778memory. Accessing any element of an array takes the same amount of 786memory. Accessing any element of an array takes approximately the same
779time. In contrast, accessing an element of a list requires time 787amount of time. In contrast, accessing an element of a list requires
780proportional to the position of the element in the list. (Elements at 788time proportional to the position of the element in the list. (Elements
781the end of a list take longer to access than elements at the beginning 789at the end of a list take longer to access than elements at the
782of a list.) 790beginning of a list.)
783 791
784 Emacs defines two types of array, strings and vectors. A string is an 792 Emacs defines four types of array: strings, vectors, bool-vectors, and
785array of characters and a vector is an array of arbitrary objects. Both 793char-tables.
786are one-dimensional. (Most other programming languages support 794
787multidimensional arrays, but they are not essential; you can get the 795 A string is an array of characters and a vector is an array of
788same effect with an array of arrays.) Each type of array has its own 796arbitrary objects. A bool-vector can hold only @code{t} or @code{nil}.
789read syntax; see @ref{String Type}, and @ref{Vector Type}. 797These kinds of array may have any length up to the largest integer.
790 798Char-tables are sparse arrays indexed by any valid character code; they
791 An array may have any length up to the largest integer; but once 799can hold arbitrary objects.
792created, it has a fixed size. The first element of an array has index 800
793zero, the second element has index 1, and so on. This is called 801 The first element of an array has index zero, the second element has
794@dfn{zero-origin} indexing. For example, an array of four elements has 802index 1, and so on. This is called @dfn{zero-origin} indexing. For
795indices 0, 1, 2, @w{and 3}. 803example, an array of four elements has indices 0, 1, 2, @w{and 3}. The
796 804largest possible index value is one less than the length of the array.
797 The array type is contained in the sequence type and contains both the 805Once an array is created, its length is fixed.
798string type and the vector type. 806
807 All Emacs Lisp arrays are one-dimensional. (Most other programming
808languages support multidimensional arrays, but they are not essential;
809you can get the same effect with an array of arrays.) Each type of
810array has its own read syntax; see the following sections for details.
811
812 The array type is contained in the sequence type and
813contains the string type, the vector type, the bool-vector type, and the
814char-table type.
799 815
800@node String Type 816@node String Type
801@subsection String Type 817@subsection String Type
@@ -854,10 +870,13 @@ but the newline is ignored if escaped."
854constant by writing it literally. There are two text representations 870constant by writing it literally. There are two text representations
855for non-@sc{ASCII} characters in Emacs strings (and in buffers): unibyte 871for non-@sc{ASCII} characters in Emacs strings (and in buffers): unibyte
856and multibyte. If the string constant is read from a multibyte source, 872and multibyte. If the string constant is read from a multibyte source,
857then the character is read as a multibyte character, and that makes the 873such as a multibyte buffer or string, or a file that would be visited as
858string multibyte. If the string constant is read from a unibyte source, 874multibyte, then the character is read as a multibyte character, and that
859then the character is read as unibyte and that makes the string unibyte. 875makes the string multibyte. If the string constant is read from a
876unibyte source, then the character is read as unibyte and that makes the
877string unibyte.
860 878
879@c ??? Change this?
861 You can also represent a multibyte non-@sc{ASCII} character with its 880 You can also represent a multibyte non-@sc{ASCII} character with its
862character code, using a hex escape, @samp{\x@var{nnnnnnn}}, with as many 881character code, using a hex escape, @samp{\x@var{nnnnnnn}}, with as many
863digits as necessary. (Multibyte non-@sc{ASCII} character codes are all 882digits as necessary. (Multibyte non-@sc{ASCII} character codes are all
@@ -895,9 +914,9 @@ characters.
895 914
896 If you use the @samp{\M-} syntax to indicate a meta character in a 915 If you use the @samp{\M-} syntax to indicate a meta character in a
897string constant, this sets the 916string constant, this sets the
898@iftex 917@tex
899$2^{7}$ 918$2^{7}$
900@end iftex 919@end tex
901@ifinfo 920@ifinfo
9022**7 9212**7
903@end ifinfo 922@end ifinfo
@@ -975,9 +994,24 @@ special purposes. A char-table can also specify a single value for
975a whole character set. 994a whole character set.
976 995
977 The printed representation of a char-table is like a vector 996 The printed representation of a char-table is like a vector
978except that there is an extra @samp{#} at the beginning. 997except that there is an extra @samp{#^} at the beginning.
979 998
980 @xref{Char-Tables}, for special functions to operate on char-tables. 999 @xref{Char-Tables}, for special functions to operate on char-tables.
1000Uses of char-tables include:
1001
1002@itemize @bullet
1003@item
1004Case tables (@pxref{Case Tables}).
1005
1006@item
1007Character category tables (@pxref{Categories}).
1008
1009@item
1010Display Tables (@pxref{Display Tables}).
1011
1012@item
1013Syntax tables (@pxref{Syntax Tables}).
1014@end itemize
981 1015
982@node Bool-Vector Type 1016@node Bool-Vector Type
983@subsection Bool-Vector Type 1017@subsection Bool-Vector Type
@@ -999,6 +1033,9 @@ make no difference.
999 @result{} #&3"\377" 1033 @result{} #&3"\377"
1000(make-bool-vector 3 nil) 1034(make-bool-vector 3 nil)
1001 @result{} #&3"\0"" 1035 @result{} #&3"\0""
1036;; @r{These are equal since only the first 3 bits are used.}
1037(equal #&3"\377" #&3"\340")
1038 @result{} t
1002@end example 1039@end example
1003 1040
1004@node Function Type 1041@node Function Type
@@ -1027,7 +1064,7 @@ functions @code{funcall} and @code{apply}. @xref{Calling Functions}.
1027 1064
1028 A @dfn{Lisp macro} is a user-defined construct that extends the Lisp 1065 A @dfn{Lisp macro} is a user-defined construct that extends the Lisp
1029language. It is represented as an object much like a function, but with 1066language. It is represented as an object much like a function, but with
1030different parameter-passing semantics. A Lisp macro has the form of a 1067different argument-passing semantics. A Lisp macro has the form of a
1031list whose first element is the symbol @code{macro} and whose @sc{cdr} 1068list whose first element is the symbol @code{macro} and whose @sc{cdr}
1032is a Lisp function object, including the @code{lambda} symbol. 1069is a Lisp function object, including the @code{lambda} symbol.
1033 1070
@@ -1053,12 +1090,12 @@ not evaluate all its arguments is called a @dfn{special form}
1053(@pxref{Special Forms}).@refill 1090(@pxref{Special Forms}).@refill
1054 1091
1055 It does not matter to the caller of a function whether the function is 1092 It does not matter to the caller of a function whether the function is
1056primitive. However, this does matter if you try to substitute a 1093primitive. However, this does matter if you try to redefine a primitive
1057function written in Lisp for a primitive of the same name. The reason 1094with a function written in Lisp. The reason is that the primitive
1058is that the primitive function may be called directly from C code. 1095function may be called directly from C code. Calls to the redefined
1059Calls to the redefined function from Lisp will use the new definition, 1096function from Lisp will use the new definition, but calls from C code
1060but calls from C code may still use the built-in definition. Therefore, 1097may still use the built-in definition. Therefore, @strong{we discourage
1061@strong{we discourage redefinition of primitive functions}. 1098redefinition of primitive functions}.
1062 1099
1063 The term @dfn{function} refers to all Emacs functions, whether written 1100 The term @dfn{function} refers to all Emacs functions, whether written
1064in Lisp or C. @xref{Function Type}, for information about the 1101in Lisp or C. @xref{Function Type}, for information about the
@@ -1114,9 +1151,10 @@ symbol. @xref{Autoload}, for more details.
1114@section Editing Types 1151@section Editing Types
1115@cindex editing types 1152@cindex editing types
1116 1153
1117 The types in the previous section are common to many Lisp dialects. 1154 The types in the previous section used for general programming
1118Emacs Lisp provides several additional data types for purposes connected 1155purposes, and most of them are common to most Lisp dialects. Emacs Lisp
1119with editing. 1156provides several additional data types for purposes connected with
1157editing.
1120 1158
1121@menu 1159@menu
1122* Buffer Type:: The basic object of editing. 1160* Buffer Type:: The basic object of editing.
@@ -1124,11 +1162,10 @@ with editing.
1124* Window Type:: Buffers are displayed in windows. 1162* Window Type:: Buffers are displayed in windows.
1125* Frame Type:: Windows subdivide frames. 1163* Frame Type:: Windows subdivide frames.
1126* Window Configuration Type:: Recording the way a frame is subdivided. 1164* Window Configuration Type:: Recording the way a frame is subdivided.
1165* Frame Configuration Type:: Recording the status of all frames.
1127* Process Type:: A process running on the underlying OS. 1166* Process Type:: A process running on the underlying OS.
1128* Stream Type:: Receive or send characters. 1167* Stream Type:: Receive or send characters.
1129* Keymap Type:: What function a keystroke invokes. 1168* Keymap Type:: What function a keystroke invokes.
1130* Syntax Table Type:: What a character means.
1131* Display Table Type:: How display tables are represented.
1132* Overlay Type:: How an overlay is represented. 1169* Overlay Type:: How an overlay is represented.
1133@end menu 1170@end menu
1134 1171
@@ -1144,8 +1181,8 @@ buffer need not be displayed in any window.
1144 1181
1145 The contents of a buffer are much like a string, but buffers are not 1182 The contents of a buffer are much like a string, but buffers are not
1146used like strings in Emacs Lisp, and the available operations are 1183used like strings in Emacs Lisp, and the available operations are
1147different. For example, insertion of text into a buffer is very 1184different. For example, you can insert text efficiently into an
1148efficient, whereas ``inserting'' text into a string requires 1185existing buffer, whereas ``inserting'' text into a string requires
1149concatenating substrings, and the result is an entirely new string 1186concatenating substrings, and the result is an entirely new string
1150object. 1187object.
1151 1188
@@ -1167,10 +1204,10 @@ a local syntax table (@pxref{Syntax Tables});
1167a local keymap (@pxref{Keymaps}); and, 1204a local keymap (@pxref{Keymaps}); and,
1168 1205
1169@item 1206@item
1170a local variable binding list (@pxref{Buffer-Local Variables}). 1207a list of buffer-local variable bindings (@pxref{Buffer-Local Variables}).
1171 1208
1172@item 1209@item
1173a list of overlays (@pxref{Overlays}). 1210overlays (@pxref{Overlays}).
1174 1211
1175@item 1212@item
1176text properties for the text in the buffer (@pxref{Text Properties}). 1213text properties for the text in the buffer (@pxref{Text Properties}).
@@ -1183,7 +1220,7 @@ behavior of programs in different buffers, without actually changing the
1183programs. 1220programs.
1184 1221
1185 A buffer may be @dfn{indirect}, which means it shares the text 1222 A buffer may be @dfn{indirect}, which means it shares the text
1186of another buffer. @xref{Indirect Buffers}. 1223of another buffer, but presents it differently. @xref{Indirect Buffers}.
1187 1224
1188 Buffers have no read syntax. They print in hash notation, showing the 1225 Buffers have no read syntax. They print in hash notation, showing the
1189buffer name. 1226buffer name.
@@ -1263,7 +1300,7 @@ uniquely).
1263@example 1300@example
1264@group 1301@group
1265(selected-frame) 1302(selected-frame)
1266 @result{} #<frame xemacs@@mole.gnu.ai.mit.edu 0xdac80> 1303 @result{} #<frame emacs@@mole.gnu.ai.mit.edu 0xdac80>
1267@end group 1304@end group
1268@end example 1305@end example
1269 1306
@@ -1282,6 +1319,19 @@ looks like @samp{#<window-configuration>}. @xref{Window
1282Configurations}, for a description of several functions related to 1319Configurations}, for a description of several functions related to
1283window configurations. 1320window configurations.
1284 1321
1322@node Frame Configuration Type
1323@subsection Frame Configuration Type
1324@cindex screen layout
1325
1326 A @dfn{frame configuration} stores information about the positions,
1327sizes, and contents of the windows in all frames. It is actually
1328a list whose @sc{car} is @code{frame-configuration} and whose
1329@sc{cdr} is an alist. Each alist element describes one frame,
1330which appears as the @sc{car} of that element.
1331
1332 @xref{Frame Configurations}, for a description of several functions
1333related to frame configurations.
1334
1285@node Process Type 1335@node Process Type
1286@subsection Process Type 1336@subsection Process Type
1287 1337
@@ -1343,36 +1393,6 @@ a list whose @sc{car} is the symbol @code{keymap}.
1343 @xref{Keymaps}, for information about creating keymaps, handling prefix 1393 @xref{Keymaps}, for information about creating keymaps, handling prefix
1344keys, local as well as global keymaps, and changing key bindings. 1394keys, local as well as global keymaps, and changing key bindings.
1345 1395
1346@node Syntax Table Type
1347@subsection Syntax Table Type
1348
1349 A @dfn{syntax table} is a char-table which specifies the syntax of
1350each character, for word and list parsing. Each element of the syntax
1351table defines how one character is interpreted when it appears in a
1352buffer. For example, in C mode (@pxref{Major Modes}), the @samp{+}
1353character is punctuation, but in Lisp mode it is a valid character in a
1354symbol. These modes specify different interpretations by changing the
1355syntax table entry for @samp{+}, at index 43 in the syntax table.
1356
1357 Syntax tables are used only to control primitives that scan text in
1358buffers, not for reading Lisp expressions. The syntax that the Lisp
1359interpreter uses to read expressions is built into the Emacs source code
1360and cannot be changed; thus, to change the list delimiters to be
1361@samp{@{} and @samp{@}} instead of @samp{(} and @samp{)} would be
1362impossible. (Some Lisp systems provide ways to redefine the read
1363syntax, but we decided to leave this feature out of Emacs Lisp for
1364simplicity.)
1365
1366 @xref{Syntax Tables}, for details about syntax classes and how to make
1367and modify syntax tables.
1368
1369@node Display Table Type
1370@subsection Display Table Type
1371
1372 A @dfn{display table} specifies how to display each character code.
1373Each buffer and each window can have its own display table. A display
1374table is actually a char-table. @xref{Display Tables}.
1375
1376@node Overlay Type 1396@node Overlay Type
1377@subsection Overlay Type 1397@subsection Overlay Type
1378 1398
@@ -1437,7 +1457,7 @@ a list and @code{symbolp} to check for a symbol.
1437 (setq list (append x list))) 1457 (setq list (append x list)))
1438@need 3000 1458@need 3000
1439 (t 1459 (t
1440 ;; We only handle symbols and lists. 1460 ;; We handle only symbols and lists.
1441 (error "Invalid argument %s in add-on" x)))) 1461 (error "Invalid argument %s in add-on" x))))
1442@end example 1462@end example
1443 1463
@@ -1451,6 +1471,9 @@ with references to further information.
1451@item arrayp 1471@item arrayp
1452@xref{Array Functions, arrayp}. 1472@xref{Array Functions, arrayp}.
1453 1473
1474@item bool-vector-p
1475@xref{Bool-Vectors, bool-vector-p}.
1476
1454@item bufferp 1477@item bufferp
1455@xref{Buffer Basics, bufferp}. 1478@xref{Buffer Basics, bufferp}.
1456 1479
@@ -1458,20 +1481,29 @@ with references to further information.
1458@xref{Byte-Code Type, byte-code-function-p}. 1481@xref{Byte-Code Type, byte-code-function-p}.
1459 1482
1460@item case-table-p 1483@item case-table-p
1461@xref{Case Table, case-table-p}. 1484@xref{Case Tables, case-table-p}.
1462 1485
1463@item char-or-string-p 1486@item char-or-string-p
1464@xref{Predicates for Strings, char-or-string-p}. 1487@xref{Predicates for Strings, char-or-string-p}.
1465 1488
1489@item char-table-p
1490@xref{Char-Tables, char-table-p}.
1491
1466@item commandp 1492@item commandp
1467@xref{Interactive Call, commandp}. 1493@xref{Interactive Call, commandp}.
1468 1494
1469@item consp 1495@item consp
1470@xref{List-related Predicates, consp}. 1496@xref{List-related Predicates, consp}.
1471 1497
1498@item display-table-p
1499@xref{Display Tables, display-table-p}.
1500
1472@item floatp 1501@item floatp
1473@xref{Predicates on Numbers, floatp}. 1502@xref{Predicates on Numbers, floatp}.
1474 1503
1504@item frame-configuration-p
1505@xref{Frame Configurations, frame-configuration-p}.
1506
1475@item frame-live-p 1507@item frame-live-p
1476@xref{Deleting Frames, frame-live-p}. 1508@xref{Deleting Frames, frame-live-p}.
1477 1509
@@ -1556,8 +1588,9 @@ types. In most cases, it is more convenient to use type predicates than
1556This function returns a symbol naming the primitive type of 1588This function returns a symbol naming the primitive type of
1557@var{object}. The value is one of the symbols @code{symbol}, 1589@var{object}. The value is one of the symbols @code{symbol},
1558@code{integer}, @code{float}, @code{string}, @code{cons}, @code{vector}, 1590@code{integer}, @code{float}, @code{string}, @code{cons}, @code{vector},
1559@code{marker}, @code{overlay}, @code{window}, @code{buffer}, 1591@code{char-table}, @code{bool-vector}, @code{subr},
1560@code{subr}, @code{compiled-function}, @code{process}, or 1592@code{compiled-function}, @code{marker}, @code{overlay}, @code{window},
1593@code{buffer}, @code{frame}, @code{process}, or
1561@code{window-configuration}. 1594@code{window-configuration}.
1562 1595
1563@example 1596@example
@@ -1594,11 +1627,6 @@ arguments with the same contents or elements are not necessarily
1594@code{eq} to each other: they are @code{eq} only if they are the same 1627@code{eq} to each other: they are @code{eq} only if they are the same
1595object. 1628object.
1596 1629
1597(The @code{make-symbol} function returns an uninterned symbol that is
1598not interned in the standard @code{obarray}. When uninterned symbols
1599are in use, symbol names are no longer unique. Distinct symbols with
1600the same name are not @code{eq}. @xref{Creating Symbols}.)
1601
1602@example 1630@example
1603@group 1631@group
1604(eq 'foo 'foo) 1632(eq 'foo 'foo)
@@ -1640,6 +1668,17 @@ the same name are not @code{eq}. @xref{Creating Symbols}.)
1640@end group 1668@end group
1641@end example 1669@end example
1642 1670
1671(The @code{make-symbol} function returns an uninterned symbol that is
1672not interned in the standard @code{obarray}. When uninterned symbols
1673are in use, symbol names are no longer unique. Distinct symbols with
1674the same name are not @code{eq}. @xref{Creating Symbols}.)
1675
1676@example
1677@group
1678(eq (make-symbol "foo") 'foo)
1679 @result{} nil
1680@end group
1681@end example
1643@end defun 1682@end defun
1644 1683
1645@defun equal object1 object2 1684@defun equal object1 object2