aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/emacs/ChangeLog4
-rw-r--r--doc/emacs/anti.texi95
-rw-r--r--doc/lispintro/ChangeLog9
-rw-r--r--doc/lispintro/emacs-lisp-intro.texi4
-rw-r--r--doc/lispref/ChangeLog51
-rw-r--r--doc/lispref/control.texi10
-rw-r--r--doc/lispref/elisp.texi2
-rw-r--r--doc/lispref/eval.texi24
-rw-r--r--doc/lispref/intro.texi23
-rw-r--r--doc/lispref/lists.texi163
-rw-r--r--doc/lispref/modes.texi12
-rw-r--r--doc/lispref/numbers.texi124
-rw-r--r--doc/lispref/objects.texi207
-rw-r--r--doc/lispref/sequences.texi120
-rw-r--r--doc/lispref/strings.texi13
-rw-r--r--doc/lispref/symbols.texi176
-rw-r--r--doc/lispref/variables.texi7
-rw-r--r--doc/lispref/windows.texi57
-rw-r--r--doc/misc/ChangeLog8
-rw-r--r--doc/misc/pcl-cvs.texi10
-rw-r--r--doc/misc/tramp.texi15
21 files changed, 660 insertions, 474 deletions
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog
index 90a7f69ea72..9aa4899e591 100644
--- a/doc/emacs/ChangeLog
+++ b/doc/emacs/ChangeLog
@@ -1,3 +1,7 @@
12012-01-23 Chong Yidong <cyd@gnu.org>
2
3 * anti.texi (Antinews): Add Emacs 23 antinews.
4
12012-01-16 Volker Sobek <reklov@live.com> (tiny change) 52012-01-16 Volker Sobek <reklov@live.com> (tiny change)
2 6
3 * programs.texi (Comment Commands): Typo (bug#10514). 7 * programs.texi (Comment Commands): Typo (bug#10514).
diff --git a/doc/emacs/anti.texi b/doc/emacs/anti.texi
index d9f17c91f5e..7bc405e442e 100644
--- a/doc/emacs/anti.texi
+++ b/doc/emacs/anti.texi
@@ -13,7 +13,100 @@ greater simplicity that results from the absence of many Emacs
13 13
14@itemize @bullet 14@itemize @bullet
15@item 15@item
16FIXME 16Support for displaying and editing ``bidirectional'' text has been
17removed. Text is now always displayed on the screen in a single
18consistent direction---left to right---regardless of the underlying
19script. Similarly, @kbd{C-f} and @kbd{C-b} always move the text
20cursor to the right and left respectively. Also, @key{right} and
21@key{left} are now equivalent to @kbd{C-f} and @kbd{C-b}, as you might
22expect, rather than moving forward or backward based on the underlying
23``paragraph direction''.
24
25Users of ``right-to-left'' languages, like Arabic and Hebrew, may
26adapt by reading and/or editing text in left-to-right order.
27
28@item
29The Emacs Lisp package manager has been removed. Instead of using a
30``user interface'' (@kbd{M-x list-packages}), additional Lisp packages
31must now be installed by hand, which is the most flexible and
32``Lispy'' method anyway. Typically, this just involves editing your
33init file to add the package installation directory to the load path
34and defining some autoloads; see each package's commentary section
35and/or README file for details.
36
37@item
38The option @code{delete-active-region} has been deleted. When the
39region is active, typing @key{DEL} or @key{delete} no longer deletes
40the text in the region; it deletes a single character instead.
41
42@item
43We have reworked how Emacs handles the clipboard and the X primary
44selection. Commands for killing and yanking, like @kbd{C-w} and
45@kbd{C-y}, use the primary selection and not the clipboard, so you can
46use these commands without interfering with ``cutting'' or ``pasting''
47in other programs. The @samp{Cut}/@samp{Copy}/@samp{Paste} menu items
48are bound to separate clipboard commands, not to the same commands as
49@kbd{C-w}/@kbd{M-w}/@kbd{C-y}.
50
51Selecting text by dragging with the mouse now puts the text in the
52kill ring, in addition to the primary selection. But note that
53selecting an active region with @kbd{C-@key{SPC}} does @emph{not}
54alter the kill ring nor the primary selection, even though the text
55highlighting is visually identical.
56
57@item
58In Isearch, @kbd{C-y} and @kbd{M-y} are no longer bound to
59@code{isearch-yank-kill} and @code{isearch-yank-pop} respectively.
60Instead, @kbd{C-y} yanks the rest of the current line into the search
61string (@code{isearch-yank-line}), whereas @kbd{M-y} does
62@code{isearch-yank-kill}. The mismatch with the usual meanings of
63@kbd{C-y} and @kbd{M-y} is unintended.
64
65@item
66Various completion features have been simplified. The options
67@code{completion-cycle-threshold} and
68@code{completion-category-overrides} have been removed. Due to the
69latter removal, Emacs uses a single consistent scheme to generate
70completions, instead of using a separate scheme for (say) buffer name
71completion. Several major modes, such as Shell mode, now implement
72their own inline completion commands instead of using
73@code{completion-at-point}.
74
75@item
76We have removed various options for controlling how windows are used,
77e.g.@: @code{display-buffer-base-action}, @code{display-buffer-alist},
78@code{window-combination-limit}, and @code{window-combination-resize}.
79
80@item
81The command @kbd{M-x customize-themes} has been removed. Emacs no
82longer comes with pre-defined themes (you can write your own).
83
84@item
85Emacs no longer adapts various aspects of its display to GTK+
86settings, opting instead for a uniform toolkit-independent look. GTK+
87scroll bars are placed on the left, the same position as non-GTK+ X
88scroll bars. Emacs no longer refers to GTK+ to set the default
89@code{region} face, nor for drawing tooltips.
90
91@item
92Setting the option @code{delete-by-moving-to-trash} to a
93non-@code{nil} now causes all file deletions to use the system trash,
94even temporary files created by Lisp programs; furthermore, the
95@kbd{M-x delete-file} and @kbd{M-x delete-directory} commands no
96longer accept prefix arguments to force true deletion.
97
98@item
99On GNU/Linux and Unix, the default method for sending mail (as
100specified by @code{send-mail-function}) is to use the
101@command{sendmail} program. Emacs no longer asks for a delivery
102method the first time you try to send mail, trusting instead that the
103system is configured for mail delivery, as it ought to be.
104
105@item
106Several VC features have been removed, including the @kbd{C-x v +} and
107@kbd{C-x v m} commands for pulling and merging on distributed version
108control systems, and the ability to view inline log entries in the log
109buffers made by @kbd{C-x v L}.
17 110
18@item 111@item
19To keep up with decreasing computer memory capacity and disk space, many 112To keep up with decreasing computer memory capacity and disk space, many
diff --git a/doc/lispintro/ChangeLog b/doc/lispintro/ChangeLog
index 0365a3ca174..2a1d018cc26 100644
--- a/doc/lispintro/ChangeLog
+++ b/doc/lispintro/ChangeLog
@@ -1,3 +1,12 @@
12012-01-19 Juanma Barranquero <lekktu@gmail.com>
2
3 * emacs-lisp-intro.texi (count-words-in-defun):
4 Add missing parenthesis (bug#10544).
5
62012-01-17 Glenn Morris <rgm@gnu.org>
7
8 * emacs-lisp-intro.texi (re-search-forward): Fix typo.
9
12011-11-24 Juanma Barranquero <lekktu@gmail.com> 102011-11-24 Juanma Barranquero <lekktu@gmail.com>
2 11
3 * makefile.w32-in: Update dependencies. 12 * makefile.w32-in: Update dependencies.
diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi
index 0f9b6b906aa..d70ff9f3b44 100644
--- a/doc/lispintro/emacs-lisp-intro.texi
+++ b/doc/lispintro/emacs-lisp-intro.texi
@@ -12607,7 +12607,7 @@ four arguments:
12607@enumerate 12607@enumerate
12608@item 12608@item
12609The first argument is the regular expression that the function searches 12609The first argument is the regular expression that the function searches
12610for. The regular expression will be a string between quotations marks. 12610for. The regular expression will be a string between quotation marks.
12611 12611
12612@item 12612@item
12613The optional second argument limits how far the function will search; it is a 12613The optional second argument limits how far the function will search; it is a
@@ -15012,7 +15012,7 @@ expression for this (@pxref{Syntax}), so the loop is straightforward:
15012@group 15012@group
15013(while (and (< (point) end) 15013(while (and (< (point) end)
15014 (re-search-forward 15014 (re-search-forward
15015 "\\(\\w\\|\\s_\\)+[^ \t\n]*[ \t\n]*" end t) 15015 "\\(\\w\\|\\s_\\)+[^ \t\n]*[ \t\n]*" end t))
15016 (setq count (1+ count))) 15016 (setq count (1+ count)))
15017@end group 15017@end group
15018@end smallexample 15018@end smallexample
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 4b9531c0e6c..b66f82c5738 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,54 @@
12012-01-23 Chong Yidong <cyd@gnu.org>
2
3 * strings.texi (Text Comparison): Minor qualification.
4
5 * lists.texi (Cons Cells): Copyedits.
6 (List Elements): Mention push.
7 (List Variables): Mention pop.
8 (Rings): Move to sequences.texi.
9
10 * sequences.texi (Sequence Functions): Don't repeat the
11 introduction already given in the parent.
12 (Vectors): Copyedits.
13 (Rings): Move from lists.texi. Note that this is specific to the
14 ring package.
15
16 * symbols.texi (Definitions, Symbol Components): Mention variable
17 scoping issues.
18 (Plists and Alists): Copyedits.
19
20 * eval.texi (Intro Eval, Symbol Forms): Minor tweaks for
21 correctness with lexical scoping.
22 (Eval): Copyedits.
23
242012-01-21 Chong Yidong <cyd@gnu.org>
25
26 * intro.texi (A Sample Function Description): Special notation
27 used for macros too.
28
29 * objects.texi (Ctl-Char Syntax, Other Char Bits): Copyedits.
30 (Symbol Type): Add xref for keyword symbols.
31 (Sequence Type): Clarify differences between sequence types.
32 (Cons Cell Type): Add "linked list" index entry.
33 (Non-ASCII in Strings): Copyedits.
34 (Equality Predicates): Symbols with same name need not be eq.
35
36 * numbers.texi (Float Basics): Document isnan, copysign, frexp and
37 ldexp. Move float-e and float-pi to Math Functions node.
38
392012-01-21 Glenn Morris <rgm@gnu.org>
40
41 * modes.texi (Auto Major Mode):
42 * variables.texi (File Local Variables):
43 Mention inhibit-local-variables-regexps.
44
452012-01-19 Martin Rudalics <rudalics@gmx.at>
46
47 * windows.texi (Window Configurations): Rewrite references to
48 persistent window parameters.
49 (Window Parameters): Fix description of persistent window
50 parameters.
51
12012-01-16 Juanma Barranquero <lekktu@gmail.com> 522012-01-16 Juanma Barranquero <lekktu@gmail.com>
2 53
3 * windows.texi (Window Parameters): Use @pxref. 54 * windows.texi (Window Parameters): Use @pxref.
diff --git a/doc/lispref/control.texi b/doc/lispref/control.texi
index e74f3e198bf..0511f21007d 100644
--- a/doc/lispref/control.texi
+++ b/doc/lispref/control.texi
@@ -8,11 +8,11 @@
8@cindex special forms for control structures 8@cindex special forms for control structures
9@cindex control structures 9@cindex control structures
10 10
11 A Lisp program consists of expressions or @dfn{forms} (@pxref{Forms}). 11 A Lisp program consists of a set of @dfn{expressions}, or
12We control the order of execution of these forms by enclosing them in 12@dfn{forms} (@pxref{Forms}). We control the order of execution of
13@dfn{control structures}. Control structures are special forms which 13these forms by enclosing them in @dfn{control structures}. Control
14control when, whether, or how many times to execute the forms they 14structures are special forms which control when, whether, or how many
15contain. 15times to execute the forms they contain.
16 16
17@cindex textual order 17@cindex textual order
18 The simplest order of execution is sequential execution: first form 18 The simplest order of execution is sequential execution: first form
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi
index 0b8d972c1d5..1555b98e7fb 100644
--- a/doc/lispref/elisp.texi
+++ b/doc/lispref/elisp.texi
@@ -326,7 +326,6 @@ Lists
326* Modifying Lists:: Storing new pieces into an existing list. 326* Modifying Lists:: Storing new pieces into an existing list.
327* Sets And Lists:: A list can represent a finite mathematical set. 327* Sets And Lists:: A list can represent a finite mathematical set.
328* Association Lists:: A list can represent a finite relation or mapping. 328* Association Lists:: A list can represent a finite relation or mapping.
329* Rings:: Managing a fixed-size ring of objects.
330 329
331Modifying Existing List Structure 330Modifying Existing List Structure
332 331
@@ -344,6 +343,7 @@ Sequences, Arrays, and Vectors
344* Vector Functions:: Functions specifically for vectors. 343* Vector Functions:: Functions specifically for vectors.
345* Char-Tables:: How to work with char-tables. 344* Char-Tables:: How to work with char-tables.
346* Bool-Vectors:: How to work with bool-vectors. 345* Bool-Vectors:: How to work with bool-vectors.
346* Rings:: Managing a fixed-size ring of objects.
347 347
348Hash Tables 348Hash Tables
349 349
diff --git a/doc/lispref/eval.texi b/doc/lispref/eval.texi
index adb4841a82d..fc18e503543 100644
--- a/doc/lispref/eval.texi
+++ b/doc/lispref/eval.texi
@@ -64,8 +64,8 @@ evaluate a @dfn{function call} form such as @code{(car x)}, Emacs
64first evaluates the argument (the subform @code{x}). After evaluating 64first evaluates the argument (the subform @code{x}). After evaluating
65the argument, Emacs @dfn{executes} the function (@code{car}), and if 65the argument, Emacs @dfn{executes} the function (@code{car}), and if
66the function is written in Lisp, execution works by evaluating the 66the function is written in Lisp, execution works by evaluating the
67@dfn{body} of the function. (In this example, however, @code{car} is 67@dfn{body} of the function (in this example, however, @code{car} is
68not a Lisp function; it is a primitive function implemented in C.) 68not a Lisp function; it is a primitive function implemented in C).
69@xref{Functions}, for more information about functions and function 69@xref{Functions}, for more information about functions and function
70calls. 70calls.
71 71
@@ -77,9 +77,8 @@ variables (@pxref{Variables}).@footnote{This definition of
77that can affect the result of a program.} Whenever a form refers to a 77that can affect the result of a program.} Whenever a form refers to a
78variable without creating a new binding for it, the variable evaluates 78variable without creating a new binding for it, the variable evaluates
79to the value given by the current environment. Evaluating a form may 79to the value given by the current environment. Evaluating a form may
80create a new environment for recursive evaluation, by binding 80also temporarily alter the environment by binding variables
81variables (@pxref{Local Variables}). Such environments are temporary, 81(@pxref{Local Variables}).
82and vanish when the evaluation of the form is complete.
83 82
84@cindex side effect 83@cindex side effect
85 Evaluating a form may also make changes that persist; these changes 84 Evaluating a form may also make changes that persist; these changes
@@ -177,9 +176,9 @@ program. Here is an example:
177@cindex symbol evaluation 176@cindex symbol evaluation
178 177
179 When a symbol is evaluated, it is treated as a variable. The result 178 When a symbol is evaluated, it is treated as a variable. The result
180is the variable's value, if it has one. If it has none (if its value 179is the variable's value, if it has one. If the symbol has no value as
181cell is void), an error is signaled. For more information on the use of 180a variable, the Lisp interpreter signals an error. For more
182variables, see @ref{Variables}. 181information on the use of variables, see @ref{Variables}.
183 182
184 In the following example, we set the value of a symbol with 183 In the following example, we set the value of a symbol with
185@code{setq}. Then we evaluate the symbol, and get back the value that 184@code{setq}. Then we evaluate the symbol, and get back the value that
@@ -602,12 +601,13 @@ functions provides the ability to pass information to them as
602arguments. 601arguments.
603 602
604@defun eval form &optional lexical 603@defun eval form &optional lexical
605This is the basic function evaluating an expression. It evaluates 604This is the basic function for evaluating an expression. It evaluates
606@var{form} in the current environment and returns the result. How the 605@var{form} in the current environment and returns the result. How the
607evaluation proceeds depends on the type of the object (@pxref{Forms}). 606evaluation proceeds depends on the type of the object (@pxref{Forms}).
608@var{lexical} if non-nil means to evaluate @var{form} using lexical scoping 607
609rules (@pxref{Lexical Binding}) instead of the default dynamic scoping used 608The argument @var{lexical}, if non-@code{nil}, means to evaluate
610historically in Emacs Lisp. 609@var{form} using lexical scoping rules for variables, instead of the
610default dynamic scoping rules. @xref{Lexical Binding}.
611 611
612Since @code{eval} is a function, the argument expression that appears 612Since @code{eval} is a function, the argument expression that appears
613in a call to @code{eval} is evaluated twice: once as preparation before 613in a call to @code{eval} is evaluated twice: once as preparation before
diff --git a/doc/lispref/intro.texi b/doc/lispref/intro.texi
index 64c856d3ed4..a68bcfa0fe7 100644
--- a/doc/lispref/intro.texi
+++ b/doc/lispref/intro.texi
@@ -162,7 +162,7 @@ being described, are formatted like this: @var{first-number}.
162 162
163@cindex @code{nil} 163@cindex @code{nil}
164@cindex false 164@cindex false
165 In Lisp, the symbol @code{nil} has three separate meanings: it 165 In Emacs Lisp, the symbol @code{nil} has three separate meanings: it
166is a symbol with the name @samp{nil}; it is the logical truth value 166is a symbol with the name @samp{nil}; it is the logical truth value
167@var{false}; and it is the empty list---the list of zero elements. 167@var{false}; and it is the empty list---the list of zero elements.
168When used as a variable, @code{nil} always has the value @code{nil}. 168When used as a variable, @code{nil} always has the value @code{nil}.
@@ -396,13 +396,14 @@ Form', respectively. Commands are simply functions that may be called
396interactively; macros process their arguments differently from functions 396interactively; macros process their arguments differently from functions
397(the arguments are not evaluated), but are presented the same way. 397(the arguments are not evaluated), but are presented the same way.
398 398
399 Special form descriptions use a more complex notation to specify 399 The descriptions of macros and special forms use a more complex
400optional and repeated arguments because they can break the argument 400notation to specify optional and repeated arguments, because they can
401list down into separate arguments in more complicated ways. 401break the argument list down into separate arguments in more
402@samp{@r{[}@var{optional-arg}@r{]}} means that @var{optional-arg} is 402complicated ways. @samp{@r{[}@var{optional-arg}@r{]}} means that
403optional and @samp{@var{repeated-args}@dots{}} stands for zero or more 403@var{optional-arg} is optional and @samp{@var{repeated-args}@dots{}}
404arguments. Parentheses are used when several arguments are grouped into 404stands for zero or more arguments. Parentheses are used when several
405additional levels of list structure. Here is an example: 405arguments are grouped into additional levels of list structure. Here
406is an example:
406 407
407@defspec count-loop (@var{var} [@var{from} @var{to} [@var{inc}]]) @var{body}@dots{} 408@defspec count-loop (@var{var} [@var{from} @var{to} [@var{inc}]]) @var{body}@dots{}
408This imaginary special form implements a loop that executes the 409This imaginary special form implements a loop that executes the
@@ -485,9 +486,9 @@ giving a prefix argument makes @var{here} non-@code{nil}.
485@end deffn 486@end deffn
486 487
487@defvar emacs-build-time 488@defvar emacs-build-time
488The value of this variable indicates the time at which Emacs was built 489The value of this variable indicates the time at which Emacs was
489at the local site. It is a list of three integers, like the value 490built. It is a list of three integers, like the value of
490of @code{current-time} (@pxref{Time of Day}). 491@code{current-time} (@pxref{Time of Day}).
491 492
492@example 493@example
493@group 494@group
diff --git a/doc/lispref/lists.texi b/doc/lispref/lists.texi
index eb9ddf58603..c8433c79b54 100644
--- a/doc/lispref/lists.texi
+++ b/doc/lispref/lists.texi
@@ -23,7 +23,6 @@ the whole list.
23* Modifying Lists:: Storing new pieces into an existing list. 23* Modifying Lists:: Storing new pieces into an existing list.
24* Sets And Lists:: A list can represent a finite mathematical set. 24* Sets And Lists:: A list can represent a finite mathematical set.
25* Association Lists:: A list can represent a finite relation or mapping. 25* Association Lists:: A list can represent a finite relation or mapping.
26* Rings:: Managing a fixed-size ring of objects.
27@end menu 26@end menu
28 27
29@node Cons Cells 28@node Cons Cells
@@ -31,61 +30,56 @@ the whole list.
31@cindex lists and cons cells 30@cindex lists and cons cells
32 31
33 Lists in Lisp are not a primitive data type; they are built up from 32 Lists in Lisp are not a primitive data type; they are built up from
34@dfn{cons cells}. A cons cell is a data object that represents an 33@dfn{cons cells} (@pxref{Cons Cell Type}). A cons cell is a data
35ordered pair. That is, it has two slots, and each slot @dfn{holds}, or 34object that represents an ordered pair. That is, it has two slots,
36@dfn{refers to}, some Lisp object. One slot is known as the @sc{car}, 35and each slot @dfn{holds}, or @dfn{refers to}, some Lisp object. One
37and the other is known as the @sc{cdr}. (These names are traditional; 36slot is known as the @sc{car}, and the other is known as the @sc{cdr}.
38see @ref{Cons Cell Type}.) @sc{cdr} is pronounced ``could-er.'' 37(These names are traditional; see @ref{Cons Cell Type}.) @sc{cdr} is
38pronounced ``could-er.''
39 39
40 We say that ``the @sc{car} of this cons cell is'' whatever object 40 We say that ``the @sc{car} of this cons cell is'' whatever object
41its @sc{car} slot currently holds, and likewise for the @sc{cdr}. 41its @sc{car} slot currently holds, and likewise for the @sc{cdr}.
42 42
43 A list is a series of cons cells ``chained together,'' so that each 43 A list is a series of cons cells ``chained together,'' so that each
44cell refers to the next one. There is one cons cell for each element of 44cell refers to the next one. There is one cons cell for each element
45the list. By convention, the @sc{car}s of the cons cells hold the 45of the list. By convention, the @sc{car}s of the cons cells hold the
46elements of the list, and the @sc{cdr}s are used to chain the list: the 46elements of the list, and the @sc{cdr}s are used to chain the list
47@sc{cdr} slot of each cons cell refers to the following cons cell. The 47(this asymmetry between @sc{car} and @sc{cdr} is entirely a matter of
48@sc{cdr} of the last cons cell is @code{nil}. This asymmetry between 48convention; at the level of cons cells, the @sc{car} and @sc{cdr}
49the @sc{car} and the @sc{cdr} is entirely a matter of convention; at the 49slots have similar properties). Hence, the @sc{cdr} slot of each cons
50level of cons cells, the @sc{car} and @sc{cdr} slots have the same 50cell in a list refers to the following cons cell.
51characteristics.
52 51
53@cindex true list 52@cindex true list
54 Since @code{nil} is the conventional value to put in the @sc{cdr} of 53 Also by convention, the @sc{cdr} of the last cons cell in a list is
55the last cons cell in the list, we call that case a @dfn{true list}. 54@code{nil}. We call such a @code{nil}-terminated structure a
56 55@dfn{true list}. In Emacs Lisp, the symbol @code{nil} is both a
57 In Lisp, we consider the symbol @code{nil} a list as well as a 56symbol and a list with no elements. For convenience, the symbol
58symbol; it is the list with no elements. For convenience, the symbol
59@code{nil} is considered to have @code{nil} as its @sc{cdr} (and also 57@code{nil} is considered to have @code{nil} as its @sc{cdr} (and also
60as its @sc{car}). Therefore, the @sc{cdr} of a true list is always a 58as its @sc{car}).
61true list. 59
60 Hence, the @sc{cdr} of a true list is always a true list. The
61@sc{cdr} of a nonempty true list is a true list containing all the
62elements except the first.
62 63
63@cindex dotted list 64@cindex dotted list
64@cindex circular list 65@cindex circular list
65 If the @sc{cdr} of a list's last cons cell is some other value, 66 If the @sc{cdr} of a list's last cons cell is some value other than
66neither @code{nil} nor another cons cell, we call the structure a 67@code{nil}, we call the structure a @dfn{dotted list}, since its
67@dfn{dotted list}, since its printed representation would use 68printed representation would use dotted pair notation (@pxref{Dotted
68@samp{.}. There is one other possibility: some cons cell's @sc{cdr} 69Pair Notation}). There is one other possibility: some cons cell's
69could point to one of the previous cons cells in the list. We call 70@sc{cdr} could point to one of the previous cons cells in the list.
70that structure a @dfn{circular list}. 71We call that structure a @dfn{circular list}.
71 72
72 For some purposes, it does not matter whether a list is true, 73 For some purposes, it does not matter whether a list is true,
73circular or dotted. If the program doesn't look far enough down the 74circular or dotted. If a program doesn't look far enough down the
74list to see the @sc{cdr} of the final cons cell, it won't care. 75list to see the @sc{cdr} of the final cons cell, it won't care.
75However, some functions that operate on lists demand true lists and 76However, some functions that operate on lists demand true lists and
76signal errors if given a dotted list. Most functions that try to find 77signal errors if given a dotted list. Most functions that try to find
77the end of a list enter infinite loops if given a circular list. 78the end of a list enter infinite loops if given a circular list.
78 79
79@cindex list structure 80@cindex list structure
80 Because most cons cells are used as part of lists, the phrase 81 Because most cons cells are used as part of lists, we refer to any
81@dfn{list structure} has come to mean any structure made out of cons 82structure made out of cons cells as a @dfn{list structure}.
82cells.
83
84 The @sc{cdr} of any nonempty true list @var{l} is a list containing all the
85elements of @var{l} except the first.
86
87 @xref{Cons Cell Type}, for the read and print syntax of cons cells and
88lists, and for ``box and arrow'' illustrations of lists.
89 83
90@node List-related Predicates 84@node List-related Predicates
91@section Predicates on Lists 85@section Predicates on Lists
@@ -257,6 +251,10 @@ x
257x 251x
258 @result{} (b c) 252 @result{} (b c)
259@end example 253@end example
254
255@noindent
256For the @code{pop} macro, which removes an element from a list,
257@xref{List Variables}.
260@end defmac 258@end defmac
261 259
262@defun nth n list 260@defun nth n list
@@ -695,6 +693,10 @@ This macro provides an alternative way to write
695l 693l
696 @result{} (c a b) 694 @result{} (c a b)
697@end example 695@end example
696
697@noindent
698For the @code{pop} macro, which removes the first element from a list,
699@xref{List Elements}.
698@end defmac 700@end defmac
699 701
700 Two functions modify lists that are the values of variables. 702 Two functions modify lists that are the values of variables.
@@ -1800,90 +1802,3 @@ often modifies the original list structure of @var{alist}.
1800compares the @sc{cdr} of each @var{alist} association instead of the 1802compares the @sc{cdr} of each @var{alist} association instead of the
1801@sc{car}. 1803@sc{car}.
1802@end defun 1804@end defun
1803
1804@node Rings
1805@section Managing a Fixed-Size Ring of Objects
1806
1807@cindex ring data structure
1808 This section describes functions for operating on rings. A
1809@dfn{ring} is a fixed-size data structure that supports insertion,
1810deletion, rotation, and modulo-indexed reference and traversal.
1811
1812@defun make-ring size
1813This returns a new ring capable of holding @var{size} objects.
1814@var{size} should be an integer.
1815@end defun
1816
1817@defun ring-p object
1818This returns @code{t} if @var{object} is a ring, @code{nil} otherwise.
1819@end defun
1820
1821@defun ring-size ring
1822This returns the maximum capacity of the @var{ring}.
1823@end defun
1824
1825@defun ring-length ring
1826This returns the number of objects that @var{ring} currently contains.
1827The value will never exceed that returned by @code{ring-size}.
1828@end defun
1829
1830@defun ring-elements ring
1831This returns a list of the objects in @var{ring}, in order, newest first.
1832@end defun
1833
1834@defun ring-copy ring
1835This returns a new ring which is a copy of @var{ring}.
1836The new ring contains the same (@code{eq}) objects as @var{ring}.
1837@end defun
1838
1839@defun ring-empty-p ring
1840This returns @code{t} if @var{ring} is empty, @code{nil} otherwise.
1841@end defun
1842
1843 The newest element in the ring always has index 0. Higher indices
1844correspond to older elements. Indices are computed modulo the ring
1845length. Index @minus{}1 corresponds to the oldest element, @minus{}2
1846to the next-oldest, and so forth.
1847
1848@defun ring-ref ring index
1849This returns the object in @var{ring} found at index @var{index}.
1850@var{index} may be negative or greater than the ring length. If
1851@var{ring} is empty, @code{ring-ref} signals an error.
1852@end defun
1853
1854@defun ring-insert ring object
1855This inserts @var{object} into @var{ring}, making it the newest
1856element, and returns @var{object}.
1857
1858If the ring is full, insertion removes the oldest element to
1859make room for the new element.
1860@end defun
1861
1862@defun ring-remove ring &optional index
1863Remove an object from @var{ring}, and return that object. The
1864argument @var{index} specifies which item to remove; if it is
1865@code{nil}, that means to remove the oldest item. If @var{ring} is
1866empty, @code{ring-remove} signals an error.
1867@end defun
1868
1869@defun ring-insert-at-beginning ring object
1870This inserts @var{object} into @var{ring}, treating it as the oldest
1871element. The return value is not significant.
1872
1873If the ring is full, this function removes the newest element to make
1874room for the inserted element.
1875@end defun
1876
1877@cindex fifo data structure
1878 If you are careful not to exceed the ring size, you can
1879use the ring as a first-in-first-out queue. For example:
1880
1881@lisp
1882(let ((fifo (make-ring 5)))
1883 (mapc (lambda (obj) (ring-insert fifo obj))
1884 '(0 one "two"))
1885 (list (ring-remove fifo) t
1886 (ring-remove fifo) t
1887 (ring-remove fifo)))
1888 @result{} (0 t one t "two")
1889@end lisp
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi
index 5d09b79748e..b3aac231d5b 100644
--- a/doc/lispref/modes.texi
+++ b/doc/lispref/modes.texi
@@ -588,6 +588,18 @@ Chosen, emacs, The GNU Emacs Manual}. If @code{enable-local-variables}
588is @code{nil}, @code{set-auto-mode} does not check the @w{@samp{-*-}} 588is @code{nil}, @code{set-auto-mode} does not check the @w{@samp{-*-}}
589line, or near the end of the file, for any mode tag. 589line, or near the end of the file, for any mode tag.
590 590
591@vindex inhibit-local-variables-regexps
592There are some file types where it is not appropriate to scan the file
593contents for a mode specifier. For example, a tar archive may happen to
594contain, near the end of the file, a member file that has a local
595variables section specifying a mode for that particular file. This
596should not be applied to the containing tar file. Similarly, a tiff
597image file might just happen to contain a first line that seems to
598match the @w{@samp{-*-}} pattern. For these reasons, both these file
599extensions are members of the list @var{inhibit-local-variables-regexps}.
600Add patterns to this list to prevent Emacs searching them for local
601variables of any kind (not just mode specifiers).
602
591If @var{keep-mode-if-same} is non-@code{nil}, this function does not 603If @var{keep-mode-if-same} is non-@code{nil}, this function does not
592call the mode command if the buffer is already in the proper major 604call the mode command if the buffer is already in the proper major
593mode. For instance, @code{set-visited-file-name} sets this to 605mode. For instance, @code{set-visited-file-name} sets this to
diff --git a/doc/lispref/numbers.texi b/doc/lispref/numbers.texi
index 6768ecece9c..77db0f86c26 100644
--- a/doc/lispref/numbers.texi
+++ b/doc/lispref/numbers.texi
@@ -168,34 +168,37 @@ character codepoint.
168@node Float Basics 168@node Float Basics
169@section Floating Point Basics 169@section Floating Point Basics
170 170
171@cindex @acronym{IEEE} floating point
171 Floating point numbers are useful for representing numbers that are 172 Floating point numbers are useful for representing numbers that are
172not integral. The precise range of floating point numbers is 173not integral. The precise range of floating point numbers is
173machine-specific; it is the same as the range of the C data type 174machine-specific; it is the same as the range of the C data type
174@code{double} on the machine you are using. 175@code{double} on the machine you are using. Emacs uses the
176@acronym{IEEE} floating point standard where possible (the standard is
177supported by most modern computers).
175 178
176 The read-syntax for floating point numbers requires either a decimal 179 The read syntax for floating point numbers requires either a decimal
177point (with at least one digit following), an exponent, or both. For 180point (with at least one digit following), an exponent, or both. For
178example, @samp{1500.0}, @samp{15e2}, @samp{15.0e2}, @samp{1.5e3}, and 181example, @samp{1500.0}, @samp{15e2}, @samp{15.0e2}, @samp{1.5e3}, and
179@samp{.15e4} are five ways of writing a floating point number whose 182@samp{.15e4} are five ways of writing a floating point number whose
180value is 1500. They are all equivalent. You can also use a minus sign 183value is 1500. They are all equivalent. You can also use a minus
181to write negative floating point numbers, as in @samp{-1.0}. 184sign to write negative floating point numbers, as in @samp{-1.0}.
185
186 Emacs Lisp treats @code{-0.0} as equal to ordinary zero (with
187respect to @code{equal} and @code{=}), even though the two are
188distinguishable in the @acronym{IEEE} floating point standard.
182 189
183@cindex @acronym{IEEE} floating point
184@cindex positive infinity 190@cindex positive infinity
185@cindex negative infinity 191@cindex negative infinity
186@cindex infinity 192@cindex infinity
187@cindex NaN 193@cindex NaN
188 Most modern computers support the @acronym{IEEE} floating point standard, 194 The @acronym{IEEE} floating point standard supports positive
189which provides for positive infinity and negative infinity as floating point 195infinity and negative infinity as floating point values. It also
190values. It also provides for a class of values called NaN or 196provides for a class of values called NaN or ``not-a-number'';
191``not-a-number''; numerical functions return such values in cases where 197numerical functions return such values in cases where there is no
192there is no correct answer. For example, @code{(/ 0.0 0.0)} returns a 198correct answer. For example, @code{(/ 0.0 0.0)} returns a NaN. (NaN
193NaN. For practical purposes, there's no significant difference between 199values can also carry a sign, but for practical purposes there's no
194different NaN values in Emacs Lisp, and there's no rule for precisely 200significant difference between different NaN values in Emacs Lisp.)
195which NaN value should be used in a particular case, so Emacs Lisp 201Here are the read syntaxes for these special floating point values:
196doesn't try to distinguish them (but it does report the sign, if you
197print it). Here are the read syntaxes for these special floating
198point values:
199 202
200@table @asis 203@table @asis
201@item positive infinity 204@item positive infinity
@@ -206,16 +209,37 @@ point values:
206@samp{0.0e+NaN} or @samp{-0.0e+NaN}. 209@samp{0.0e+NaN} or @samp{-0.0e+NaN}.
207@end table 210@end table
208 211
209 To test whether a floating point value is a NaN, compare it with 212@defun isnan number
210itself using @code{=}. That returns @code{nil} for a NaN, and 213This predicate tests whether its argument is NaN, and returns @code{t}
211@code{t} for any other floating point value. 214if so, @code{nil} otherwise. The argument must be a number.
215@end defun
216
217 The following functions are specialized for handling floating point
218numbers:
219
220@defun frexp x
221This function returns a cons cell @code{(@var{sig} . @var{exp})},
222where @var{sig} and @var{exp} are respectively the significand and
223exponent of the floating point number @var{x}:
224
225@smallexample
226@var{x} = @var{sig} * 2^@var{exp}
227@end smallexample
228
229@var{sig} is a floating point number between 0.5 (inclusive) and 1.0
230(exclusive). If @var{x} is zero, the return value is @code{(0 . 0)}.
231@end defun
212 232
213 The value @code{-0.0} is distinguishable from ordinary zero in 233@defun ldexp sig &optional exp
214@acronym{IEEE} floating point, but Emacs Lisp @code{equal} and 234This function returns a floating point number corresponding to the
215@code{=} consider them equal values. 235significand @var{sig} and exponent @var{exp}.
236@end defun
216 237
217 You can use @code{logb} to extract the binary exponent of a floating 238@defun copysign x1 x2
218point number (or estimate the logarithm of an integer): 239This function copies the sign of @var{x2} to the value of @var{x1},
240and returns the result. @var{x1} and @var{x2} must be floating point
241numbers.
242@end defun
219 243
220@defun logb number 244@defun logb number
221This function returns the binary exponent of @var{number}. More 245This function returns the binary exponent of @var{number}. More
@@ -230,14 +254,6 @@ down to an integer.
230@end example 254@end example
231@end defun 255@end defun
232 256
233@defvar float-e
234The mathematical constant @math{e} (2.71828@dots{}).
235@end defvar
236
237@defvar float-pi
238The mathematical constant @math{pi} (3.14159@dots{}).
239@end defvar
240
241@node Predicates on Numbers 257@node Predicates on Numbers
242@section Type Predicates for Numbers 258@section Type Predicates for Numbers
243@cindex predicates for numbers 259@cindex predicates for numbers
@@ -1122,35 +1138,15 @@ angle in radians between the vector @code{[@var{x}, @var{y}]} and the
1122@end defun 1138@end defun
1123 1139
1124@defun exp arg 1140@defun exp arg
1125This is the exponential function; it returns 1141This is the exponential function; it returns @math{e} to the power
1126@tex 1142@var{arg}.
1127@math{e}
1128@end tex
1129@ifnottex
1130@i{e}
1131@end ifnottex
1132to the power @var{arg}.
1133@tex
1134@math{e}
1135@end tex
1136@ifnottex
1137@i{e}
1138@end ifnottex
1139is a fundamental mathematical constant also called the base of natural
1140logarithms.
1141@end defun 1143@end defun
1142 1144
1143@defun log arg &optional base 1145@defun log arg &optional base
1144This function returns the logarithm of @var{arg}, with base @var{base}. 1146This function returns the logarithm of @var{arg}, with base
1145If you don't specify @var{base}, the base 1147@var{base}. If you don't specify @var{base}, the natural base
1146@tex 1148@math{e} is used. If @var{arg} is negative, it signals a
1147@math{e} 1149@code{domain-error} error.
1148@end tex
1149@ifnottex
1150@i{e}
1151@end ifnottex
1152is used. If @var{arg} is negative, it signals a @code{domain-error}
1153error.
1154@end defun 1150@end defun
1155 1151
1156@ignore 1152@ignore
@@ -1185,6 +1181,17 @@ This returns the square root of @var{arg}. If @var{arg} is negative,
1185it signals a @code{domain-error} error. 1181it signals a @code{domain-error} error.
1186@end defun 1182@end defun
1187 1183
1184In addition, Emacs defines the following common mathematical
1185constants:
1186
1187@defvar float-e
1188The mathematical constant @math{e} (2.71828@dots{}).
1189@end defvar
1190
1191@defvar float-pi
1192The mathematical constant @math{pi} (3.14159@dots{}).
1193@end defvar
1194
1188@node Random Numbers 1195@node Random Numbers
1189@section Random Numbers 1196@section Random Numbers
1190@cindex random numbers 1197@cindex random numbers
@@ -1218,7 +1225,6 @@ nonnegative and less than @var{limit}.
1218 1225
1219If @var{limit} is @code{t}, it means to choose a new seed based on the 1226If @var{limit} is @code{t}, it means to choose a new seed based on the
1220current time of day and on Emacs's process @acronym{ID} number. 1227current time of day and on Emacs's process @acronym{ID} number.
1221@c "Emacs'" is incorrect usage!
1222 1228
1223On some machines, any integer representable in Lisp may be the result 1229On some machines, any integer representable in Lisp may be the result
1224of @code{random}. On other machines, the result can never be larger 1230of @code{random}. On other machines, the result can never be larger
diff --git a/doc/lispref/objects.texi b/doc/lispref/objects.texi
index 3fb676edcd4..87bcc20daba 100644
--- a/doc/lispref/objects.texi
+++ b/doc/lispref/objects.texi
@@ -427,10 +427,10 @@ codes for these non-@acronym{ASCII} control characters include the
427@ifnottex 427@ifnottex
4282**26 4282**26
429@end ifnottex 429@end ifnottex
430bit as well as the code for the corresponding non-control 430bit as well as the code for the corresponding non-control character.
431character. Ordinary terminals have no way of generating non-@acronym{ASCII} 431Ordinary text terminals have no way of generating non-@acronym{ASCII}
432control characters, but you can generate them straightforwardly using X 432control characters, but you can generate them straightforwardly using
433and other window systems. 433X and other window systems.
434 434
435 For historical reasons, Emacs treats the @key{DEL} character as 435 For historical reasons, Emacs treats the @key{DEL} character as
436the control equivalent of @kbd{?}: 436the control equivalent of @kbd{?}:
@@ -501,10 +501,10 @@ character is upper case or lower case. Emacs uses the
501@end ifnottex 501@end ifnottex
502bit to indicate that the shift key was used in typing a control 502bit to indicate that the shift key was used in typing a control
503character. This distinction is possible only when you use X terminals 503character. This distinction is possible only when you use X terminals
504or other special terminals; ordinary terminals do not report the 504or other special terminals; ordinary text terminals do not report the
505distinction to the computer in any way. The Lisp syntax for 505distinction. The Lisp syntax for the shift bit is @samp{\S-}; thus,
506the shift bit is @samp{\S-}; thus, @samp{?\C-\S-o} or @samp{?\C-\S-O} 506@samp{?\C-\S-o} or @samp{?\C-\S-O} represents the shifted-control-o
507represents the shifted-control-o character. 507character.
508 508
509@cindex hyper characters 509@cindex hyper characters
510@cindex super characters 510@cindex super characters
@@ -541,9 +541,9 @@ intended. But you can use one symbol in all of these ways,
541independently. 541independently.
542 542
543 A symbol whose name starts with a colon (@samp{:}) is called a 543 A symbol whose name starts with a colon (@samp{:}) is called a
544@dfn{keyword symbol}. These symbols automatically act as constants, and 544@dfn{keyword symbol}. These symbols automatically act as constants,
545are normally used only by comparing an unknown symbol with a few 545and are normally used only by comparing an unknown symbol with a few
546specific alternatives. 546specific alternatives. @xref{Constant Variables}.
547 547
548@cindex @samp{\} in symbols 548@cindex @samp{\} in symbols
549@cindex backslash in symbols 549@cindex backslash in symbols
@@ -617,26 +617,28 @@ all symbols; @pxref{Creating Symbols}.)
617@subsection Sequence Types 617@subsection Sequence Types
618 618
619 A @dfn{sequence} is a Lisp object that represents an ordered set of 619 A @dfn{sequence} is a Lisp object that represents an ordered set of
620elements. There are two kinds of sequence in Emacs Lisp, lists and 620elements. There are two kinds of sequence in Emacs Lisp: @dfn{lists}
621arrays. Thus, an object of type list or of type array is also 621and @dfn{arrays}.
622considered a sequence. 622
623 623 Lists are the most commonly-used sequences. A list can hold
624 Arrays are further subdivided into strings, vectors, char-tables and 624elements of any type, and its length can be easily changed by adding
625bool-vectors. Vectors can hold elements of any type, but string 625or removing elements. See the next subsection for more about lists.
626elements must be characters, and bool-vector elements must be @code{t} 626
627or @code{nil}. Char-tables are like vectors except that they are 627 Arrays are fixed-length sequences. They are further subdivided into
628indexed by any valid character code. The characters in a string can 628strings, vectors, char-tables and bool-vectors. Vectors can hold
629have text properties like characters in a buffer (@pxref{Text 629elements of any type, whereas string elements must be characters, and
630Properties}), but vectors do not support text properties, even when 630bool-vector elements must be @code{t} or @code{nil}. Char-tables are
631their elements happen to be characters. 631like vectors except that they are indexed by any valid character code.
632 632The characters in a string can have text properties like characters in
633 Lists, strings and the other array types are different, but they have 633a buffer (@pxref{Text Properties}), but vectors do not support text
634important similarities. For example, all have a length @var{l}, and all 634properties, even when their elements happen to be characters.
635have elements which can be indexed from zero to @var{l} minus one. 635
636Several functions, called sequence functions, accept any kind of 636 Lists, strings and the other array types also share important
637sequence. For example, the function @code{elt} can be used to extract 637similarities. For example, all have a length @var{l}, and all have
638an element of a sequence, given its index. @xref{Sequences Arrays 638elements which can be indexed from zero to @var{l} minus one. Several
639Vectors}. 639functions, called sequence functions, accept any kind of sequence.
640For example, the function @code{length} reports the length of any kind
641of sequence. @xref{Sequences Arrays Vectors}.
640 642
641 It is generally impossible to read the same sequence twice, since 643 It is generally impossible to read the same sequence twice, since
642sequences are always created anew upon reading. If you read the read 644sequences are always created anew upon reading. If you read the read
@@ -650,24 +652,27 @@ same object, @code{nil}.
650@cindex decrement field of register 652@cindex decrement field of register
651@cindex pointers 653@cindex pointers
652 654
653 A @dfn{cons cell} is an object that consists of two slots, called the 655 A @dfn{cons cell} is an object that consists of two slots, called
654@sc{car} slot and the @sc{cdr} slot. Each slot can @dfn{hold} or 656the @sc{car} slot and the @sc{cdr} slot. Each slot can @dfn{hold} any
655@dfn{refer to} any Lisp object. We also say that ``the @sc{car} of 657Lisp object. We also say that ``the @sc{car} of this cons cell is''
656this cons cell is'' whatever object its @sc{car} slot currently holds, 658whatever object its @sc{car} slot currently holds, and likewise for
657and likewise for the @sc{cdr}. 659the @sc{cdr}.
658
659@quotation
660A note to C programmers: in Lisp, we do not distinguish between
661``holding'' a value and ``pointing to'' the value, because pointers in
662Lisp are implicit.
663@end quotation
664 660
661@cindex list structure
665 A @dfn{list} is a series of cons cells, linked together so that the 662 A @dfn{list} is a series of cons cells, linked together so that the
666@sc{cdr} slot of each cons cell holds either the next cons cell or the 663@sc{cdr} slot of each cons cell holds either the next cons cell or the
667empty list. The empty list is actually the symbol @code{nil}. 664empty list. The empty list is actually the symbol @code{nil}.
668@xref{Lists}, for functions that work on lists. Because most cons 665@xref{Lists}, for details. Because most cons cells are used as part
669cells are used as part of lists, the phrase @dfn{list structure} has 666of lists, we refer to any structure made out of cons cells as a
670come to refer to any structure made out of cons cells. 667@dfn{list structure}.
668
669@cindex linked list
670@quotation
671A note to C programmers: a Lisp list thus works as a @dfn{linked list}
672built up of cons cells. Because pointers in Lisp are implicit, we do
673not distinguish between a cons cell slot ``holding'' a value versus
674``pointing to'' the value.
675@end quotation
671 676
672@cindex atoms 677@cindex atoms
673 Because cons cells are so central to Lisp, we also have a word for 678 Because cons cells are so central to Lisp, we also have a word for
@@ -1025,40 +1030,40 @@ but the newline is ignored if escaped."
1025@node Non-ASCII in Strings 1030@node Non-ASCII in Strings
1026@subsubsection Non-@acronym{ASCII} Characters in Strings 1031@subsubsection Non-@acronym{ASCII} Characters in Strings
1027 1032
1028 You can include a non-@acronym{ASCII} international character in a string 1033 You can include a non-@acronym{ASCII} international character in a
1029constant by writing it literally. There are two text representations 1034string constant by writing it literally. There are two text
1030for non-@acronym{ASCII} characters in Emacs strings (and in buffers): unibyte 1035representations for non-@acronym{ASCII} characters in Emacs strings
1031and multibyte. If the string constant is read from a multibyte source, 1036(and in buffers): unibyte and multibyte (@pxref{Text
1032such as a multibyte buffer or string, or a file that would be visited as 1037Representations}). If the string constant is read from a multibyte
1033multibyte, then the character is read as a multibyte character, and that 1038source, such as a multibyte buffer or string, or a file that would be
1034makes the string multibyte. If the string constant is read from a 1039visited as multibyte, then Emacs reads the non-@acronym{ASCII}
1035unibyte source, then the character is read as unibyte and that makes the 1040character as a multibyte character and automatically makes the string
1036string unibyte. 1041a multibyte string. If the string constant is read from a unibyte
1037 1042source, then Emacs reads the non-@acronym{ASCII} character as unibyte,
1038 You can also represent a multibyte non-@acronym{ASCII} character with its 1043and makes the string unibyte.
1039character code: use a hex escape, @samp{\x@var{nnnnnnn}}, with as many 1044
1040digits as necessary. (Multibyte non-@acronym{ASCII} character codes are all 1045 Instead of writing a non-@acronym{ASCII} character literally into a
1041greater than 256.) Any character which is not a valid hex digit 1046multibyte string, you can write it as its character code using a hex
1042terminates this construct. If the next character in the string could be 1047escape, @samp{\x@var{nnnnnnn}}, with as many digits as necessary.
1043interpreted as a hex digit, write @w{@samp{\ }} (backslash and space) to 1048(Multibyte non-@acronym{ASCII} character codes are all greater than
1044terminate the hex escape---for example, @w{@samp{\xe0\ }} represents 1049256.) You can also specify a character in a multibyte string using
1045one character, @samp{a} with grave accent. @w{@samp{\ }} in a string 1050the @samp{\u} or @samp{\U} Unicode escape syntax (@pxref{General
1046constant is just like backslash-newline; it does not contribute any 1051Escape Syntax}). In either case, any character which is not a valid
1047character to the string, but it does terminate the preceding hex escape. 1052hex digit terminates the construct. If the next character in the
1053string could be interpreted as a hex digit, write @w{@samp{\ }}
1054(backslash and space) to terminate the hex escape---for example,
1055@w{@samp{\xe0\ }} represents one character, @samp{a} with grave
1056accent. @w{@samp{\ }} in a string constant is just like
1057backslash-newline; it does not contribute any character to the string,
1058but it does terminate the preceding hex escape. Using any hex escape
1059in a string (even for an @acronym{ASCII} character) automatically
1060forces the string to be multibyte.
1048 1061
1049 You can represent a unibyte non-@acronym{ASCII} character with its 1062 You can represent a unibyte non-@acronym{ASCII} character with its
1050character code, which must be in the range from 128 (0200 octal) to 1063character code, which must be in the range from 128 (0200 octal) to
1051255 (0377 octal). If you write all such character codes in octal and 1064255 (0377 octal). If you write all such character codes in octal and
1052the string contains no other characters forcing it to be multibyte, 1065the string contains no other characters forcing it to be multibyte,
1053this produces a unibyte string. However, using any hex escape in a 1066this produces a unibyte string.
1054string (even for an @acronym{ASCII} character) forces the string to be
1055multibyte.
1056
1057 You can also specify characters in a string by their numeric values
1058in Unicode, using @samp{\u} and @samp{\U} (@pxref{Character Type}).
1059
1060 @xref{Text Representations}, for more information about the two
1061text representations.
1062 1067
1063@node Nonprinting Characters 1068@node Nonprinting Characters
1064@subsubsection Nonprinting Characters in Strings 1069@subsubsection Nonprinting Characters in Strings
@@ -1922,23 +1927,24 @@ This function returns a symbol naming the primitive type of
1922@section Equality Predicates 1927@section Equality Predicates
1923@cindex equality 1928@cindex equality
1924 1929
1925 Here we describe functions that test for equality between any two 1930 Here we describe functions that test for equality between two
1926objects. Other functions test equality of contents between objects of specific 1931objects. Other functions test equality of contents between objects of
1927types, e.g., strings. For these predicates, see the appropriate chapter 1932specific types, e.g.@: strings. For these predicates, see the
1928describing the data type. 1933appropriate chapter describing the data type.
1929 1934
1930@defun eq object1 object2 1935@defun eq object1 object2
1931This function returns @code{t} if @var{object1} and @var{object2} are 1936This function returns @code{t} if @var{object1} and @var{object2} are
1932the same object, @code{nil} otherwise. 1937the same object, and @code{nil} otherwise.
1933 1938
1934@code{eq} returns @code{t} if @var{object1} and @var{object2} are 1939If @var{object1} and @var{object2} are integers with the same value,
1935integers with the same value. Also, since symbol names are normally 1940they are considered to be the same object (i.e.@: @code{eq} returns
1936unique, if the arguments are symbols with the same name, they are 1941@code{t}). If @var{object1} and @var{object2} are symbols with the
1937@code{eq}. For other types (e.g., lists, vectors, strings), two 1942same name, they are normally the same object---but see @ref{Creating
1938arguments with the same contents or elements are not necessarily 1943Symbols} for exceptions. For other types (e.g.@: lists, vectors,
1939@code{eq} to each other: they are @code{eq} only if they are the same 1944strings), two arguments with the same contents or elements are not
1940object, meaning that a change in the contents of one will be reflected 1945necessarily @code{eq} to each other: they are @code{eq} only if they
1941by the same change in the contents of the other. 1946are the same object, meaning that a change in the contents of one will
1947be reflected by the same change in the contents of the other.
1942 1948
1943@example 1949@example
1944@group 1950@group
@@ -1988,6 +1994,7 @@ by the same change in the contents of the other.
1988@end group 1994@end group
1989@end example 1995@end example
1990 1996
1997@noindent
1991The @code{make-symbol} function returns an uninterned symbol, distinct 1998The @code{make-symbol} function returns an uninterned symbol, distinct
1992from the symbol that is used if you write the name in a Lisp expression. 1999from the symbol that is used if you write the name in a Lisp expression.
1993Distinct symbols with the same name are not @code{eq}. @xref{Creating 2000Distinct symbols with the same name are not @code{eq}. @xref{Creating
@@ -2003,11 +2010,11 @@ Symbols}.
2003 2010
2004@defun equal object1 object2 2011@defun equal object1 object2
2005This function returns @code{t} if @var{object1} and @var{object2} have 2012This function returns @code{t} if @var{object1} and @var{object2} have
2006equal components, @code{nil} otherwise. Whereas @code{eq} tests if its 2013equal components, and @code{nil} otherwise. Whereas @code{eq} tests
2007arguments are the same object, @code{equal} looks inside nonidentical 2014if its arguments are the same object, @code{equal} looks inside
2008arguments to see if their elements or contents are the same. So, if two 2015nonidentical arguments to see if their elements or contents are the
2009objects are @code{eq}, they are @code{equal}, but the converse is not 2016same. So, if two objects are @code{eq}, they are @code{equal}, but
2010always true. 2017the converse is not always true.
2011 2018
2012@example 2019@example
2013@group 2020@group
@@ -2059,13 +2066,13 @@ always true.
2059@end example 2066@end example
2060 2067
2061Comparison of strings is case-sensitive, but does not take account of 2068Comparison of strings is case-sensitive, but does not take account of
2062text properties---it compares only the characters in the strings. Use 2069text properties---it compares only the characters in the strings.
2063@code{equal-including-properties} to also compare text properties. For 2070@xref{Text Properties}. Use @code{equal-including-properties} to also
2064technical reasons, a unibyte string and a multibyte string are 2071compare text properties. For technical reasons, a unibyte string and
2065@code{equal} if and only if they contain the same sequence of 2072a multibyte string are @code{equal} if and only if they contain the
2066character codes and all these codes are either in the range 0 through 2073same sequence of character codes and all these codes are either in the
2067127 (@acronym{ASCII}) or 160 through 255 (@code{eight-bit-graphic}). 2074range 0 through 127 (@acronym{ASCII}) or 160 through 255
2068(@pxref{Text Representations}). 2075(@code{eight-bit-graphic}). (@pxref{Text Representations}).
2069 2076
2070@example 2077@example
2071@group 2078@group
diff --git a/doc/lispref/sequences.texi b/doc/lispref/sequences.texi
index 0ea32f99e12..94f1bf666d2 100644
--- a/doc/lispref/sequences.texi
+++ b/doc/lispref/sequences.texi
@@ -8,10 +8,10 @@
8@chapter Sequences, Arrays, and Vectors 8@chapter Sequences, Arrays, and Vectors
9@cindex sequence 9@cindex sequence
10 10
11 Recall that the @dfn{sequence} type is the union of two other Lisp 11 The @dfn{sequence} type is the union of two other Lisp types: lists
12types: lists and arrays. In other words, any list is a sequence, and 12and arrays. In other words, any list is a sequence, and any array is
13any array is a sequence. The common property that all sequences have is 13a sequence. The common property that all sequences have is that each
14that each is an ordered collection of elements. 14is an ordered collection of elements.
15 15
16 An @dfn{array} is a fixed-length object with a slot for each of its 16 An @dfn{array} is a fixed-length object with a slot for each of its
17elements. All the elements are accessible in constant time. The four 17elements. All the elements are accessible in constant time. The four
@@ -54,19 +54,17 @@ But it is possible to add elements to the list, or remove elements.
54* Vector Functions:: Functions specifically for vectors. 54* Vector Functions:: Functions specifically for vectors.
55* Char-Tables:: How to work with char-tables. 55* Char-Tables:: How to work with char-tables.
56* Bool-Vectors:: How to work with bool-vectors. 56* Bool-Vectors:: How to work with bool-vectors.
57* Rings:: Managing a fixed-size ring of objects.
57@end menu 58@end menu
58 59
59@node Sequence Functions 60@node Sequence Functions
60@section Sequences 61@section Sequences
61 62
62 In Emacs Lisp, a @dfn{sequence} is either a list or an array. The 63 This section describes functions that accept any kind of sequence.
63common property of all sequences is that they are ordered collections of
64elements. This section describes functions that accept any kind of
65sequence.
66 64
67@defun sequencep object 65@defun sequencep object
68Returns @code{t} if @var{object} is a list, vector, string, 66This function returns @code{t} if @var{object} is a list, vector,
69bool-vector, or char-table, @code{nil} otherwise. 67string, bool-vector, or char-table, @code{nil} otherwise.
70@end defun 68@end defun
71 69
72@defun length sequence 70@defun length sequence
@@ -149,8 +147,9 @@ This function generalizes @code{aref} (@pxref{Array Functions}) and
149 147
150@defun copy-sequence sequence 148@defun copy-sequence sequence
151@cindex copying sequences 149@cindex copying sequences
152Returns a copy of @var{sequence}. The copy is the same type of object 150This function returns a copy of @var{sequence}. The copy is the same
153as the original sequence, and it has the same elements in the same order. 151type of object as the original sequence, and it has the same elements
152in the same order.
154 153
155Storing a new element into the copy does not affect the original 154Storing a new element into the copy does not affect the original
156@var{sequence}, and vice versa. However, the elements of the new 155@var{sequence}, and vice versa. However, the elements of the new
@@ -394,8 +393,8 @@ symbol-lookup tables (@pxref{Creating Symbols}), as part of the
394representation of a byte-compiled function (@pxref{Byte Compilation}), 393representation of a byte-compiled function (@pxref{Byte Compilation}),
395and more. 394and more.
396 395
397 In Emacs Lisp, the indices of the elements of a vector start from zero 396 Like other arrays, vectors use zero-origin indexing: the first
398and count up from there. 397element has index 0.
399 398
400 Vectors are printed with square brackets surrounding the elements. 399 Vectors are printed with square brackets surrounding the elements.
401Thus, a vector whose elements are the symbols @code{a}, @code{b} and 400Thus, a vector whose elements are the symbols @code{a}, @code{b} and
@@ -728,3 +727,96 @@ bv
728@noindent 727@noindent
729These results make sense because the binary codes for control-_ and 728These results make sense because the binary codes for control-_ and
730control-W are 11111 and 10111, respectively. 729control-W are 11111 and 10111, respectively.
730
731@node Rings
732@section Managing a Fixed-Size Ring of Objects
733
734@cindex ring data structure
735 A @dfn{ring} is a fixed-size data structure that supports insertion,
736deletion, rotation, and modulo-indexed reference and traversal. An
737efficient ring data structure is implemented by the @code{ring}
738package. It provides the functions listed in this section.
739
740 Note that several ``rings'' in Emacs, like the kill ring and the
741mark ring, are actually implemented as simple lists, @emph{not} using
742the @code{ring} package; thus the following functions won't work on
743them.
744
745@defun make-ring size
746This returns a new ring capable of holding @var{size} objects.
747@var{size} should be an integer.
748@end defun
749
750@defun ring-p object
751This returns @code{t} if @var{object} is a ring, @code{nil} otherwise.
752@end defun
753
754@defun ring-size ring
755This returns the maximum capacity of the @var{ring}.
756@end defun
757
758@defun ring-length ring
759This returns the number of objects that @var{ring} currently contains.
760The value will never exceed that returned by @code{ring-size}.
761@end defun
762
763@defun ring-elements ring
764This returns a list of the objects in @var{ring}, in order, newest first.
765@end defun
766
767@defun ring-copy ring
768This returns a new ring which is a copy of @var{ring}.
769The new ring contains the same (@code{eq}) objects as @var{ring}.
770@end defun
771
772@defun ring-empty-p ring
773This returns @code{t} if @var{ring} is empty, @code{nil} otherwise.
774@end defun
775
776 The newest element in the ring always has index 0. Higher indices
777correspond to older elements. Indices are computed modulo the ring
778length. Index @minus{}1 corresponds to the oldest element, @minus{}2
779to the next-oldest, and so forth.
780
781@defun ring-ref ring index
782This returns the object in @var{ring} found at index @var{index}.
783@var{index} may be negative or greater than the ring length. If
784@var{ring} is empty, @code{ring-ref} signals an error.
785@end defun
786
787@defun ring-insert ring object
788This inserts @var{object} into @var{ring}, making it the newest
789element, and returns @var{object}.
790
791If the ring is full, insertion removes the oldest element to
792make room for the new element.
793@end defun
794
795@defun ring-remove ring &optional index
796Remove an object from @var{ring}, and return that object. The
797argument @var{index} specifies which item to remove; if it is
798@code{nil}, that means to remove the oldest item. If @var{ring} is
799empty, @code{ring-remove} signals an error.
800@end defun
801
802@defun ring-insert-at-beginning ring object
803This inserts @var{object} into @var{ring}, treating it as the oldest
804element. The return value is not significant.
805
806If the ring is full, this function removes the newest element to make
807room for the inserted element.
808@end defun
809
810@cindex fifo data structure
811 If you are careful not to exceed the ring size, you can
812use the ring as a first-in-first-out queue. For example:
813
814@lisp
815(let ((fifo (make-ring 5)))
816 (mapc (lambda (obj) (ring-insert fifo obj))
817 '(0 one "two"))
818 (list (ring-remove fifo) t
819 (ring-remove fifo) t
820 (ring-remove fifo)))
821 @result{} (0 t one t "two")
822@end lisp
diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi
index 49199d3e32f..bbb75f1474d 100644
--- a/doc/lispref/strings.texi
+++ b/doc/lispref/strings.texi
@@ -410,8 +410,13 @@ in case if @code{case-fold-search} is non-@code{nil}.
410@defun string= string1 string2 410@defun string= string1 string2
411This function returns @code{t} if the characters of the two strings 411This function returns @code{t} if the characters of the two strings
412match exactly. Symbols are also allowed as arguments, in which case 412match exactly. Symbols are also allowed as arguments, in which case
413their print names are used. 413the symbol names are used. Case is always significant, regardless of
414Case is always significant, regardless of @code{case-fold-search}. 414@code{case-fold-search}.
415
416This function is equivalent to @code{equal} for comparing two strings
417(@pxref{Equality Predicates}). In particular, the text properties of
418the two strings are ignored. But if either argument is not a string
419or symbol, an error is signaled.
415 420
416@example 421@example
417(string= "abc" "abc") 422(string= "abc" "abc")
@@ -422,10 +427,6 @@ Case is always significant, regardless of @code{case-fold-search}.
422 @result{} nil 427 @result{} nil
423@end example 428@end example
424 429
425The function @code{string=} ignores the text properties of the two
426strings. When @code{equal} (@pxref{Equality Predicates}) compares two
427strings, it uses @code{string=}.
428
429For technical reasons, a unibyte and a multibyte string are 430For technical reasons, a unibyte and a multibyte string are
430@code{equal} if and only if they contain the same sequence of 431@code{equal} if and only if they contain the same sequence of
431character codes and all these codes are either in the range 0 through 432character codes and all these codes are either in the range 0 through
diff --git a/doc/lispref/symbols.texi b/doc/lispref/symbols.texi
index 866a63c4cd9..0ee22b905b6 100644
--- a/doc/lispref/symbols.texi
+++ b/doc/lispref/symbols.texi
@@ -41,62 +41,58 @@ references another object:
41@table @asis 41@table @asis
42@item Print name 42@item Print name
43@cindex print name cell 43@cindex print name cell
44The @dfn{print name cell} holds a string that names the symbol for 44The symbol's name.
45reading and printing. See @code{symbol-name} in @ref{Creating Symbols}.
46 45
47@item Value 46@item Value
48@cindex value cell 47@cindex value cell
49The @dfn{value cell} holds the current value of the symbol as a 48The symbol's current value as a variable.
50variable. When a symbol is used as a form, the value of the form is the
51contents of the symbol's value cell. See @code{symbol-value} in
52@ref{Accessing Variables}.
53 49
54@item Function 50@item Function
55@cindex function cell 51@cindex function cell
56The @dfn{function cell} holds the function definition of the symbol. 52The symbol's function definition. It can also hold a symbol, a
57When a symbol is used as a function, its function definition is used in 53keymap, or a keyboard macro.
58its place. This cell is also used to make a symbol stand for a keymap
59or a keyboard macro, for editor command execution. Because each symbol
60has separate value and function cells, variables names and function names do
61not conflict. See @code{symbol-function} in @ref{Function Cells}.
62 54
63@item Property list 55@item Property list
64@cindex property list cell 56@cindex property list cell
65The @dfn{property list cell} holds the property list of the symbol. See 57The symbol's property list.
66@code{symbol-plist} in @ref{Property Lists}.
67@end table 58@end table
68 59
69 The print name cell always holds a string, and cannot be changed. The 60@noindent
70other three cells can be set individually to any specified Lisp object. 61The print name cell always holds a string, and cannot be changed.
71 62Each of the other three cells can be set to any Lisp object.
72 The print name cell holds the string that is the name of the symbol. 63
73Since symbols are represented textually by their names, it is important 64 The print name cell holds the string that is the name of a symbol.
74not to have two symbols with the same name. The Lisp reader ensures 65Since symbols are represented textually by their names, it is
75this: every time it reads a symbol, it looks for an existing symbol with 66important not to have two symbols with the same name. The Lisp reader
76the specified name before it creates a new one. (In GNU Emacs Lisp, 67ensures this: every time it reads a symbol, it looks for an existing
77this lookup uses a hashing algorithm and an obarray; see @ref{Creating 68symbol with the specified name before it creates a new one. To get a
78Symbols}.) 69symbol's name, use the function @code{symbol-name} (@pxref{Creating
79 70Symbols}).
80 The value cell holds the symbol's value as a variable 71
81(@pxref{Variables}). That is what you get if you evaluate the symbol as 72 The value cell holds a symbol's value as a variable, which is what
82a Lisp expression (@pxref{Evaluation}). Any Lisp object is a legitimate 73you get if the symbol itself is evaluated as a Lisp expression.
83value. Certain symbols have values that cannot be changed; these 74@xref{Variables}, for details about how values are set and retrieved,
84include @code{nil} and @code{t}, and any symbol whose name starts with 75including complications such as @dfn{local bindings} and @dfn{scoping
85@samp{:} (those are called @dfn{keywords}). @xref{Constant Variables}. 76rules}. Most symbols can have any Lisp object as a value, but certain
86 77special symbols have values that cannot be changed; these include
87 We often refer to ``the function @code{foo}'' when we really mean 78@code{nil} and @code{t}, and any symbol whose name starts with
88the function stored in the function cell of the symbol @code{foo}. We 79@samp{:} (those are called @dfn{keywords}). @xref{Constant
89make the distinction explicit only when necessary. In normal 80Variables}.
90usage, the function cell usually contains a function 81
91(@pxref{Functions}) or a macro (@pxref{Macros}), as that is what the 82 The function cell holds a symbol's function definition. Often, we
92Lisp interpreter expects to see there (@pxref{Evaluation}). Keyboard 83refer to ``the function @code{foo}'' when we really mean the function
93macros (@pxref{Keyboard Macros}), keymaps (@pxref{Keymaps}) and 84stored in the function cell of @code{foo}; we make the distinction
94autoload objects (@pxref{Autoloading}) are also sometimes stored in 85explicit only when necessary. Typically, the function cell is used to
95the function cells of symbols. 86hold a function (@pxref{Functions}) or a macro (@pxref{Macros}).
87However, it can also be used to hold a symbol (@pxref{Function
88Indirection}), keyboard macro (@pxref{Keyboard Macros}), keymap
89(@pxref{Keymaps}), or autoload object (@pxref{Autoloading}). To get
90the contents of a symbol's function cell, use the function
91@code{symbol-function} (@pxref{Function Cells}).
96 92
97 The property list cell normally should hold a correctly formatted 93 The property list cell normally should hold a correctly formatted
98property list (@pxref{Property Lists}), as a number of functions expect 94property list. To get a symbol's function cell, use the function
99to see a property list there. 95@code{symbol-plist}. @xref{Property Lists}.
100 96
101 The function cell or the value cell may be @dfn{void}, which means 97 The function cell or the value cell may be @dfn{void}, which means
102that the cell does not reference any object. (This is not the same 98that the cell does not reference any object. (This is not the same
@@ -104,57 +100,43 @@ thing as holding the symbol @code{void}, nor the same as holding the
104symbol @code{nil}.) Examining a function or value cell that is void 100symbol @code{nil}.) Examining a function or value cell that is void
105results in an error, such as @samp{Symbol's value as variable is void}. 101results in an error, such as @samp{Symbol's value as variable is void}.
106 102
107 The four functions @code{symbol-name}, @code{symbol-value}, 103 Because each symbol has separate value and function cells, variables
108@code{symbol-plist}, and @code{symbol-function} return the contents of 104names and function names do not conflict. For example, the symbol
109the four cells of a symbol. Here as an example we show the contents of 105@code{buffer-file-name} has a value (the name of the file being
110the four cells of the symbol @code{buffer-file-name}: 106visited in the current buffer) as well as a function definition (a
107primitive function that returns the name of the file):
111 108
112@example 109@example
113(symbol-name 'buffer-file-name) 110buffer-file-name
114 @result{} "buffer-file-name"
115(symbol-value 'buffer-file-name)
116 @result{} "/gnu/elisp/symbols.texi" 111 @result{} "/gnu/elisp/symbols.texi"
117(symbol-function 'buffer-file-name) 112(symbol-function 'buffer-file-name)
118 @result{} #<subr buffer-file-name> 113 @result{} #<subr buffer-file-name>
119(symbol-plist 'buffer-file-name)
120 @result{} (variable-documentation 29529)
121@end example 114@end example
122 115
123@noindent
124Because this symbol is the variable which holds the name of the file
125being visited in the current buffer, the value cell contents we see are
126the name of the source file of this chapter of the Emacs Lisp Manual.
127The property list cell contains the list @code{(variable-documentation
12829529)} which tells the documentation functions where to find the
129documentation string for the variable @code{buffer-file-name} in the
130@file{DOC-@var{version}} file. (29529 is the offset from the beginning
131of the @file{DOC-@var{version}} file to where that documentation string
132begins---see @ref{Documentation Basics}.) The function cell contains
133the function for returning the name of the file.
134@code{buffer-file-name} names a primitive function, which has no read
135syntax and prints in hash notation (@pxref{Primitive Function Type}). A
136symbol naming a function written in Lisp would have a lambda expression
137(or a byte-code object) in this cell.
138
139@node Definitions, Creating Symbols, Symbol Components, Symbols 116@node Definitions, Creating Symbols, Symbol Components, Symbols
140@section Defining Symbols 117@section Defining Symbols
141@cindex definitions of symbols 118@cindex definitions of symbols
142 119
143 A @dfn{definition} in Lisp is a special form that announces your 120 A @dfn{definition} is a special kind of Lisp expression that
144intention to use a certain symbol in a particular way. In Emacs Lisp, 121announces your intention to use a symbol in a particular way. It
145you can define a symbol as a variable, or define it as a function (or 122typically specifies a value or meaning for the symbol for one kind of
146macro), or both independently. 123use, plus documentation for its meaning when used in this way. Thus,
147 124when you define a symbol as a variable, you can supply an initial
148 A definition construct typically specifies a value or meaning for the 125value for the variable, plus documentation for the variable.
149symbol for one kind of use, plus documentation for its meaning when used
150in this way. Thus, when you define a symbol as a variable, you can
151supply an initial value for the variable, plus documentation for the
152variable.
153 126
154 @code{defvar} and @code{defconst} are special forms that define a 127 @code{defvar} and @code{defconst} are special forms that define a
155symbol as a global variable. They are documented in detail in 128symbol as a @dfn{global variable}---a variable that can be accessed at
156@ref{Defining Variables}. For defining user option variables that can 129any point in a Lisp program. @xref{Variables}, for details about
157be customized, use @code{defcustom} (@pxref{Customization}). 130variables. To define a customizable variable, use the
131@code{defcustom} macro, which also calls @code{defvar} as a subroutine
132(@pxref{Customization}).
133
134 In principle, you can assign a variable value to any symbol with
135@code{setq}, whether not it has first been defined as a variable.
136However, you ought to write a variable definition for each global
137variable that you want to use; otherwise, your Lisp program may not
138act correctly if it is evaluated with lexical scoping enabled
139(@pxref{Variable Scoping}).
158 140
159 @code{defun} defines a symbol as a function, creating a lambda 141 @code{defun} defines a symbol as a function, creating a lambda
160expression and storing it in the function cell of the symbol. This 142expression and storing it in the function cell of the symbol. This
@@ -171,15 +153,14 @@ both macro and function definitions are kept in the function cell, and
171that cell can hold only one Lisp object at any given time. 153that cell can hold only one Lisp object at any given time.
172@xref{Macros}. 154@xref{Macros}.
173 155
174 In Emacs Lisp, a definition is not required in order to use a symbol 156 As previously noted, Emacs Lisp allows the same symbol to be defined
175as a variable or function. Thus, you can make a symbol a global 157both as a variable (e.g.@: with @code{defvar}) and as a function or
176variable with @code{setq}, whether you define it first or not. The real 158macro (e.g.@: with @code{defun}). Such definitions do not conflict.
177purpose of definitions is to guide programmers and programming tools. 159
178They inform programmers who read the code that certain symbols are 160 These definition also act as guides for programming tools. For
179@emph{intended} to be used as variables, or as functions. In addition, 161example, the @kbd{C-h f} and @kbd{C-h v} commands create help buffers
180utilities such as @file{etags} and @file{make-docfile} recognize 162containing links to the relevant variable, function, or macro
181definitions, and add appropriate information to tag tables and the 163definitions. @xref{Name Help,,, emacs, The GNU Emacs Manual}.
182@file{DOC-@var{version}} file. @xref{Accessing Documentation}.
183 164
184@node Creating Symbols, Property Lists, Definitions, Symbols 165@node Creating Symbols, Property Lists, Definitions, Symbols
185@section Creating and Interning Symbols 166@section Creating and Interning Symbols
@@ -254,8 +235,8 @@ not work---only @code{intern} can enter a symbol in an obarray properly.
254 235
255@cindex CL note---symbol in obarrays 236@cindex CL note---symbol in obarrays
256@quotation 237@quotation
257@b{Common Lisp note:} In Common Lisp, a single symbol may be interned in 238@b{Common Lisp note:} Unlike Common Lisp, Emacs Lisp does not provide
258several obarrays. 239for interning a single symbol in several obarrays.
259@end quotation 240@end quotation
260 241
261 Most of the functions below take a name and sometimes an obarray as 242 Most of the functions below take a name and sometimes an obarray as
@@ -448,12 +429,13 @@ must be distinct.
448 429
449 Property lists are better than association lists for attaching 430 Property lists are better than association lists for attaching
450information to various Lisp function names or variables. If your 431information to various Lisp function names or variables. If your
451program keeps all of its associations in one association list, it will 432program keeps all such information in one association list, it will
452typically need to search that entire list each time it checks for an 433typically need to search that entire list each time it checks for an
453association. This could be slow. By contrast, if you keep the same 434association for a particular Lisp function name or variable, which
454information in the property lists of the function names or variables 435could be slow. By contrast, if you keep the same information in the
455themselves, each search will scan only the length of one property list, 436property lists of the function names or variables themselves, each
456which is usually short. This is why the documentation for a variable is 437search will scan only the length of one property list, which is
438usually short. This is why the documentation for a variable is
457recorded in a property named @code{variable-documentation}. The byte 439recorded in a property named @code{variable-documentation}. The byte
458compiler likewise uses properties to record those functions needing 440compiler likewise uses properties to record those functions needing
459special treatment. 441special treatment.
diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi
index b0a6795021b..a8f75f5a160 100644
--- a/doc/lispref/variables.texi
+++ b/doc/lispref/variables.texi
@@ -1660,6 +1660,13 @@ Query (once) about all the variables.
1660@end table 1660@end table
1661@end defopt 1661@end defopt
1662 1662
1663@defvar inhibit-local-variables-regexps
1664This is a list of regular expressions. If a file has a name
1665matching an element of this list, then it is not scanned for
1666any form of file-local variable. For examples of why you might want
1667to use this, @pxref{Auto Major Mode}.
1668@end defvar
1669
1663@defun hack-local-variables &optional mode-only 1670@defun hack-local-variables &optional mode-only
1664This function parses, and binds or evaluates as appropriate, any local 1671This function parses, and binds or evaluates as appropriate, any local
1665variables specified by the contents of the current buffer. The variable 1672variables specified by the contents of the current buffer. The variable
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index 1bff30e45e1..a0f8b61ddfe 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -3104,9 +3104,9 @@ window configuration; see @ref{Frame Configurations}.
3104@defun current-window-configuration &optional frame 3104@defun current-window-configuration &optional frame
3105This function returns a new object representing @var{frame}'s current 3105This function returns a new object representing @var{frame}'s current
3106window configuration. The default for @var{frame} is the selected 3106window configuration. The default for @var{frame} is the selected
3107frame. This function saves copies of window parameters listed by the 3107frame. The variable @code{window-persistent-parameters} specifies
3108variable @code{window-persistent-parameters}, see @ref{Window 3108whether and which window parameters are saved by this function, see
3109Parameters} for details. 3109@ref{Window Parameters} for details.
3110@end defun 3110@end defun
3111 3111
3112@defun set-window-configuration configuration 3112@defun set-window-configuration configuration
@@ -3214,27 +3214,25 @@ to clone the state of a frame into an arbitrary live window
3214(@code{set-window-configuration} effectively clones the windows of a 3214(@code{set-window-configuration} effectively clones the windows of a
3215frame into the root window of that very frame only). 3215frame into the root window of that very frame only).
3216 3216
3217@defun window-state-get &optional window ignore 3217@defun window-state-get &optional window writable
3218This function returns the state of @var{window} as a Lisp object. The 3218This function returns the state of @var{window} as a Lisp object. The
3219argument @var{window} can be any window and defaults to the root window 3219argument @var{window} can be any window and defaults to the root window
3220of the selected frame. 3220of the selected frame.
3221 3221
3222If the optional argument @var{ignore} is non-@code{nil}, this means to 3222If the optional argument @var{writable} is non-@code{nil}, this means to
3223not use markers for sampling positions like @code{window-point} or 3223not use markers for sampling positions like @code{window-point} or
3224@code{window-start}. This argument should be non-@code{nil} when the 3224@code{window-start}. This argument should be non-@code{nil} when the
3225state shall be written on disk and read back in another session. 3225state shall be written to disk and read back in another session.
3226 3226
3227The variable @code{window-persistent-parameters} specifies whether and 3227Together, the argument @var{writable} and the variable
3228which window parameters are saved by this function, see @ref{Window 3228@code{window-persistent-parameters} specify which window parameters are
3229Parameters} for details. 3229saved by this function, see @ref{Window Parameters} for details.
3230@end defun 3230@end defun
3231 3231
3232The value returned by @code{window-state-get} can be converted, using 3232The value returned by @code{window-state-get} can be used in the same
3233one of the functions defined by Desktop Save Mode (@pxref{Desktop Save 3233session to make a clone of a window in another window. It can be also
3234Mode}), to an object that can be written to a file. Such objects can be 3234written to disk and read back in another session. In either case, use
3235read back and converted to a Lisp object representing the state of the 3235the function described next to restore the state of the window.
3236window. That Lisp object can be used as argument for the following
3237function in order to restore the state window in another window.
3238 3236
3239@defun window-state-put state &optional window ignore 3237@defun window-state-put state &optional window ignore
3240This function puts the window state @var{state} into @var{window}. The 3238This function puts the window state @var{state} into @var{window}. The
@@ -3281,10 +3279,10 @@ states of windows (@pxref{Window Configurations}) do not care about
3281window parameters. This means, that when you change the value of a 3279window parameters. This means, that when you change the value of a
3282parameter within the body of a @code{save-window-excursion}, the 3280parameter within the body of a @code{save-window-excursion}, the
3283previous value is not restored upon exit of that macro. It also means 3281previous value is not restored upon exit of that macro. It also means
3284that when you clone via @code{window-state-put} a window state saved 3282that when you restore via @code{window-state-put} a window state saved
3285earlier by @code{window-state-get}, the cloned windows come up with no 3283earlier by @code{window-state-get}, all cloned windows have their
3286parameters at all. The following variable allows to override the 3284parameters reset to @code{nil}. The following variable allows to
3287standard behavior. 3285override the standard behavior.
3288 3286
3289@defvar window-persistent-parameters 3287@defvar window-persistent-parameters
3290This variable is an alist specifying which parameters get saved by 3288This variable is an alist specifying which parameters get saved by
@@ -3293,32 +3291,25 @@ subsequently restored by @code{set-window-configuration} and
3293@code{window-state-put}, see @ref{Window Configurations}. 3291@code{window-state-put}, see @ref{Window Configurations}.
3294 3292
3295The @sc{car} of each entry of this alist is the symbol specifying the 3293The @sc{car} of each entry of this alist is the symbol specifying the
3296parameter. The @sc{cdr} must be one of the following: 3294parameter. The @sc{cdr} should be one of the following:
3297 3295
3298@table @asis 3296@table @asis
3299@item @code{state}
3300This value means the parameter is saved by @code{window-state-get}
3301provided its @var{ignore} argument is @code{nil}. The function
3302@code{current-window-configuration} does not save this parameter.
3303
3304@item @code{nil} 3297@item @code{nil}
3298This value means the parameter is neither saved by
3299@code{window-state-get} nor by @code{current-window-configuration}.
3300
3301@item @code{t}
3305This value specifies that the parameter is saved by 3302This value specifies that the parameter is saved by
3306@code{current-window-configuration} and, provided its @var{ignore} 3303@code{current-window-configuration} and, provided its @var{writable}
3307argument is @code{nil}, by @code{window-state-get}. 3304argument is @code{nil}, by @code{window-state-get}.
3308 3305
3309@item @code{t} 3306@item @code{writable}
3310This means that the parameter is saved unconditionally by both 3307This means that the parameter is saved unconditionally by both
3311@code{current-window-configuration} and @code{window-state-get}. This 3308@code{current-window-configuration} and @code{window-state-get}. This
3312value should not be used for parameters whose values do not have a read 3309value should not be used for parameters whose values do not have a read
3313syntax. Otherwise, invoking @code{window-state-put} in another session 3310syntax. Otherwise, invoking @code{window-state-put} in another session
3314may fail with an @code{invalid-read-syntax} error. 3311may fail with an @code{invalid-read-syntax} error.
3315@end table 3312@end table
3316
3317Parameters that have been saved are restored to their previous values by
3318@code{set-window-configuration} respectively are installed by
3319@code{window-state-put}. Parameters that have not been saved are left
3320alone by @code{set-window-configuration} respectively are not installed
3321by @code{window-state-put}.
3322@end defvar 3313@end defvar
3323 3314
3324Some functions, notably @code{delete-window}, 3315Some functions, notably @code{delete-window},
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog
index adb5bbbd669..72ac8b85fc3 100644
--- a/doc/misc/ChangeLog
+++ b/doc/misc/ChangeLog
@@ -1,3 +1,11 @@
12012-01-23 Glenn Morris <rgm@gnu.org>
2
3 * pcl-cvs.texi (About PCL-CVS): Refer to vc-dir rather than vc-dired.
4
52012-01-19 Eric Hanchrow <eric.hanchrow@gmail.com>
6
7 * tramp.texi (File): Tweak wording for the `scpc' option.
8
12012-01-06 Lars Magne Ingebrigtsen <larsi@gnus.org> 92012-01-06 Lars Magne Ingebrigtsen <larsi@gnus.org>
2 10
3 * gnus.texi (Group Parameters): Really note precedence. 11 * gnus.texi (Group Parameters): Really note precedence.
diff --git a/doc/misc/pcl-cvs.texi b/doc/misc/pcl-cvs.texi
index 32d2114f5a0..92c309f5e98 100644
--- a/doc/misc/pcl-cvs.texi
+++ b/doc/misc/pcl-cvs.texi
@@ -6,8 +6,7 @@
6@c %**end of header 6@c %**end of header
7 7
8@copying 8@copying
9Copyright @copyright{} 1991-2012 9Copyright @copyright{} 1991-2012 Free Software Foundation, Inc.
10Free Software Foundation, Inc.
11 10
12@quotation 11@quotation
13Permission is granted to copy, distribute and/or modify this document 12Permission is granted to copy, distribute and/or modify this document
@@ -136,10 +135,9 @@ Customization
136PCL-CVS is a front-end to CVS versions 1.9 and later. 135PCL-CVS is a front-end to CVS versions 1.9 and later.
137It concisely shows the present status of a checked out module in an 136It concisely shows the present status of a checked out module in an
138Emacs buffer and provides single-key access to the most frequently used CVS 137Emacs buffer and provides single-key access to the most frequently used CVS
139commands. 138commands. Note that the @code{vc-dir} command (@pxref{VC Directory
140For Emacs users accustomed to VC, PCL-CVS can be thought of as a replacement 139Mode, , , emacs, The GNU Emacs Manual}) provides similar
141for VC-dired (@pxref{VC Directory Mode, , , emacs, The GNU 140functionality, but for several version control systems, including CVS.
142Emacs Manual}) specifically designed for CVS.
143 141
144PCL-CVS was originally written many years ago by Per Cederqvist who 142PCL-CVS was originally written many years ago by Per Cederqvist who
145proudly maintained it until January 1996, at which point he released the 143proudly maintained it until January 1996, at which point he released the
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi
index 41ba6689f13..7fbd11decd7 100644
--- a/doc/misc/tramp.texi
+++ b/doc/misc/tramp.texi
@@ -866,13 +866,22 @@ Newer versions of @option{ssh} (for example OpenSSH 4) offer an option
866@option{ControlMaster}. This allows @option{scp} to reuse an existing 866@option{ControlMaster}. This allows @option{scp} to reuse an existing
867@option{ssh} channel, which increases performance. 867@option{ssh} channel, which increases performance.
868 868
869Before you use this method, you shall check whether your @option{ssh} 869Before you use this method, you should check whether your @option{ssh}
870implementation does support this option. Try from the command line 870implementation supports this option. Try from the command line
871 871
872@example 872@example
873ssh localhost -o ControlMaster=yes 873ssh localhost -o ControlMaster=yes /bin/true
874@end example 874@end example
875 875
876If that command succeeds silently, then you can use @option{scpc}; but
877if it fails like
878
879@example
880command-line: line 0: Bad configuration option: ControlMaster
881@end example
882
883then you cannot use it.
884
876This method supports the @samp{-p} argument. 885This method supports the @samp{-p} argument.
877 886
878 887