aboutsummaryrefslogtreecommitdiffstats
path: root/lispref
diff options
context:
space:
mode:
authorKaroly Lorentey2005-02-19 00:06:48 +0000
committerKaroly Lorentey2005-02-19 00:06:48 +0000
commit60c73d2ed638e5d51643c65a0fc6dea618fc72c8 (patch)
tree3d9e0adc703f9cfd5df162c66ac15999c4106738 /lispref
parentc20213c90736fc9c2a6eca2ca44d6e200dbf5efe (diff)
parent8a59305430c68ee23d3cc7ab7487ab3acebdbe7f (diff)
downloademacs-60c73d2ed638e5d51643c65a0fc6dea618fc72c8.tar.gz
emacs-60c73d2ed638e5d51643c65a0fc6dea618fc72c8.zip
Merged from miles@gnu.org--gnu-2005 (patch 14-16, 95-106)
Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-95 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-96 Move Gnus images into etc/images * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-97 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-98 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-99 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-100 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-101 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-102 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-103 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-104 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-105 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-106 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-14 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-15 Update from CVS: lisp/imap.el (imap-log): Doc fix. * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-16 Merge from emacs--cvs-trunk--0 git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-295
Diffstat (limited to 'lispref')
-rw-r--r--lispref/ChangeLog69
-rw-r--r--lispref/compile.texi30
-rw-r--r--lispref/control.texi23
-rw-r--r--lispref/elisp.texi3
-rw-r--r--lispref/functions.texi86
-rw-r--r--lispref/hash.texi24
-rw-r--r--lispref/lists.texi109
-rw-r--r--lispref/loading.texi34
-rw-r--r--lispref/minibuf.texi5
-rw-r--r--lispref/numbers.texi62
-rw-r--r--lispref/objects.texi191
-rw-r--r--lispref/streams.texi2
-rw-r--r--lispref/symbols.texi4
-rw-r--r--lispref/variables.texi7
14 files changed, 347 insertions, 302 deletions
diff --git a/lispref/ChangeLog b/lispref/ChangeLog
index ec5129e0b91..7da20942eaf 100644
--- a/lispref/ChangeLog
+++ b/lispref/ChangeLog
@@ -1,3 +1,72 @@
12005-02-14 Lute Kamstra <lute@gnu.org>
2
3 * elisp.texi (Top): Remove reference to deleted node.
4
5 * lists.texi (Lists): Remove reference to deleted node.
6 (Cons Cells): Fix typo.
7
8 * loading.texi (Where Defined): Fix typo.
9
102005-02-14 Richard M. Stallman <rms@gnu.org>
11
12 * variables.texi (Creating Buffer-Local): change-major-mode-hook
13 is useful for discarding some minor modes.
14
15 * symbols.texi (Symbol Components): Reorder examples.
16
17 * streams.texi (Input Functions): State standard-input default.
18 (Output Variables): State standard-output default.
19
20 * objects.texi (Printed Representation): Clarify read syntax vs print.
21 (Floating Point Type): Explain meaning better.
22 (Symbol Type): Explain uniqueness better.
23 (Cons Cell Type): Explain empty list sooner. CAR and CDR later.
24 List examples sooner.
25 (Box Diagrams): New subnode broken out.
26 Some examples moved from old Lists as Boxes node.
27 (Dotted Pair Notation): Clarify intro.
28 (Array Type): Clarify.
29 (Type Predicates): Add hash-table-p.
30
31 * numbers.texi (Integer Basics): Clarify radix explanation.
32 (Predicates on Numbers): Minor clarification.
33 (Comparison of Numbers): Minor clarification. Clarify eql.
34 Typos in min, max.
35 (Math Functions): Clarify overflow in expt.
36
37 * minibuf.texi (Text from Minibuffer): Minor clarification.
38 Mention arrow keys.
39
40 * loading.texi (Autoload): defun's doc string overrides autoload's
41 doc string.
42 (Repeated Loading): Modernize "add to list" examples.
43 (Where Defined): Finish updating table of load-history elts.
44
45 * lists.texi (List-related Predicates): Minor wording improvement.
46 (Lists as Boxes): Node deleted.
47 (Building Lists): Explain trivial cases of number-sequence.
48
49 * hash.texi (Hash Tables): Add desc to menu items.
50 (Creating Hash): Expain "full" means "make larger",
51 (Hash Access): Any object can be a key.
52 State value of maphash.
53
54 * functions.texi (What Is a Function): Wording cleanup.
55 (Function Documentation): Minor cleanup.
56 Explain purpose of calling convention at end of doc string.
57 (Function Names): Wording cleanup.
58 (Calling Functions): Wording cleanup.
59 Explain better how funcall calls the function.
60 (Function Cells): Delete example of saving and redefining function.
61
62 * control.texi (Combining Conditions): Wording cleanup.
63 (Iteration): dolist and dotimes bind VAR locally.
64 (Cleanups): Xref to Atomic Changes.
65
66 * compile.texi (Byte Compilation): Delete 19.29 info.
67 (Compilation Functions): Macros' difficulties don't affect defsubst.
68 (Docs and Compilation): Delete 19.29 info.
69
12005-02-10 Richard M. Stallman <rms@gnu.org> 702005-02-10 Richard M. Stallman <rms@gnu.org>
2 71
3 * objects.texi (Symbol Type): Minor correction. 72 * objects.texi (Symbol Type): Minor correction.
diff --git a/lispref/compile.texi b/lispref/compile.texi
index 6c28708bdf1..91c0661a99e 100644
--- a/lispref/compile.texi
+++ b/lispref/compile.texi
@@ -27,17 +27,7 @@ results compatible with running the same file without compilation.
27@xref{Loading Non-ASCII}. 27@xref{Loading Non-ASCII}.
28 28
29 In general, any version of Emacs can run byte-compiled code produced 29 In general, any version of Emacs can run byte-compiled code produced
30by recent earlier versions of Emacs, but the reverse is not true. A 30by recent earlier versions of Emacs, but the reverse is not true.
31major incompatible change was introduced in Emacs version 19.29, and
32files compiled with versions since that one will definitely not run
33in earlier versions unless you specify a special option.
34@iftex
35@xref{Docs and Compilation}.
36@end iftex
37In addition, the modifier bits in keyboard characters were renumbered in
38Emacs 19.29; as a result, files compiled in versions before 19.29 will
39not work in subsequent versions if they contain character constants with
40modifier bits.
41 31
42@vindex no-byte-compile 32@vindex no-byte-compile
43 If you do not want a Lisp file to be compiled, ever, put a file-local 33 If you do not want a Lisp file to be compiled, ever, put a file-local
@@ -122,6 +112,9 @@ macros must already be defined for proper compilation. For more
122details, see @ref{Compiling Macros}. If a program does not work the 112details, see @ref{Compiling Macros}. If a program does not work the
123same way when compiled as it does when interpreted, erroneous macro 113same way when compiled as it does when interpreted, erroneous macro
124definitions are one likely cause (@pxref{Problems with Macros}). 114definitions are one likely cause (@pxref{Problems with Macros}).
115Inline (@code{defsubst}) functions are less troublesome; if you
116compile a call to such a function before its definition is known, the
117call will still work right, it will just run slower.
125 118
126 Normally, compiling a file does not evaluate the file's contents or 119 Normally, compiling a file does not evaluate the file's contents or
127load the file. But it does execute any @code{require} calls at top 120load the file. But it does execute any @code{require} calls at top
@@ -313,14 +306,13 @@ directory where you built it, you will experience this problem
313occasionally if you edit and recompile Lisp files. When it happens, you 306occasionally if you edit and recompile Lisp files. When it happens, you
314can cure the problem by reloading the file after recompiling it. 307can cure the problem by reloading the file after recompiling it.
315 308
316 Byte-compiled files made with recent versions of Emacs (since 19.29) 309 You can turn off this feature at compile time by setting
317will not load into older versions because the older versions don't 310@code{byte-compile-dynamic-docstrings} to @code{nil}; this is useful
318support this feature. You can turn off this feature at compile time by 311mainly if you expect to change the file, and you want Emacs processes
319setting @code{byte-compile-dynamic-docstrings} to @code{nil}; then you 312that have already loaded it to keep working when the file changes.
320can compile files that will load into older Emacs versions. You can do 313You can do this globally, or for one source file by specifying a
321this globally, or for one source file by specifying a file-local binding 314file-local binding for the variable. One way to do that is by adding
322for the variable. One way to do that is by adding this string to the 315this string to the file's first line:
323file's first line:
324 316
325@example 317@example
326-*-byte-compile-dynamic-docstrings: nil;-*- 318-*-byte-compile-dynamic-docstrings: nil;-*-
diff --git a/lispref/control.texi b/lispref/control.texi
index e2a1e26b170..760e7bb82de 100644
--- a/lispref/control.texi
+++ b/lispref/control.texi
@@ -346,8 +346,8 @@ Here is a more realistic example of using @code{and}:
346Note that @code{(car foo)} is not executed if @code{(consp foo)} returns 346Note that @code{(car foo)} is not executed if @code{(consp foo)} returns
347@code{nil}, thus avoiding an error. 347@code{nil}, thus avoiding an error.
348 348
349@code{and} can be expressed in terms of either @code{if} or @code{cond}. 349@code{and} expressions can also be written using either @code{if} or
350For example: 350@code{cond}. Here's how:
351 351
352@example 352@example
353@group 353@group
@@ -476,11 +476,11 @@ write two common kinds of loops.
476 476
477@defmac dolist (var list [result]) body@dots{} 477@defmac dolist (var list [result]) body@dots{}
478@tindex dolist 478@tindex dolist
479This construct executes @var{body} once for each element of @var{list}, 479This construct executes @var{body} once for each element of
480using the variable @var{var} to hold the current element. Then it 480@var{list}, binding the variable @var{var} locally to hold the current
481returns the value of evaluating @var{result}, or @code{nil} if 481element. Then it returns the value of evaluating @var{result}, or
482@var{result} is omitted. For example, here is how you could use 482@code{nil} if @var{result} is omitted. For example, here is how you
483@code{dolist} to define the @code{reverse} function: 483could use @code{dolist} to define the @code{reverse} function:
484 484
485@example 485@example
486(defun reverse (list) 486(defun reverse (list)
@@ -493,8 +493,8 @@ returns the value of evaluating @var{result}, or @code{nil} if
493@defmac dotimes (var count [result]) body@dots{} 493@defmac dotimes (var count [result]) body@dots{}
494@tindex dotimes 494@tindex dotimes
495This construct executes @var{body} once for each integer from 0 495This construct executes @var{body} once for each integer from 0
496(inclusive) to @var{count} (exclusive), using the variable @var{var} to 496(inclusive) to @var{count} (exclusive), binding the variable @var{var}
497hold the integer for the current iteration. Then it returns the value 497to the integer for the current iteration. Then it returns the value
498of evaluating @var{result}, or @code{nil} if @var{result} is omitted. 498of evaluating @var{result}, or @code{nil} if @var{result} is omitted.
499Here is an example of using @code{dotimes} to do something 100 times: 499Here is an example of using @code{dotimes} to do something 100 times:
500 500
@@ -1167,7 +1167,10 @@ and their conditions.
1167 1167
1168 The @code{unwind-protect} construct is essential whenever you 1168 The @code{unwind-protect} construct is essential whenever you
1169temporarily put a data structure in an inconsistent state; it permits 1169temporarily put a data structure in an inconsistent state; it permits
1170you to make the data consistent again in the event of an error or throw. 1170you to make the data consistent again in the event of an error or
1171throw. (Another more specific cleanup construct that is used only for
1172changes in buffer contents is the atomic change group; @ref{Atomic
1173Changes}.)
1171 1174
1172@defspec unwind-protect body-form cleanup-forms@dots{} 1175@defspec unwind-protect body-form cleanup-forms@dots{}
1173@cindex cleanup forms 1176@cindex cleanup forms
diff --git a/lispref/elisp.texi b/lispref/elisp.texi
index fa84a0a93fb..64e956afdf3 100644
--- a/lispref/elisp.texi
+++ b/lispref/elisp.texi
@@ -34,7 +34,7 @@ Published by the Free Software Foundation
3459 Temple Place, Suite 330 3459 Temple Place, Suite 330
35Boston, MA 02111-1307 USA 35Boston, MA 02111-1307 USA
36 36
37Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999,@* 37Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2005,@*
38 2000, 2002 Free Software Foundation, Inc. 38 2000, 2002 Free Software Foundation, Inc.
39 39
40Permission is granted to copy, distribute and/or modify this document 40Permission is granted to copy, distribute and/or modify this document
@@ -281,7 +281,6 @@ Strings and Characters
281Lists 281Lists
282 282
283* Cons Cells:: How lists are made out of cons cells. 283* Cons Cells:: How lists are made out of cons cells.
284* Lists as Boxes:: Graphical notation to explain lists.
285* List-related Predicates:: Is this object a list? Comparing two lists. 284* List-related Predicates:: Is this object a list? Comparing two lists.
286* List Elements:: Extracting the pieces of a list. 285* List Elements:: Extracting the pieces of a list.
287* Building Lists:: Creating list structure. 286* Building Lists:: Creating list structure.
diff --git a/lispref/functions.texi b/lispref/functions.texi
index 5c7433507b0..26c2449fee6 100644
--- a/lispref/functions.texi
+++ b/lispref/functions.texi
@@ -53,7 +53,7 @@ macros are not functions.
53@cindex built-in function 53@cindex built-in function
54A @dfn{primitive} is a function callable from Lisp that is written in C, 54A @dfn{primitive} is a function callable from Lisp that is written in C,
55such as @code{car} or @code{append}. These functions are also called 55such as @code{car} or @code{append}. These functions are also called
56@dfn{built-in} functions or @dfn{subrs}. (Special forms are also 56@dfn{built-in functions}, or @dfn{subrs}. (Special forms are also
57considered primitives.) 57considered primitives.)
58 58
59Usually the reason we implement a function as a primitive is either 59Usually the reason we implement a function as a primitive is either
@@ -412,13 +412,14 @@ are easier to access.
412because @code{apropos} displays just this first line. It should consist 412because @code{apropos} displays just this first line. It should consist
413of one or two complete sentences that summarize the function's purpose. 413of one or two complete sentences that summarize the function's purpose.
414 414
415 The start of the documentation string is usually indented in the source file, 415 The start of the documentation string is usually indented in the
416but since these spaces come before the starting double-quote, they are not part of 416source file, but since these spaces come before the starting
417the string. Some people make a practice of indenting any additional 417double-quote, they are not part of the string. Some people make a
418lines of the string so that the text lines up in the program source. 418practice of indenting any additional lines of the string so that the
419@emph{That is a mistake.} The indentation of the following lines is 419text lines up in the program source. @emph{That is a mistake.} The
420inside the string; what looks nice in the source code will look ugly 420indentation of the following lines is inside the string; what looks
421when displayed by the help commands. 421nice in the source code will look ugly when displayed by the help
422commands.
422 423
423 You may wonder how the documentation string could be optional, since 424 You may wonder how the documentation string could be optional, since
424there are required components of the function that follow it (the body). 425there are required components of the function that follow it (the body).
@@ -438,9 +439,14 @@ text like this:
438 439
439@noindent 440@noindent
440following a blank line, at the beginning of the line, with no newline 441following a blank line, at the beginning of the line, with no newline
441following it inside the documentation string. This feature is 442following it inside the documentation string. (The @samp{\} is used
442particularly useful for macro definitions. The @samp{\} is used to 443to avoid confusing the Emacs motion commands.) The calling convention
443avoid confusing the Emacs motion commands. 444specified in this way appears in help messages in place of the one
445derived from the actual arguments of the function.
446
447 This feature is particularly useful for macro definitions, since the
448arguments written in a macro definition often do not correspond to the
449way users think of the parts of the macro call.
444 450
445@node Function Names 451@node Function Names
446@section Naming a Function 452@section Naming a Function
@@ -481,8 +487,8 @@ practice).
481 We often identify functions with the symbols used to name them. For 487 We often identify functions with the symbols used to name them. For
482example, we often speak of ``the function @code{car}'', not 488example, we often speak of ``the function @code{car}'', not
483distinguishing between the symbol @code{car} and the primitive 489distinguishing between the symbol @code{car} and the primitive
484subr-object that is its function definition. For most purposes, there 490subr-object that is its function definition. For most purposes, the
485is no need to distinguish. 491distinction is not important.
486 492
487 Even so, keep in mind that a function need not have a unique name. While 493 Even so, keep in mind that a function need not have a unique name. While
488a given function object @emph{usually} appears in the function cell of only 494a given function object @emph{usually} appears in the function cell of only
@@ -626,13 +632,12 @@ For example, evaluating the list @code{(concat "a" "b")} calls the
626function @code{concat} with arguments @code{"a"} and @code{"b"}. 632function @code{concat} with arguments @code{"a"} and @code{"b"}.
627@xref{Evaluation}, for a description of evaluation. 633@xref{Evaluation}, for a description of evaluation.
628 634
629 When you write a list as an expression in your program, the function 635 When you write a list as an expression in your program, you specify
630name it calls is written in your program. This means that you choose 636which function to call, and how many arguments to give it, in the text
631which function to call, and how many arguments to give it, when you 637of the program. Usually that's just what you want. Occasionally you
632write the program. Usually that's just what you want. Occasionally you 638need to compute at run time which function to call. To do that, use
633need to compute at run time which function to call. To do that, use the 639the function @code{funcall}. When you also need to determine at run
634function @code{funcall}. When you also need to determine at run time 640time how many arguments to pass, use @code{apply}.
635how many arguments to pass, use @code{apply}.
636 641
637@defun funcall function &rest arguments 642@defun funcall function &rest arguments
638@code{funcall} calls @var{function} with @var{arguments}, and returns 643@code{funcall} calls @var{function} with @var{arguments}, and returns
@@ -641,11 +646,12 @@ whatever @var{function} returns.
641Since @code{funcall} is a function, all of its arguments, including 646Since @code{funcall} is a function, all of its arguments, including
642@var{function}, are evaluated before @code{funcall} is called. This 647@var{function}, are evaluated before @code{funcall} is called. This
643means that you can use any expression to obtain the function to be 648means that you can use any expression to obtain the function to be
644called. It also means that @code{funcall} does not see the expressions 649called. It also means that @code{funcall} does not see the
645you write for the @var{arguments}, only their values. These values are 650expressions you write for the @var{arguments}, only their values.
646@emph{not} evaluated a second time in the act of calling @var{function}; 651These values are @emph{not} evaluated a second time in the act of
647@code{funcall} enters the normal procedure for calling a function at the 652calling @var{function}; the operation of @code{funcall} is like the
648place where the arguments have already been evaluated. 653normal procedure for calling a function, once its arguments have
654already been evaluated.
649 655
650The argument @var{function} must be either a Lisp function or a 656The argument @var{function} must be either a Lisp function or a
651primitive function. Special forms and macros are not allowed, because 657primitive function. Special forms and macros are not allowed, because
@@ -1137,30 +1143,12 @@ Here are examples of these uses:
1137@end example 1143@end example
1138@end defun 1144@end defun
1139 1145
1140 When writing a function that extends a previously defined function, 1146 @code{fset} is sometimes used to save the old definition of a
1141the following idiom is sometimes used: 1147function before redefining it. That permits the new definition to
1142 1148invoke the old definition. But it is unmodular and unclean for a Lisp
1143@example 1149file to redefine a function defined elsewhere. If you want to modify
1144(fset 'old-foo (symbol-function 'foo)) 1150a function defined by another package, it is cleaner to use
1145(defun foo () 1151@code{defadvice} (@pxref{Advising Functions}).
1146 "Just like old-foo, except more so."
1147@group
1148 (old-foo)
1149 (more-so))
1150@end group
1151@end example
1152
1153@noindent
1154This does not work properly if @code{foo} has been defined to autoload.
1155In such a case, when @code{foo} calls @code{old-foo}, Lisp attempts
1156to define @code{old-foo} by loading a file. Since this presumably
1157defines @code{foo} rather than @code{old-foo}, it does not produce the
1158proper results. The only way to avoid this problem is to make sure the
1159file is loaded before moving aside the old definition of @code{foo}.
1160
1161 But it is unmodular and unclean, in any case, for a Lisp file to
1162redefine a function defined elsewhere. It is cleaner to use the advice
1163facility (@pxref{Advising Functions}).
1164 1152
1165@node Inline Functions 1153@node Inline Functions
1166@section Inline Functions 1154@section Inline Functions
diff --git a/lispref/hash.texi b/lispref/hash.texi
index 107935f1ba0..9343196a238 100644
--- a/lispref/hash.texi
+++ b/lispref/hash.texi
@@ -46,10 +46,10 @@ of object and are used only for recording interned symbols
46(@pxref{Creating Symbols}). 46(@pxref{Creating Symbols}).
47 47
48@menu 48@menu
49* Creating Hash:: 49* Creating Hash:: Functions to create hash tables.
50* Hash Access:: 50* Hash Access:: Reading and writing the hash table contents.
51* Defining Hash:: 51* Defining Hash:: Defining new comparison methods
52* Other Hash:: 52* Other Hash:: Miscellaneous.
53@end menu 53@end menu
54 54
55@node Creating Hash 55@node Creating Hash
@@ -146,11 +146,11 @@ number.
146The default value is 1.5. 146The default value is 1.5.
147 147
148@item :rehash-threshold @var{threshold} 148@item :rehash-threshold @var{threshold}
149This specifies the criterion for when the hash table is ``full.'' The 149This specifies the criterion for when the hash table is ``full'' (so
150value, @var{threshold}, should be a positive floating point number, no 150it should be made larger). The value, @var{threshold}, should be a
151greater than 1. The hash table is ``full'' whenever the actual number of 151positive floating point number, no greater than 1. The hash table is
152entries exceeds this fraction of the nominal size. The default for 152``full'' whenever the actual number of entries exceeds this fraction
153@var{threshold} is 0.8. 153of the nominal size. The default for @var{threshold} is 0.8.
154@end table 154@end table
155@end defun 155@end defun
156 156
@@ -167,7 +167,9 @@ This function is obsolete. Use @code{make-hash-table} instead.
167@section Hash Table Access 167@section Hash Table Access
168 168
169 This section describes the functions for accessing and storing 169 This section describes the functions for accessing and storing
170associations in a hash table. 170associations in a hash table. In general, any Lisp object can be used
171as a hash key, unless the comparison method imposes limits. Any Lisp
172object can also be used as the value.
171 173
172@tindex gethash 174@tindex gethash
173@defun gethash key table &optional default 175@defun gethash key table &optional default
@@ -210,7 +212,7 @@ table.
210This function calls @var{function} once for each of the associations in 212This function calls @var{function} once for each of the associations in
211@var{table}. The function @var{function} should accept two 213@var{table}. The function @var{function} should accept two
212arguments---a @var{key} listed in @var{table}, and its associated 214arguments---a @var{key} listed in @var{table}, and its associated
213@var{value}. 215@var{value}. @code{maphash} returns @code{nil}.
214@end defun 216@end defun
215 217
216@node Defining Hash 218@node Defining Hash
diff --git a/lispref/lists.texi b/lispref/lists.texi
index d30dcb0c270..dbcddd741b3 100644
--- a/lispref/lists.texi
+++ b/lispref/lists.texi
@@ -1,7 +1,7 @@
1@c -*-texinfo-*- 1@c -*-texinfo-*-
2@c This is part of the GNU Emacs Lisp Reference Manual. 2@c This is part of the GNU Emacs Lisp Reference Manual.
3@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 3@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999,
4@c 2003, 2004 4@c 2003, 2004, 2005
5@c Free Software Foundation, Inc. 5@c Free Software Foundation, Inc.
6@c See the file elisp.texi for copying conditions. 6@c See the file elisp.texi for copying conditions.
7@setfilename ../info/lists 7@setfilename ../info/lists
@@ -18,7 +18,6 @@ the whole list.
18 18
19@menu 19@menu
20* Cons Cells:: How lists are made out of cons cells. 20* Cons Cells:: How lists are made out of cons cells.
21* Lists as Boxes:: Graphical notation to explain lists.
22* List-related Predicates:: Is this object a list? Comparing two lists. 21* List-related Predicates:: Is this object a list? Comparing two lists.
23* List Elements:: Extracting the pieces of a list. 22* List Elements:: Extracting the pieces of a list.
24* Building Lists:: Creating list structure. 23* Building Lists:: Creating list structure.
@@ -86,100 +85,17 @@ cells.
86 The @sc{cdr} of any nonempty list @var{l} is a list containing all the 85 The @sc{cdr} of any nonempty list @var{l} is a list containing all the
87elements of @var{l} except the first. 86elements of @var{l} except the first.
88 87
89@node Lists as Boxes
90@comment node-name, next, previous, up
91@section Lists as Linked Pairs of Boxes
92@cindex box representation for lists
93@cindex lists represented as boxes
94@cindex cons cell as box
95
96 A cons cell can be illustrated as a pair of boxes. The first box
97represents the @sc{car} and the second box represents the @sc{cdr}.
98Here is an illustration of the two-element list, @code{(tulip lily)},
99made from two cons cells:
100
101@example
102@group
103 --------------- ---------------
104| car | cdr | | car | cdr |
105| tulip | o---------->| lily | nil |
106| | | | | |
107 --------------- ---------------
108@end group
109@end example
110
111 Each pair of boxes represents a cons cell. Each box ``refers to'',
112``points to'' or ``holds'' a Lisp object. (These terms are
113synonymous.) The first box, which describes the @sc{car} of the first
114cons cell, contains the symbol @code{tulip}. The arrow from the
115@sc{cdr} box of the first cons cell to the second cons cell indicates
116that the @sc{cdr} of the first cons cell is the second cons cell.
117
118 The same list can be illustrated in a different sort of box notation
119like this:
120
121@example
122@group
123 --- --- --- ---
124 | | |--> | | |--> nil
125 --- --- --- ---
126 | |
127 | |
128 --> tulip --> lily
129@end group
130@end example
131
132 Here is a more complex illustration, showing the three-element list,
133@code{((pine needles) oak maple)}, the first element of which is a
134two-element list:
135
136@example
137@group
138 --- --- --- --- --- ---
139 | | |--> | | |--> | | |--> nil
140 --- --- --- --- --- ---
141 | | |
142 | | |
143 | --> oak --> maple
144 |
145 | --- --- --- ---
146 --> | | |--> | | |--> nil
147 --- --- --- ---
148 | |
149 | |
150 --> pine --> needles
151@end group
152@end example
153
154 The same list represented in the first box notation looks like this:
155
156@example
157@group
158 -------------- -------------- --------------
159| car | cdr | | car | cdr | | car | cdr |
160| o | o------->| oak | o------->| maple | nil |
161| | | | | | | | | |
162 -- | --------- -------------- --------------
163 |
164 |
165 | -------------- ----------------
166 | | car | cdr | | car | cdr |
167 ------>| pine | o------->| needles | nil |
168 | | | | | |
169 -------------- ----------------
170@end group
171@end example
172
173 @xref{Cons Cell Type}, for the read and print syntax of cons cells and 88 @xref{Cons Cell Type}, for the read and print syntax of cons cells and
174lists, and for more ``box and arrow'' illustrations of lists. 89lists, and for ``box and arrow'' illustrations of lists.
175 90
176@node List-related Predicates 91@node List-related Predicates
177@section Predicates on Lists 92@section Predicates on Lists
178 93
179 The following predicates test whether a Lisp object is an atom, is a 94 The following predicates test whether a Lisp object is an atom,
180cons cell or is a list, or whether it is the distinguished object 95whether it is a cons cell or is a list, or whether it is the
181@code{nil}. (Many of these predicates can be defined in terms of the 96distinguished object @code{nil}. (Many of these predicates can be
182others, but they are used so often that it is worth having all of them.) 97defined in terms of the others, but they are used so often that it is
98worth having all of them.)
183 99
184@defun consp object 100@defun consp object
185This function returns @code{t} if @var{object} is a cons cell, @code{nil} 101This function returns @code{t} if @var{object} is a cons cell, @code{nil}
@@ -749,9 +665,14 @@ This returns a list of numbers starting with @var{from} and
749incrementing by @var{separation}, and ending at or just before 665incrementing by @var{separation}, and ending at or just before
750@var{to}. @var{separation} can be positive or negative and defaults 666@var{to}. @var{separation} can be positive or negative and defaults
751to 1. If @var{to} is @code{nil} or numerically equal to @var{from}, 667to 1. If @var{to} is @code{nil} or numerically equal to @var{from},
752the one element list @code{(from)} is returned. If @var{separation} 668the value is the one-element list @code{(@var{from})}. If @var{to} is
753is 0 and @var{to} is neither @code{nil} nor numerically equal to 669less than @var{from} with a positive @var{separation}, or greater than
754@var{from}, an error is signaled. 670@var{from} with a negative @var{separation}, the value is @code{nil}
671because those arguments specify an empty sequence.
672
673If @var{separation} is 0 and @var{to} is neither @code{nil} nor
674numerically equal to @var{from}, @code{number-sequence} signals an
675error, since those arguments specify an infinite sequence.
755 676
756All arguments can be integers or floating point numbers. However, 677All arguments can be integers or floating point numbers. However,
757floating point arguments can be tricky, because floating point 678floating point arguments can be tricky, because floating point
diff --git a/lispref/loading.texi b/lispref/loading.texi
index 61c5b13ca6f..e12826af2f8 100644
--- a/lispref/loading.texi
+++ b/lispref/loading.texi
@@ -1,7 +1,7 @@
1@c -*-texinfo-*- 1@c -*-texinfo-*-
2@c This is part of the GNU Emacs Lisp Reference Manual. 2@c This is part of the GNU Emacs Lisp Reference Manual.
3@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 3@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999,
4@c 2003, 2004 4@c 2003, 2004, 2005
5@c Free Software Foundation, Inc. 5@c Free Software Foundation, Inc.
6@c See the file elisp.texi for copying conditions. 6@c See the file elisp.texi for copying conditions.
7@setfilename ../info/loading 7@setfilename ../info/loading
@@ -365,10 +365,12 @@ one of these suffixes, and it will not load from a file whose name is
365just @var{filename} with no added suffix. 365just @var{filename} with no added suffix.
366 366
367The argument @var{docstring} is the documentation string for the 367The argument @var{docstring} is the documentation string for the
368function. Normally, this should be identical to the documentation string 368function. Specifying the documentation string in the call to
369in the function definition itself. Specifying the documentation string 369@code{autoload} makes it possible to look at the documentation without
370in the call to @code{autoload} makes it possible to look at the 370loading the function's real definition. Normally, this should be
371documentation without loading the function's real definition. 371identical to the documentation string in the function definition
372itself. If it isn't, the function definition's documentation string
373takes effect when it is loaded.
372 374
373If @var{interactive} is non-@code{nil}, that says @var{function} can be 375If @var{interactive} is non-@code{nil}, that says @var{function} can be
374called interactively. This lets completion in @kbd{M-x} work without 376called interactively. This lets completion in @kbd{M-x} work without
@@ -526,8 +528,7 @@ initialized. (@xref{Defining Variables}.)
526 The simplest way to add an element to an alist is like this: 528 The simplest way to add an element to an alist is like this:
527 529
528@example 530@example
529(setq minor-mode-alist 531(push '(leif-mode " Leif") minor-mode-alist)
530 (cons '(leif-mode " Leif") minor-mode-alist))
531@end example 532@end example
532 533
533@noindent 534@noindent
@@ -536,12 +537,15 @@ To avoid the problem, write this:
536 537
537@example 538@example
538(or (assq 'leif-mode minor-mode-alist) 539(or (assq 'leif-mode minor-mode-alist)
539 (setq minor-mode-alist 540 (push '(leif-mode " Leif") minor-mode-alist))
540 (cons '(leif-mode " Leif") minor-mode-alist)))
541@end example 541@end example
542 542
543 To add an element to a list just once, you can also use @code{add-to-list} 543@noindent
544(@pxref{Setting Variables}). 544or this:
545
546@example
547(add-to-list '(leif-mode " Leif") minor-mode-alist)
548@end example
545 549
546 Occasionally you will want to test explicitly whether a library has 550 Occasionally you will want to test explicitly whether a library has
547already been loaded. Here's one way to test, in a library, whether it 551already been loaded. Here's one way to test, in a library, whether it
@@ -746,12 +750,12 @@ elements have these forms:
746@item @var{var} 750@item @var{var}
747The symbol @var{var} was defined as a variable. 751The symbol @var{var} was defined as a variable.
748@item (defun . @var{fun}) 752@item (defun . @var{fun})
749The @var{fun} was defined by this library. 753The function @var{fun} was defined.
750@item (t . @var{fun}) 754@item (t . @var{fun})
751The function @var{fun} was previously an autoload before this library 755The function @var{fun} was previously an autoload before this library
752redefined it as a function. The following element is always the 756redefined it as a function. The following element is always
753symbol @var{fun}, which signifies that the library defined @var{fun} 757@code{(defun . @var{fun})}, which represents defining @var{fun} as a
754as a function. 758function.
755@item (autoload . @var{fun}) 759@item (autoload . @var{fun})
756The function @var{fun} was defined as an autoload. 760The function @var{fun} was defined as an autoload.
757@item (require . @var{feature}) 761@item (require . @var{feature})
diff --git a/lispref/minibuf.texi b/lispref/minibuf.texi
index 1455c63fe34..0e855b499ae 100644
--- a/lispref/minibuf.texi
+++ b/lispref/minibuf.texi
@@ -111,7 +111,8 @@ was supplied when Emacs was started.
111 Most often, the minibuffer is used to read text as a string. It can 111 Most often, the minibuffer is used to read text as a string. It can
112also be used to read a Lisp object in textual form. The most basic 112also be used to read a Lisp object in textual form. The most basic
113primitive for minibuffer input is @code{read-from-minibuffer}; it can do 113primitive for minibuffer input is @code{read-from-minibuffer}; it can do
114either one. 114either one. There are also specialized commands for reading
115commands, variables, file names, etc. (@pxref{Completion}).
115 116
116 In most cases, you should not call minibuffer input functions in the 117 In most cases, you should not call minibuffer input functions in the
117middle of a Lisp function. Instead, do all minibuffer input as part of 118middle of a Lisp function. Instead, do all minibuffer input as part of
@@ -234,9 +235,11 @@ default, it makes the following bindings:
234@code{abort-recursive-edit} 235@code{abort-recursive-edit}
235 236
236@item @kbd{M-n} 237@item @kbd{M-n}
238@itemx @key{DOWN}
237@code{next-history-element} 239@code{next-history-element}
238 240
239@item @kbd{M-p} 241@item @kbd{M-p}
242@itemx @key{UP}
240@code{previous-history-element} 243@code{previous-history-element}
241 244
242@item @kbd{M-s} 245@item @kbd{M-s}
diff --git a/lispref/numbers.texi b/lispref/numbers.texi
index 53435da081b..776251e4933 100644
--- a/lispref/numbers.texi
+++ b/lispref/numbers.texi
@@ -73,14 +73,21 @@ initial sign and optional final period.
73@cindex hex numbers 73@cindex hex numbers
74@cindex octal numbers 74@cindex octal numbers
75@cindex reading numbers in hex, octal, and binary 75@cindex reading numbers in hex, octal, and binary
76 In addition, the Lisp reader recognizes a syntax for integers in 76 The syntax for integers in bases other than 10 uses @samp{#}
77bases other than 10: @samp{#B@var{integer}} reads @var{integer} in 77followed by a letter that specifies the radix: @samp{b} for binary,
78binary (radix 2), @samp{#O@var{integer}} reads @var{integer} in octal 78@samp{o} for octal, @samp{x} for hex, or @samp{@var{radix}r} to
79(radix 8), @samp{#X@var{integer}} reads @var{integer} in hexadecimal 79specify radix @var{radix}. Case is not significant for the letter
80(radix 16), and @samp{#@var{radix}r@var{integer}} reads @var{integer} 80that specifies the radix. Thus, @samp{#b@var{integer}} reads
81in radix @var{radix} (where @var{radix} is between 2 and 36, 81@var{integer} in binary, and @samp{#@var{radix}r@var{integer}} reads
82inclusively). Case is not significant for the letter after @samp{#} 82@var{integer} in radix @var{radix}. Allowed values of @var{radix} run
83(@samp{B}, @samp{O}, etc.) that denotes the radix. 83from 2 to 36. For example:
84
85@example
86#b101100 @result{} 44
87#o54 @result{} 44
88#x2c @result{} 44
89#24r1k @result{} 44
90@end example
84 91
85 To understand how various functions work on integers, especially the 92 To understand how various functions work on integers, especially the
86bitwise operators (@pxref{Bitwise Operations}), it is often helpful to 93bitwise operators (@pxref{Bitwise Operations}), it is often helpful to
@@ -211,13 +218,12 @@ down to an integer.
211@node Predicates on Numbers 218@node Predicates on Numbers
212@section Type Predicates for Numbers 219@section Type Predicates for Numbers
213 220
214 The functions in this section test whether the argument is a number or 221 The functions in this section test for numbers, or for a specific
215whether it is a certain sort of number. The functions @code{integerp} 222type of number. The functions @code{integerp} and @code{floatp} can
216and @code{floatp} can take any type of Lisp object as argument (the 223take any type of Lisp object as argument (they would not be of much
217predicates would not be of much use otherwise); but the @code{zerop} 224use otherwise), but the @code{zerop} predicate requires a number as
218predicate requires a number as its argument. See also 225its argument. See also @code{integer-or-marker-p} and
219@code{integer-or-marker-p} and @code{number-or-marker-p}, in 226@code{number-or-marker-p}, in @ref{Predicates on Markers}.
220@ref{Predicates on Markers}.
221 227
222@defun floatp object 228@defun floatp object
223This predicate tests whether its argument is a floating point 229This predicate tests whether its argument is a floating point
@@ -251,7 +257,7 @@ considered non-negative.
251This predicate tests whether its argument is zero, and returns @code{t} 257This predicate tests whether its argument is zero, and returns @code{t}
252if so, @code{nil} otherwise. The argument must be a number. 258if so, @code{nil} otherwise. The argument must be a number.
253 259
254These two forms are equivalent: @code{(zerop x)} @equiv{} @code{(= x 0)}. 260@code{(zerop x)} is equivalent to @code{(= x 0)}.
255@end defun 261@end defun
256 262
257@node Comparison of Numbers 263@node Comparison of Numbers
@@ -275,10 +281,11 @@ numbers or markers. However, it is a good idea to use @code{=} if you
275can, even for comparing integers, just in case we change the 281can, even for comparing integers, just in case we change the
276representation of integers in a future Emacs version. 282representation of integers in a future Emacs version.
277 283
278 Sometimes it is useful to compare numbers with @code{equal}; it treats 284 Sometimes it is useful to compare numbers with @code{equal}; it
279two numbers as equal if they have the same data type (both integers, or 285treats two numbers as equal if they have the same data type (both
280both floating point) and the same value. By contrast, @code{=} can 286integers, or both floating point) and the same value. By contrast,
281treat an integer and a floating point number as equal. 287@code{=} can treat an integer and a floating point number as equal.
288@xref{Equality Predicates}.
282 289
283 There is another wrinkle: because floating point arithmetic is not 290 There is another wrinkle: because floating point arithmetic is not
284exact, it is often a bad idea to check for equality of two floating 291exact, it is often a bad idea to check for equality of two floating
@@ -309,10 +316,10 @@ returns @code{t} if so, @code{nil} otherwise.
309@end defun 316@end defun
310 317
311@defun eql value1 value2 318@defun eql value1 value2
312This function compares two floating point numbers like @code{=}, and 319This function acts like @code{eq} except when both arguments are
313compares two integers like @code{=}, and acts like @code{eq} in all 320numbers. It compares numbers by type and numberic value, so that
314other cases. Thus, @code{(eql 1.0 1)} returns @code{nil}, but 321@code{(eql 1.0 1)} returns @code{nil}, but @code{(eql 1.0 1.0)} and
315@code{(eql 1.0 1.0)} and @code{(eql 1 1)} both return @code{t}. 322@code{(eql 1 1)} both return @code{t}.
316@end defun 323@end defun
317 324
318@defun /= number-or-marker1 number-or-marker2 325@defun /= number-or-marker1 number-or-marker2
@@ -345,7 +352,7 @@ otherwise.
345 352
346@defun max number-or-marker &rest numbers-or-markers 353@defun max number-or-marker &rest numbers-or-markers
347This function returns the largest of its arguments. 354This function returns the largest of its arguments.
348If any of the argument is floating-point, the value is returned 355If any of the arguments is floating-point, the value is returned
349as floating point, even if it was given as an integer. 356as floating point, even if it was given as an integer.
350 357
351@example 358@example
@@ -360,7 +367,7 @@ as floating point, even if it was given as an integer.
360 367
361@defun min number-or-marker &rest numbers-or-markers 368@defun min number-or-marker &rest numbers-or-markers
362This function returns the smallest of its arguments. 369This function returns the smallest of its arguments.
363If any of the argument is floating-point, the value is returned 370If any of the arguments is floating-point, the value is returned
364as floating point, even if it was given as an integer. 371as floating point, even if it was given as an integer.
365 372
366@example 373@example
@@ -1147,8 +1154,7 @@ approximately.
1147@defun expt x y 1154@defun expt x y
1148This function returns @var{x} raised to power @var{y}. If both 1155This function returns @var{x} raised to power @var{y}. If both
1149arguments are integers and @var{y} is positive, the result is an 1156arguments are integers and @var{y} is positive, the result is an
1150integer; in this case, it is truncated to fit the range of possible 1157integer; in this case, overflow causes truncation, so watch out.
1151integer values.
1152@end defun 1158@end defun
1153 1159
1154@defun sqrt arg 1160@defun sqrt arg
diff --git a/lispref/objects.texi b/lispref/objects.texi
index 43ecb02f09e..f0bef593f29 100644
--- a/lispref/objects.texi
+++ b/lispref/objects.texi
@@ -68,36 +68,37 @@ to use these types can be found in later chapters.
68 68
69 The @dfn{printed representation} of an object is the format of the 69 The @dfn{printed representation} of an object is the format of the
70output generated by the Lisp printer (the function @code{prin1}) for 70output generated by the Lisp printer (the function @code{prin1}) for
71that object. The @dfn{read syntax} of an object is the format of the 71that object. Every data type has a unique printed representation.
72input accepted by the Lisp reader (the function @code{read}) for that 72The @dfn{read syntax} of an object is the format of the input accepted
73object. @xref{Read and Print}. 73by the Lisp reader (the function @code{read}) for that object. This
74 74is not necessarily unique; many kinds of object have more than one
75 Most objects have more than one possible read syntax. Some types of 75syntax. @xref{Read and Print}.
76object have no read syntax, since it may not make sense to enter objects
77of these types directly in a Lisp program. Except for these cases, the
78printed representation of an object is also a read syntax for it.
79
80 In other languages, an expression is text; it has no other form. In
81Lisp, an expression is primarily a Lisp object and only secondarily the
82text that is the object's read syntax. Often there is no need to
83emphasize this distinction, but you must keep it in the back of your
84mind, or you will occasionally be very confused.
85 76
86@cindex hash notation 77@cindex hash notation
87 Every type has a printed representation. Some types have no read 78 In most cases, an object's printed representation is also a read
88syntax---for example, the buffer type has none. Objects of these types 79syntax for the object. However, some types have no read syntax, since
89are printed in @dfn{hash notation}: the characters @samp{#<} followed by 80it does not make sense to enter objects of these types as constants in
90a descriptive string (typically the type name followed by the name of 81a Lisp program. These objects are printed in @dfn{hash notation}: the
91the object), and closed with a matching @samp{>}. Hash notation cannot 82characters @samp{#<} followed by a descriptive string (typically the
92be read at all, so the Lisp reader signals the error 83type name followed by the name of the object), and closed with a
93@code{invalid-read-syntax} whenever it encounters @samp{#<}. 84matching @samp{>}. For example:
94@kindex invalid-read-syntax
95 85
96@example 86@example
97(current-buffer) 87(current-buffer)
98 @result{} #<buffer objects.texi> 88 @result{} #<buffer objects.texi>
99@end example 89@end example
100 90
91@noindent
92Hash notation cannot be read at all, so the Lisp reader signals the
93error @code{invalid-read-syntax} whenever it encounters @samp{#<}.
94@kindex invalid-read-syntax
95
96 In other languages, an expression is text; it has no other form. In
97Lisp, an expression is primarily a Lisp object and only secondarily the
98text that is the object's read syntax. Often there is no need to
99emphasize this distinction, but you must keep it in the back of your
100mind, or you will occasionally be very confused.
101
101 When you evaluate an expression interactively, the Lisp interpreter 102 When you evaluate an expression interactively, the Lisp interpreter
102first reads the textual representation of it, producing a Lisp object, 103first reads the textual representation of it, producing a Lisp object,
103and then evaluates that object (@pxref{Evaluation}). However, 104and then evaluates that object (@pxref{Evaluation}). However,
@@ -204,9 +205,11 @@ leading @samp{+} or a final @samp{.}.
204@subsection Floating Point Type 205@subsection Floating Point Type
205 206
206 Floating point numbers are the computer equivalent of scientific 207 Floating point numbers are the computer equivalent of scientific
207notation. The precise number of significant figures and the range of 208notation; you can think of a floating point number as a fraction
208possible exponents is machine-specific; Emacs always uses the C data 209together with a power of ten. The precise number of significant
209type @code{double} to store the value. 210figures and the range of possible exponents is machine-specific; Emacs
211uses the C data type @code{double} to store the value, and internally
212this records a power of 2 rather than a power of 10.
210 213
211 The printed representation for floating point numbers requires either 214 The printed representation for floating point numbers requires either
212a decimal point (with at least one digit following), an exponent, or 215a decimal point (with at least one digit following), an exponent, or
@@ -474,9 +477,10 @@ following text.)
474@node Symbol Type 477@node Symbol Type
475@subsection Symbol Type 478@subsection Symbol Type
476 479
477 A @dfn{symbol} in GNU Emacs Lisp is an object with a name. The symbol 480 A @dfn{symbol} in GNU Emacs Lisp is an object with a name. The
478name serves as the printed representation of the symbol. In ordinary 481symbol name serves as the printed representation of the symbol. In
479use, the name is unique---no two symbols have the same name. 482ordinary Lisp use, with one single obarray (@pxref{Creating Symbols},
483a symbol's name is unique---no two symbols have the same name.
480 484
481 A symbol can serve as a variable, as a function name, or to hold a 485 A symbol can serve as a variable, as a function name, or to hold a
482property list. Or it may serve only to be distinct from all other Lisp 486property list. Or it may serve only to be distinct from all other Lisp
@@ -606,18 +610,10 @@ Lisp are implicit.
606 610
607 A @dfn{list} is a series of cons cells, linked together so that the 611 A @dfn{list} is a series of cons cells, linked together so that the
608@sc{cdr} slot of each cons cell holds either the next cons cell or the 612@sc{cdr} slot of each cons cell holds either the next cons cell or the
609empty list. @xref{Lists}, for functions that work on lists. Because 613empty list. The empty list is actually the symbol @code{nil}.
610most cons cells are used as part of lists, the phrase @dfn{list 614@xref{Lists}, for functions that work on lists. Because most cons
611structure} has come to refer to any structure made out of cons cells. 615cells are used as part of lists, the phrase @dfn{list structure} has
612 616come to refer to any structure made out of cons cells.
613 The names @sc{car} and @sc{cdr} derive from the history of Lisp. The
614original Lisp implementation ran on an @w{IBM 704} computer which
615divided words into two parts, called the ``address'' part and the
616``decrement''; @sc{car} was an instruction to extract the contents of
617the address part of a register, and @sc{cdr} an instruction to extract
618the contents of the decrement. By contrast, ``cons cells'' are named
619for the function @code{cons} that creates them, which in turn was named
620for its purpose, the construction of cells.
621 617
622@cindex atom 618@cindex atom
623 Because cons cells are so central to Lisp, we also have a word for 619 Because cons cells are so central to Lisp, we also have a word for
@@ -627,7 +623,18 @@ for its purpose, the construction of cells.
627@cindex parenthesis 623@cindex parenthesis
628 The read syntax and printed representation for lists are identical, and 624 The read syntax and printed representation for lists are identical, and
629consist of a left parenthesis, an arbitrary number of elements, and a 625consist of a left parenthesis, an arbitrary number of elements, and a
630right parenthesis. 626right parenthesis. Here are examples of lists:
627
628@example
629(A 2 "A") ; @r{A list of three elements.}
630() ; @r{A list of no elements (the empty list).}
631nil ; @r{A list of no elements (the empty list).}
632("A ()") ; @r{A list of one element: the string @code{"A ()"}.}
633(A ()) ; @r{A list of two elements: @code{A} and the empty list.}
634(A nil) ; @r{Equivalent to the previous.}
635((A B C)) ; @r{A list of one element}
636 ; @r{(which is a list of three elements).}
637@end example
631 638
632 Upon reading, each object inside the parentheses becomes an element 639 Upon reading, each object inside the parentheses becomes an element
633of the list. That is, a cons cell is made for each element. The 640of the list. That is, a cons cell is made for each element. The
@@ -636,8 +643,26 @@ slot refers to the next cons cell of the list, which holds the next
636element in the list. The @sc{cdr} slot of the last cons cell is set to 643element in the list. The @sc{cdr} slot of the last cons cell is set to
637hold @code{nil}. 644hold @code{nil}.
638 645
646 The names @sc{car} and @sc{cdr} derive from the history of Lisp. The
647original Lisp implementation ran on an @w{IBM 704} computer which
648divided words into two parts, called the ``address'' part and the
649``decrement''; @sc{car} was an instruction to extract the contents of
650the address part of a register, and @sc{cdr} an instruction to extract
651the contents of the decrement. By contrast, ``cons cells'' are named
652for the function @code{cons} that creates them, which in turn was named
653for its purpose, the construction of cells.
654
655@menu
656* Box Diagrams:: Drawing pictures of lists.
657* Dotted Pair Notation:: A general syntax for cons cells.
658* Association List Type:: A specially constructed list.
659@end menu
660
661@node Box Diagrams
662@subsubsection Drawing Lists as Box Diagrams
639@cindex box diagrams, for lists 663@cindex box diagrams, for lists
640@cindex diagrams, boxed, for lists 664@cindex diagrams, boxed, for lists
665
641 A list can be illustrated by a diagram in which the cons cells are 666 A list can be illustrated by a diagram in which the cons cells are
642shown as pairs of boxes, like dominoes. (The Lisp reader cannot read 667shown as pairs of boxes, like dominoes. (The Lisp reader cannot read
643such an illustration; unlike the textual notation, which can be 668such an illustration; unlike the textual notation, which can be
@@ -688,19 +713,6 @@ buttercup)}, sketched in a different manner:
688to the symbol @code{nil}. In other words, @code{nil} is both a symbol 713to the symbol @code{nil}. In other words, @code{nil} is both a symbol
689and a list. 714and a list.
690 715
691 Here are examples of lists written in Lisp syntax:
692
693@example
694(A 2 "A") ; @r{A list of three elements.}
695() ; @r{A list of no elements (the empty list).}
696nil ; @r{A list of no elements (the empty list).}
697("A ()") ; @r{A list of one element: the string @code{"A ()"}.}
698(A ()) ; @r{A list of two elements: @code{A} and the empty list.}
699(A nil) ; @r{Equivalent to the previous.}
700((A B C)) ; @r{A list of one element}
701 ; @r{(which is a list of three elements).}
702@end example
703
704 Here is the list @code{(A ())}, or equivalently @code{(A nil)}, 716 Here is the list @code{(A ())}, or equivalently @code{(A nil)},
705depicted with boxes and arrows: 717depicted with boxes and arrows:
706 718
@@ -715,27 +727,64 @@ depicted with boxes and arrows:
715@end group 727@end group
716@end example 728@end example
717 729
718@menu 730 Here is a more complex illustration, showing the three-element list,
719* Dotted Pair Notation:: An alternative syntax for lists. 731@code{((pine needles) oak maple)}, the first element of which is a
720* Association List Type:: A specially constructed list. 732two-element list:
721@end menu 733
734@example
735@group
736 --- --- --- --- --- ---
737 | | |--> | | |--> | | |--> nil
738 --- --- --- --- --- ---
739 | | |
740 | | |
741 | --> oak --> maple
742 |
743 | --- --- --- ---
744 --> | | |--> | | |--> nil
745 --- --- --- ---
746 | |
747 | |
748 --> pine --> needles
749@end group
750@end example
751
752 The same list represented in the first box notation looks like this:
753
754@example
755@group
756 -------------- -------------- --------------
757| car | cdr | | car | cdr | | car | cdr |
758| o | o------->| oak | o------->| maple | nil |
759| | | | | | | | | |
760 -- | --------- -------------- --------------
761 |
762 |
763 | -------------- ----------------
764 | | car | cdr | | car | cdr |
765 ------>| pine | o------->| needles | nil |
766 | | | | | |
767 -------------- ----------------
768@end group
769@end example
722 770
723@node Dotted Pair Notation 771@node Dotted Pair Notation
724@comment node-name, next, previous, up
725@subsubsection Dotted Pair Notation 772@subsubsection Dotted Pair Notation
726@cindex dotted pair notation 773@cindex dotted pair notation
727@cindex @samp{.} in lists 774@cindex @samp{.} in lists
728 775
729 @dfn{Dotted pair notation} is an alternative syntax for cons cells 776 @dfn{Dotted pair notation} is a general syntax for cons cells that
730that represents the @sc{car} and @sc{cdr} explicitly. In this syntax, 777represents the @sc{car} and @sc{cdr} explicitly. In this syntax,
731@code{(@var{a} .@: @var{b})} stands for a cons cell whose @sc{car} is 778@code{(@var{a} .@: @var{b})} stands for a cons cell whose @sc{car} is
732the object @var{a}, and whose @sc{cdr} is the object @var{b}. Dotted 779the object @var{a}, and whose @sc{cdr} is the object @var{b}. Dotted
733pair notation is therefore more general than list syntax. In the dotted 780pair notation is more general than list syntax because the @sc{cdr}
734pair notation, the list @samp{(1 2 3)} is written as @samp{(1 . (2 . (3 781does not have to be a list. However, it is more cumbersome in cases
735. nil)))}. For @code{nil}-terminated lists, you can use either 782where list syntax would work. In dotted pair notation, the list
736notation, but list notation is usually clearer and more convenient. 783@samp{(1 2 3)} is written as @samp{(1 . (2 . (3 . nil)))}. For
737When printing a list, the dotted pair notation is only used if the 784@code{nil}-terminated lists, you can use either notation, but list
738@sc{cdr} of a cons cell is not a list. 785notation is usually clearer and more convenient. When printing a
786list, the dotted pair notation is only used if the @sc{cdr} of a cons
787cell is not a list.
739 788
740 Here's an example using boxes to illustrate dotted pair notation. 789 Here's an example using boxes to illustrate dotted pair notation.
741This example shows the pair @code{(rose . violet)}: 790This example shows the pair @code{(rose . violet)}:
@@ -860,8 +909,9 @@ Once an array is created, its length is fixed.
860 909
861 All Emacs Lisp arrays are one-dimensional. (Most other programming 910 All Emacs Lisp arrays are one-dimensional. (Most other programming
862languages support multidimensional arrays, but they are not essential; 911languages support multidimensional arrays, but they are not essential;
863you can get the same effect with an array of arrays.) Each type of 912you can get the same effect with nested one-dimensional arrays.) Each
864array has its own read syntax; see the following sections for details. 913type of array has its own read syntax; see the following sections for
914details.
865 915
866 The array type is contained in the sequence type and 916 The array type is contained in the sequence type and
867contains the string type, the vector type, the bool-vector type, and the 917contains the string type, the vector type, the bool-vector type, and the
@@ -1661,6 +1711,9 @@ with references to further information.
1661@item functionp 1711@item functionp
1662@xref{Functions, functionp}. 1712@xref{Functions, functionp}.
1663 1713
1714@item hash-table-p
1715@xref{Other Hash, hash-table-p}.
1716
1664@item integer-or-marker-p 1717@item integer-or-marker-p
1665@xref{Predicates on Markers, integer-or-marker-p}. 1718@xref{Predicates on Markers, integer-or-marker-p}.
1666 1719
diff --git a/lispref/streams.texi b/lispref/streams.texi
index 599416fe679..2f27fe193dc 100644
--- a/lispref/streams.texi
+++ b/lispref/streams.texi
@@ -338,6 +338,7 @@ For example:
338@defvar standard-input 338@defvar standard-input
339This variable holds the default input stream---the stream that 339This variable holds the default input stream---the stream that
340@code{read} uses when the @var{stream} argument is @code{nil}. 340@code{read} uses when the @var{stream} argument is @code{nil}.
341The default is @code{t}, meaning use the minibuffer.
341@end defvar 342@end defvar
342 343
343@node Output Streams 344@node Output Streams
@@ -684,6 +685,7 @@ returns @code{"The buffer is foo"}.
684@defvar standard-output 685@defvar standard-output
685The value of this variable is the default output stream---the stream 686The value of this variable is the default output stream---the stream
686that print functions use when the @var{stream} argument is @code{nil}. 687that print functions use when the @var{stream} argument is @code{nil}.
688The default is @code{t}, meaning display in the echo area.
687@end defvar 689@end defvar
688 690
689@defvar print-quoted 691@defvar print-quoted
diff --git a/lispref/symbols.texi b/lispref/symbols.texi
index 858918445ff..92c8b0f1e82 100644
--- a/lispref/symbols.texi
+++ b/lispref/symbols.texi
@@ -115,10 +115,10 @@ the four cells of the symbol @code{buffer-file-name}:
115 @result{} "buffer-file-name" 115 @result{} "buffer-file-name"
116(symbol-value 'buffer-file-name) 116(symbol-value 'buffer-file-name)
117 @result{} "/gnu/elisp/symbols.texi" 117 @result{} "/gnu/elisp/symbols.texi"
118(symbol-plist 'buffer-file-name)
119 @result{} (variable-documentation 29529)
120(symbol-function 'buffer-file-name) 118(symbol-function 'buffer-file-name)
121 @result{} #<subr buffer-file-name> 119 @result{} #<subr buffer-file-name>
120(symbol-plist 'buffer-file-name)
121 @result{} (variable-documentation 29529)
122@end example 122@end example
123 123
124@noindent 124@noindent
diff --git a/lispref/variables.texi b/lispref/variables.texi
index 1f793b8f03f..de5fb40618f 100644
--- a/lispref/variables.texi
+++ b/lispref/variables.texi
@@ -1429,8 +1429,11 @@ variables that major modes set should not be marked permanent.
1429The function @code{kill-all-local-variables} runs this normal hook 1429The function @code{kill-all-local-variables} runs this normal hook
1430before it does anything else. This gives major modes a way to arrange 1430before it does anything else. This gives major modes a way to arrange
1431for something special to be done if the user switches to a different 1431for something special to be done if the user switches to a different
1432major mode. For best results, make this variable buffer-local, so that 1432major mode. It is also useful for buffer-specific minor modes
1433it will disappear after doing its job and will not interfere with the 1433that should be forgotten if the user changes the major mode.
1434
1435For best results, make this variable buffer-local, so that it will
1436disappear after doing its job and will not interfere with the
1434subsequent major mode. @xref{Hooks}. 1437subsequent major mode. @xref{Hooks}.
1435@end defvar 1438@end defvar
1436 1439