diff options
| author | Joakim Verona | 2012-01-23 15:10:06 +0100 |
|---|---|---|
| committer | Joakim Verona | 2012-01-23 15:10:06 +0100 |
| commit | 0322b140eead7c94de7f0f6d19a90bd15690b4eb (patch) | |
| tree | 950c011783cc896d0450084cb5155e54548bfe5b /doc | |
| parent | d5114bfea3ea4c37c57e2af0f3b095be9fcd8bac (diff) | |
| parent | cb5850f27c1b4d26957d58e2da2314dd12498671 (diff) | |
| download | emacs-0322b140eead7c94de7f0f6d19a90bd15690b4eb.tar.gz emacs-0322b140eead7c94de7f0f6d19a90bd15690b4eb.zip | |
upstream
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/emacs/ChangeLog | 4 | ||||
| -rw-r--r-- | doc/emacs/anti.texi | 95 | ||||
| -rw-r--r-- | doc/lispintro/ChangeLog | 9 | ||||
| -rw-r--r-- | doc/lispintro/emacs-lisp-intro.texi | 4 | ||||
| -rw-r--r-- | doc/lispref/ChangeLog | 51 | ||||
| -rw-r--r-- | doc/lispref/control.texi | 10 | ||||
| -rw-r--r-- | doc/lispref/elisp.texi | 2 | ||||
| -rw-r--r-- | doc/lispref/eval.texi | 24 | ||||
| -rw-r--r-- | doc/lispref/intro.texi | 23 | ||||
| -rw-r--r-- | doc/lispref/lists.texi | 163 | ||||
| -rw-r--r-- | doc/lispref/modes.texi | 12 | ||||
| -rw-r--r-- | doc/lispref/numbers.texi | 124 | ||||
| -rw-r--r-- | doc/lispref/objects.texi | 207 | ||||
| -rw-r--r-- | doc/lispref/sequences.texi | 120 | ||||
| -rw-r--r-- | doc/lispref/strings.texi | 13 | ||||
| -rw-r--r-- | doc/lispref/symbols.texi | 176 | ||||
| -rw-r--r-- | doc/lispref/variables.texi | 7 | ||||
| -rw-r--r-- | doc/lispref/windows.texi | 57 | ||||
| -rw-r--r-- | doc/misc/ChangeLog | 8 | ||||
| -rw-r--r-- | doc/misc/pcl-cvs.texi | 10 | ||||
| -rw-r--r-- | doc/misc/tramp.texi | 15 |
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 @@ | |||
| 1 | 2012-01-23 Chong Yidong <cyd@gnu.org> | ||
| 2 | |||
| 3 | * anti.texi (Antinews): Add Emacs 23 antinews. | ||
| 4 | |||
| 1 | 2012-01-16 Volker Sobek <reklov@live.com> (tiny change) | 5 | 2012-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 |
| 16 | FIXME | 16 | Support for displaying and editing ``bidirectional'' text has been |
| 17 | removed. Text is now always displayed on the screen in a single | ||
| 18 | consistent direction---left to right---regardless of the underlying | ||
| 19 | script. Similarly, @kbd{C-f} and @kbd{C-b} always move the text | ||
| 20 | cursor 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 | ||
| 22 | expect, rather than moving forward or backward based on the underlying | ||
| 23 | ``paragraph direction''. | ||
| 24 | |||
| 25 | Users of ``right-to-left'' languages, like Arabic and Hebrew, may | ||
| 26 | adapt by reading and/or editing text in left-to-right order. | ||
| 27 | |||
| 28 | @item | ||
| 29 | The Emacs Lisp package manager has been removed. Instead of using a | ||
| 30 | ``user interface'' (@kbd{M-x list-packages}), additional Lisp packages | ||
| 31 | must now be installed by hand, which is the most flexible and | ||
| 32 | ``Lispy'' method anyway. Typically, this just involves editing your | ||
| 33 | init file to add the package installation directory to the load path | ||
| 34 | and defining some autoloads; see each package's commentary section | ||
| 35 | and/or README file for details. | ||
| 36 | |||
| 37 | @item | ||
| 38 | The option @code{delete-active-region} has been deleted. When the | ||
| 39 | region is active, typing @key{DEL} or @key{delete} no longer deletes | ||
| 40 | the text in the region; it deletes a single character instead. | ||
| 41 | |||
| 42 | @item | ||
| 43 | We have reworked how Emacs handles the clipboard and the X primary | ||
| 44 | selection. 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 | ||
| 46 | use these commands without interfering with ``cutting'' or ``pasting'' | ||
| 47 | in other programs. The @samp{Cut}/@samp{Copy}/@samp{Paste} menu items | ||
| 48 | are bound to separate clipboard commands, not to the same commands as | ||
| 49 | @kbd{C-w}/@kbd{M-w}/@kbd{C-y}. | ||
| 50 | |||
| 51 | Selecting text by dragging with the mouse now puts the text in the | ||
| 52 | kill ring, in addition to the primary selection. But note that | ||
| 53 | selecting an active region with @kbd{C-@key{SPC}} does @emph{not} | ||
| 54 | alter the kill ring nor the primary selection, even though the text | ||
| 55 | highlighting is visually identical. | ||
| 56 | |||
| 57 | @item | ||
| 58 | In Isearch, @kbd{C-y} and @kbd{M-y} are no longer bound to | ||
| 59 | @code{isearch-yank-kill} and @code{isearch-yank-pop} respectively. | ||
| 60 | Instead, @kbd{C-y} yanks the rest of the current line into the search | ||
| 61 | string (@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 | ||
| 66 | Various completion features have been simplified. The options | ||
| 67 | @code{completion-cycle-threshold} and | ||
| 68 | @code{completion-category-overrides} have been removed. Due to the | ||
| 69 | latter removal, Emacs uses a single consistent scheme to generate | ||
| 70 | completions, instead of using a separate scheme for (say) buffer name | ||
| 71 | completion. Several major modes, such as Shell mode, now implement | ||
| 72 | their own inline completion commands instead of using | ||
| 73 | @code{completion-at-point}. | ||
| 74 | |||
| 75 | @item | ||
| 76 | We have removed various options for controlling how windows are used, | ||
| 77 | e.g.@: @code{display-buffer-base-action}, @code{display-buffer-alist}, | ||
| 78 | @code{window-combination-limit}, and @code{window-combination-resize}. | ||
| 79 | |||
| 80 | @item | ||
| 81 | The command @kbd{M-x customize-themes} has been removed. Emacs no | ||
| 82 | longer comes with pre-defined themes (you can write your own). | ||
| 83 | |||
| 84 | @item | ||
| 85 | Emacs no longer adapts various aspects of its display to GTK+ | ||
| 86 | settings, opting instead for a uniform toolkit-independent look. GTK+ | ||
| 87 | scroll bars are placed on the left, the same position as non-GTK+ X | ||
| 88 | scroll bars. Emacs no longer refers to GTK+ to set the default | ||
| 89 | @code{region} face, nor for drawing tooltips. | ||
| 90 | |||
| 91 | @item | ||
| 92 | Setting the option @code{delete-by-moving-to-trash} to a | ||
| 93 | non-@code{nil} now causes all file deletions to use the system trash, | ||
| 94 | even temporary files created by Lisp programs; furthermore, the | ||
| 95 | @kbd{M-x delete-file} and @kbd{M-x delete-directory} commands no | ||
| 96 | longer accept prefix arguments to force true deletion. | ||
| 97 | |||
| 98 | @item | ||
| 99 | On GNU/Linux and Unix, the default method for sending mail (as | ||
| 100 | specified by @code{send-mail-function}) is to use the | ||
| 101 | @command{sendmail} program. Emacs no longer asks for a delivery | ||
| 102 | method the first time you try to send mail, trusting instead that the | ||
| 103 | system is configured for mail delivery, as it ought to be. | ||
| 104 | |||
| 105 | @item | ||
| 106 | Several 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 | ||
| 108 | control systems, and the ability to view inline log entries in the log | ||
| 109 | buffers made by @kbd{C-x v L}. | ||
| 17 | 110 | ||
| 18 | @item | 111 | @item |
| 19 | To keep up with decreasing computer memory capacity and disk space, many | 112 | To 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 @@ | |||
| 1 | 2012-01-19 Juanma Barranquero <lekktu@gmail.com> | ||
| 2 | |||
| 3 | * emacs-lisp-intro.texi (count-words-in-defun): | ||
| 4 | Add missing parenthesis (bug#10544). | ||
| 5 | |||
| 6 | 2012-01-17 Glenn Morris <rgm@gnu.org> | ||
| 7 | |||
| 8 | * emacs-lisp-intro.texi (re-search-forward): Fix typo. | ||
| 9 | |||
| 1 | 2011-11-24 Juanma Barranquero <lekktu@gmail.com> | 10 | 2011-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 |
| 12609 | The first argument is the regular expression that the function searches | 12609 | The first argument is the regular expression that the function searches |
| 12610 | for. The regular expression will be a string between quotations marks. | 12610 | for. The regular expression will be a string between quotation marks. |
| 12611 | 12611 | ||
| 12612 | @item | 12612 | @item |
| 12613 | The optional second argument limits how far the function will search; it is a | 12613 | The 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 @@ | |||
| 1 | 2012-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 | |||
| 24 | 2012-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 | |||
| 39 | 2012-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 | |||
| 45 | 2012-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 | |||
| 1 | 2012-01-16 Juanma Barranquero <lekktu@gmail.com> | 52 | 2012-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 |
| 12 | We 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 | 13 | these forms by enclosing them in @dfn{control structures}. Control |
| 14 | control when, whether, or how many times to execute the forms they | 14 | structures are special forms which control when, whether, or how many |
| 15 | contain. | 15 | times 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 | ||
| 331 | Modifying Existing List Structure | 330 | Modifying 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 | ||
| 348 | Hash Tables | 348 | Hash 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 | |||
| 64 | first evaluates the argument (the subform @code{x}). After evaluating | 64 | first evaluates the argument (the subform @code{x}). After evaluating |
| 65 | the argument, Emacs @dfn{executes} the function (@code{car}), and if | 65 | the argument, Emacs @dfn{executes} the function (@code{car}), and if |
| 66 | the function is written in Lisp, execution works by evaluating the | 66 | the 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 |
| 68 | not a Lisp function; it is a primitive function implemented in C.) | 68 | not 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 |
| 70 | calls. | 70 | calls. |
| 71 | 71 | ||
| @@ -77,9 +77,8 @@ variables (@pxref{Variables}).@footnote{This definition of | |||
| 77 | that can affect the result of a program.} Whenever a form refers to a | 77 | that can affect the result of a program.} Whenever a form refers to a |
| 78 | variable without creating a new binding for it, the variable evaluates | 78 | variable without creating a new binding for it, the variable evaluates |
| 79 | to the value given by the current environment. Evaluating a form may | 79 | to the value given by the current environment. Evaluating a form may |
| 80 | create a new environment for recursive evaluation, by binding | 80 | also temporarily alter the environment by binding variables |
| 81 | variables (@pxref{Local Variables}). Such environments are temporary, | 81 | (@pxref{Local Variables}). |
| 82 | and 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 |
| 180 | is the variable's value, if it has one. If it has none (if its value | 179 | is the variable's value, if it has one. If the symbol has no value as |
| 181 | cell is void), an error is signaled. For more information on the use of | 180 | a variable, the Lisp interpreter signals an error. For more |
| 182 | variables, see @ref{Variables}. | 181 | information 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 | |||
| 602 | arguments. | 601 | arguments. |
| 603 | 602 | ||
| 604 | @defun eval form &optional lexical | 603 | @defun eval form &optional lexical |
| 605 | This is the basic function evaluating an expression. It evaluates | 604 | This 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 |
| 607 | evaluation proceeds depends on the type of the object (@pxref{Forms}). | 606 | evaluation 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 | |
| 609 | rules (@pxref{Lexical Binding}) instead of the default dynamic scoping used | 608 | The argument @var{lexical}, if non-@code{nil}, means to evaluate |
| 610 | historically in Emacs Lisp. | 609 | @var{form} using lexical scoping rules for variables, instead of the |
| 610 | default dynamic scoping rules. @xref{Lexical Binding}. | ||
| 611 | 611 | ||
| 612 | Since @code{eval} is a function, the argument expression that appears | 612 | Since @code{eval} is a function, the argument expression that appears |
| 613 | in a call to @code{eval} is evaluated twice: once as preparation before | 613 | in 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 |
| 166 | is a symbol with the name @samp{nil}; it is the logical truth value | 166 | is 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. |
| 168 | When used as a variable, @code{nil} always has the value @code{nil}. | 168 | When 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 | |||
| 396 | interactively; macros process their arguments differently from functions | 396 | interactively; 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 |
| 400 | optional and repeated arguments because they can break the argument | 400 | notation to specify optional and repeated arguments, because they can |
| 401 | list down into separate arguments in more complicated ways. | 401 | break the argument list down into separate arguments in more |
| 402 | @samp{@r{[}@var{optional-arg}@r{]}} means that @var{optional-arg} is | 402 | complicated ways. @samp{@r{[}@var{optional-arg}@r{]}} means that |
| 403 | optional and @samp{@var{repeated-args}@dots{}} stands for zero or more | 403 | @var{optional-arg} is optional and @samp{@var{repeated-args}@dots{}} |
| 404 | arguments. Parentheses are used when several arguments are grouped into | 404 | stands for zero or more arguments. Parentheses are used when several |
| 405 | additional levels of list structure. Here is an example: | 405 | arguments are grouped into additional levels of list structure. Here |
| 406 | is 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{} |
| 408 | This imaginary special form implements a loop that executes the | 409 | This 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 |
| 488 | The value of this variable indicates the time at which Emacs was built | 489 | The value of this variable indicates the time at which Emacs was |
| 489 | at the local site. It is a list of three integers, like the value | 490 | built. It is a list of three integers, like the value of |
| 490 | of @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 |
| 35 | ordered pair. That is, it has two slots, and each slot @dfn{holds}, or | 34 | object 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}, | 35 | and each slot @dfn{holds}, or @dfn{refers to}, some Lisp object. One |
| 37 | and the other is known as the @sc{cdr}. (These names are traditional; | 36 | slot is known as the @sc{car}, and the other is known as the @sc{cdr}. |
| 38 | see @ref{Cons Cell Type}.) @sc{cdr} is pronounced ``could-er.'' | 37 | (These names are traditional; see @ref{Cons Cell Type}.) @sc{cdr} is |
| 38 | pronounced ``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 |
| 41 | its @sc{car} slot currently holds, and likewise for the @sc{cdr}. | 41 | its @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 |
| 44 | cell refers to the next one. There is one cons cell for each element of | 44 | cell refers to the next one. There is one cons cell for each element |
| 45 | the list. By convention, the @sc{car}s of the cons cells hold the | 45 | of the list. By convention, the @sc{car}s of the cons cells hold the |
| 46 | elements of the list, and the @sc{cdr}s are used to chain the list: the | 46 | elements 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 | 48 | convention; at the level of cons cells, the @sc{car} and @sc{cdr} |
| 49 | the @sc{car} and the @sc{cdr} is entirely a matter of convention; at the | 49 | slots have similar properties). Hence, the @sc{cdr} slot of each cons |
| 50 | level of cons cells, the @sc{car} and @sc{cdr} slots have the same | 50 | cell in a list refers to the following cons cell. |
| 51 | characteristics. | ||
| 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 |
| 55 | the 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 | 56 | symbol and a list with no elements. For convenience, the symbol |
| 58 | symbol; 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 |
| 60 | as its @sc{car}). Therefore, the @sc{cdr} of a true list is always a | 58 | as its @sc{car}). |
| 61 | true 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 | ||
| 62 | elements 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 |
| 66 | neither @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 | 68 | printed representation would use dotted pair notation (@pxref{Dotted |
| 68 | @samp{.}. There is one other possibility: some cons cell's @sc{cdr} | 69 | Pair Notation}). There is one other possibility: some cons cell's |
| 69 | could 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. |
| 70 | that structure a @dfn{circular list}. | 71 | We 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, |
| 73 | circular or dotted. If the program doesn't look far enough down the | 74 | circular or dotted. If a program doesn't look far enough down the |
| 74 | list to see the @sc{cdr} of the final cons cell, it won't care. | 75 | list to see the @sc{cdr} of the final cons cell, it won't care. |
| 75 | However, some functions that operate on lists demand true lists and | 76 | However, some functions that operate on lists demand true lists and |
| 76 | signal errors if given a dotted list. Most functions that try to find | 77 | signal errors if given a dotted list. Most functions that try to find |
| 77 | the end of a list enter infinite loops if given a circular list. | 78 | the 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 | 82 | structure made out of cons cells as a @dfn{list structure}. |
| 82 | cells. | ||
| 83 | |||
| 84 | The @sc{cdr} of any nonempty true list @var{l} is a list containing all the | ||
| 85 | elements of @var{l} except the first. | ||
| 86 | |||
| 87 | @xref{Cons Cell Type}, for the read and print syntax of cons cells and | ||
| 88 | lists, 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 | |||
| 257 | x | 251 | x |
| 258 | @result{} (b c) | 252 | @result{} (b c) |
| 259 | @end example | 253 | @end example |
| 254 | |||
| 255 | @noindent | ||
| 256 | For 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 | |||
| 695 | l | 693 | l |
| 696 | @result{} (c a b) | 694 | @result{} (c a b) |
| 697 | @end example | 695 | @end example |
| 696 | |||
| 697 | @noindent | ||
| 698 | For 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}. | |||
| 1800 | compares the @sc{cdr} of each @var{alist} association instead of the | 1802 | compares 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, | ||
| 1810 | deletion, rotation, and modulo-indexed reference and traversal. | ||
| 1811 | |||
| 1812 | @defun make-ring size | ||
| 1813 | This 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 | ||
| 1818 | This returns @code{t} if @var{object} is a ring, @code{nil} otherwise. | ||
| 1819 | @end defun | ||
| 1820 | |||
| 1821 | @defun ring-size ring | ||
| 1822 | This returns the maximum capacity of the @var{ring}. | ||
| 1823 | @end defun | ||
| 1824 | |||
| 1825 | @defun ring-length ring | ||
| 1826 | This returns the number of objects that @var{ring} currently contains. | ||
| 1827 | The value will never exceed that returned by @code{ring-size}. | ||
| 1828 | @end defun | ||
| 1829 | |||
| 1830 | @defun ring-elements ring | ||
| 1831 | This returns a list of the objects in @var{ring}, in order, newest first. | ||
| 1832 | @end defun | ||
| 1833 | |||
| 1834 | @defun ring-copy ring | ||
| 1835 | This returns a new ring which is a copy of @var{ring}. | ||
| 1836 | The new ring contains the same (@code{eq}) objects as @var{ring}. | ||
| 1837 | @end defun | ||
| 1838 | |||
| 1839 | @defun ring-empty-p ring | ||
| 1840 | This 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 | ||
| 1844 | correspond to older elements. Indices are computed modulo the ring | ||
| 1845 | length. Index @minus{}1 corresponds to the oldest element, @minus{}2 | ||
| 1846 | to the next-oldest, and so forth. | ||
| 1847 | |||
| 1848 | @defun ring-ref ring index | ||
| 1849 | This 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 | ||
| 1855 | This inserts @var{object} into @var{ring}, making it the newest | ||
| 1856 | element, and returns @var{object}. | ||
| 1857 | |||
| 1858 | If the ring is full, insertion removes the oldest element to | ||
| 1859 | make room for the new element. | ||
| 1860 | @end defun | ||
| 1861 | |||
| 1862 | @defun ring-remove ring &optional index | ||
| 1863 | Remove an object from @var{ring}, and return that object. The | ||
| 1864 | argument @var{index} specifies which item to remove; if it is | ||
| 1865 | @code{nil}, that means to remove the oldest item. If @var{ring} is | ||
| 1866 | empty, @code{ring-remove} signals an error. | ||
| 1867 | @end defun | ||
| 1868 | |||
| 1869 | @defun ring-insert-at-beginning ring object | ||
| 1870 | This inserts @var{object} into @var{ring}, treating it as the oldest | ||
| 1871 | element. The return value is not significant. | ||
| 1872 | |||
| 1873 | If the ring is full, this function removes the newest element to make | ||
| 1874 | room 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 | ||
| 1879 | use 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} | |||
| 588 | is @code{nil}, @code{set-auto-mode} does not check the @w{@samp{-*-}} | 588 | is @code{nil}, @code{set-auto-mode} does not check the @w{@samp{-*-}} |
| 589 | line, or near the end of the file, for any mode tag. | 589 | line, or near the end of the file, for any mode tag. |
| 590 | 590 | ||
| 591 | @vindex inhibit-local-variables-regexps | ||
| 592 | There are some file types where it is not appropriate to scan the file | ||
| 593 | contents for a mode specifier. For example, a tar archive may happen to | ||
| 594 | contain, near the end of the file, a member file that has a local | ||
| 595 | variables section specifying a mode for that particular file. This | ||
| 596 | should not be applied to the containing tar file. Similarly, a tiff | ||
| 597 | image file might just happen to contain a first line that seems to | ||
| 598 | match the @w{@samp{-*-}} pattern. For these reasons, both these file | ||
| 599 | extensions are members of the list @var{inhibit-local-variables-regexps}. | ||
| 600 | Add patterns to this list to prevent Emacs searching them for local | ||
| 601 | variables of any kind (not just mode specifiers). | ||
| 602 | |||
| 591 | If @var{keep-mode-if-same} is non-@code{nil}, this function does not | 603 | If @var{keep-mode-if-same} is non-@code{nil}, this function does not |
| 592 | call the mode command if the buffer is already in the proper major | 604 | call the mode command if the buffer is already in the proper major |
| 593 | mode. For instance, @code{set-visited-file-name} sets this to | 605 | mode. 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 |
| 172 | not integral. The precise range of floating point numbers is | 173 | not integral. The precise range of floating point numbers is |
| 173 | machine-specific; it is the same as the range of the C data type | 174 | machine-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 | ||
| 177 | supported 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 |
| 177 | point (with at least one digit following), an exponent, or both. For | 180 | point (with at least one digit following), an exponent, or both. For |
| 178 | example, @samp{1500.0}, @samp{15e2}, @samp{15.0e2}, @samp{1.5e3}, and | 181 | example, @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 |
| 180 | value is 1500. They are all equivalent. You can also use a minus sign | 183 | value is 1500. They are all equivalent. You can also use a minus |
| 181 | to write negative floating point numbers, as in @samp{-1.0}. | 184 | sign 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 | ||
| 187 | respect to @code{equal} and @code{=}), even though the two are | ||
| 188 | distinguishable 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 |
| 189 | which provides for positive infinity and negative infinity as floating point | 195 | infinity and negative infinity as floating point values. It also |
| 190 | values. It also provides for a class of values called NaN or | 196 | provides for a class of values called NaN or ``not-a-number''; |
| 191 | ``not-a-number''; numerical functions return such values in cases where | 197 | numerical functions return such values in cases where there is no |
| 192 | there is no correct answer. For example, @code{(/ 0.0 0.0)} returns a | 198 | correct answer. For example, @code{(/ 0.0 0.0)} returns a NaN. (NaN |
| 193 | NaN. For practical purposes, there's no significant difference between | 199 | values can also carry a sign, but for practical purposes there's no |
| 194 | different NaN values in Emacs Lisp, and there's no rule for precisely | 200 | significant difference between different NaN values in Emacs Lisp.) |
| 195 | which NaN value should be used in a particular case, so Emacs Lisp | 201 | Here are the read syntaxes for these special floating point values: |
| 196 | doesn't try to distinguish them (but it does report the sign, if you | ||
| 197 | print it). Here are the read syntaxes for these special floating | ||
| 198 | point 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 |
| 210 | itself using @code{=}. That returns @code{nil} for a NaN, and | 213 | This predicate tests whether its argument is NaN, and returns @code{t} |
| 211 | @code{t} for any other floating point value. | 214 | if so, @code{nil} otherwise. The argument must be a number. |
| 215 | @end defun | ||
| 216 | |||
| 217 | The following functions are specialized for handling floating point | ||
| 218 | numbers: | ||
| 219 | |||
| 220 | @defun frexp x | ||
| 221 | This function returns a cons cell @code{(@var{sig} . @var{exp})}, | ||
| 222 | where @var{sig} and @var{exp} are respectively the significand and | ||
| 223 | exponent 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 | 234 | This function returns a floating point number corresponding to the |
| 215 | @code{=} consider them equal values. | 235 | significand @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 |
| 218 | point number (or estimate the logarithm of an integer): | 239 | This function copies the sign of @var{x2} to the value of @var{x1}, |
| 240 | and returns the result. @var{x1} and @var{x2} must be floating point | ||
| 241 | numbers. | ||
| 242 | @end defun | ||
| 219 | 243 | ||
| 220 | @defun logb number | 244 | @defun logb number |
| 221 | This function returns the binary exponent of @var{number}. More | 245 | This 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 | ||
| 234 | The mathematical constant @math{e} (2.71828@dots{}). | ||
| 235 | @end defvar | ||
| 236 | |||
| 237 | @defvar float-pi | ||
| 238 | The 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 |
| 1125 | This is the exponential function; it returns | 1141 | This 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 | ||
| 1132 | to the power @var{arg}. | ||
| 1133 | @tex | ||
| 1134 | @math{e} | ||
| 1135 | @end tex | ||
| 1136 | @ifnottex | ||
| 1137 | @i{e} | ||
| 1138 | @end ifnottex | ||
| 1139 | is a fundamental mathematical constant also called the base of natural | ||
| 1140 | logarithms. | ||
| 1141 | @end defun | 1143 | @end defun |
| 1142 | 1144 | ||
| 1143 | @defun log arg &optional base | 1145 | @defun log arg &optional base |
| 1144 | This function returns the logarithm of @var{arg}, with base @var{base}. | 1146 | This function returns the logarithm of @var{arg}, with base |
| 1145 | If 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 | ||
| 1152 | is used. If @var{arg} is negative, it signals a @code{domain-error} | ||
| 1153 | error. | ||
| 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, | |||
| 1185 | it signals a @code{domain-error} error. | 1181 | it signals a @code{domain-error} error. |
| 1186 | @end defun | 1182 | @end defun |
| 1187 | 1183 | ||
| 1184 | In addition, Emacs defines the following common mathematical | ||
| 1185 | constants: | ||
| 1186 | |||
| 1187 | @defvar float-e | ||
| 1188 | The mathematical constant @math{e} (2.71828@dots{}). | ||
| 1189 | @end defvar | ||
| 1190 | |||
| 1191 | @defvar float-pi | ||
| 1192 | The 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 | ||
| 1219 | If @var{limit} is @code{t}, it means to choose a new seed based on the | 1226 | If @var{limit} is @code{t}, it means to choose a new seed based on the |
| 1220 | current time of day and on Emacs's process @acronym{ID} number. | 1227 | current time of day and on Emacs's process @acronym{ID} number. |
| 1221 | @c "Emacs'" is incorrect usage! | ||
| 1222 | 1228 | ||
| 1223 | On some machines, any integer representable in Lisp may be the result | 1229 | On some machines, any integer representable in Lisp may be the result |
| 1224 | of @code{random}. On other machines, the result can never be larger | 1230 | of @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 |
| 428 | 2**26 | 428 | 2**26 |
| 429 | @end ifnottex | 429 | @end ifnottex |
| 430 | bit as well as the code for the corresponding non-control | 430 | bit as well as the code for the corresponding non-control character. |
| 431 | character. Ordinary terminals have no way of generating non-@acronym{ASCII} | 431 | Ordinary text terminals have no way of generating non-@acronym{ASCII} |
| 432 | control characters, but you can generate them straightforwardly using X | 432 | control characters, but you can generate them straightforwardly using |
| 433 | and other window systems. | 433 | X 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 |
| 436 | the control equivalent of @kbd{?}: | 436 | the control equivalent of @kbd{?}: |
| @@ -501,10 +501,10 @@ character is upper case or lower case. Emacs uses the | |||
| 501 | @end ifnottex | 501 | @end ifnottex |
| 502 | bit to indicate that the shift key was used in typing a control | 502 | bit to indicate that the shift key was used in typing a control |
| 503 | character. This distinction is possible only when you use X terminals | 503 | character. This distinction is possible only when you use X terminals |
| 504 | or other special terminals; ordinary terminals do not report the | 504 | or other special terminals; ordinary text terminals do not report the |
| 505 | distinction to the computer in any way. The Lisp syntax for | 505 | distinction. The Lisp syntax for the shift bit is @samp{\S-}; thus, |
| 506 | the 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 |
| 507 | represents the shifted-control-o character. | 507 | character. |
| 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, | |||
| 541 | independently. | 541 | independently. |
| 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, |
| 545 | are normally used only by comparing an unknown symbol with a few | 545 | and are normally used only by comparing an unknown symbol with a few |
| 546 | specific alternatives. | 546 | specific 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 |
| 620 | elements. There are two kinds of sequence in Emacs Lisp, lists and | 620 | elements. There are two kinds of sequence in Emacs Lisp: @dfn{lists} |
| 621 | arrays. Thus, an object of type list or of type array is also | 621 | and @dfn{arrays}. |
| 622 | considered 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 | 624 | elements of any type, and its length can be easily changed by adding |
| 625 | bool-vectors. Vectors can hold elements of any type, but string | 625 | or removing elements. See the next subsection for more about lists. |
| 626 | elements must be characters, and bool-vector elements must be @code{t} | 626 | |
| 627 | or @code{nil}. Char-tables are like vectors except that they are | 627 | Arrays are fixed-length sequences. They are further subdivided into |
| 628 | indexed by any valid character code. The characters in a string can | 628 | strings, vectors, char-tables and bool-vectors. Vectors can hold |
| 629 | have text properties like characters in a buffer (@pxref{Text | 629 | elements of any type, whereas string elements must be characters, and |
| 630 | Properties}), but vectors do not support text properties, even when | 630 | bool-vector elements must be @code{t} or @code{nil}. Char-tables are |
| 631 | their elements happen to be characters. | 631 | like vectors except that they are indexed by any valid character code. |
| 632 | 632 | The characters in a string can have text properties like characters in | |
| 633 | Lists, strings and the other array types are different, but they have | 633 | a buffer (@pxref{Text Properties}), but vectors do not support text |
| 634 | important similarities. For example, all have a length @var{l}, and all | 634 | properties, even when their elements happen to be characters. |
| 635 | have elements which can be indexed from zero to @var{l} minus one. | 635 | |
| 636 | Several functions, called sequence functions, accept any kind of | 636 | Lists, strings and the other array types also share important |
| 637 | sequence. For example, the function @code{elt} can be used to extract | 637 | similarities. For example, all have a length @var{l}, and all have |
| 638 | an element of a sequence, given its index. @xref{Sequences Arrays | 638 | elements which can be indexed from zero to @var{l} minus one. Several |
| 639 | Vectors}. | 639 | functions, called sequence functions, accept any kind of sequence. |
| 640 | For example, the function @code{length} reports the length of any kind | ||
| 641 | of 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 |
| 642 | sequences are always created anew upon reading. If you read the read | 644 | sequences 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 | 656 | the @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 | 657 | Lisp object. We also say that ``the @sc{car} of this cons cell is'' |
| 656 | this cons cell is'' whatever object its @sc{car} slot currently holds, | 658 | whatever object its @sc{car} slot currently holds, and likewise for |
| 657 | and likewise for the @sc{cdr}. | 659 | the @sc{cdr}. |
| 658 | |||
| 659 | @quotation | ||
| 660 | A note to C programmers: in Lisp, we do not distinguish between | ||
| 661 | ``holding'' a value and ``pointing to'' the value, because pointers in | ||
| 662 | Lisp 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 |
| 667 | empty list. The empty list is actually the symbol @code{nil}. | 664 | empty 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 |
| 669 | cells are used as part of lists, the phrase @dfn{list structure} has | 666 | of lists, we refer to any structure made out of cons cells as a |
| 670 | come to refer to any structure made out of cons cells. | 667 | @dfn{list structure}. |
| 668 | |||
| 669 | @cindex linked list | ||
| 670 | @quotation | ||
| 671 | A note to C programmers: a Lisp list thus works as a @dfn{linked list} | ||
| 672 | built up of cons cells. Because pointers in Lisp are implicit, we do | ||
| 673 | not 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 |
| 1029 | constant by writing it literally. There are two text representations | 1034 | string constant by writing it literally. There are two text |
| 1030 | for non-@acronym{ASCII} characters in Emacs strings (and in buffers): unibyte | 1035 | representations for non-@acronym{ASCII} characters in Emacs strings |
| 1031 | and multibyte. If the string constant is read from a multibyte source, | 1036 | (and in buffers): unibyte and multibyte (@pxref{Text |
| 1032 | such as a multibyte buffer or string, or a file that would be visited as | 1037 | Representations}). If the string constant is read from a multibyte |
| 1033 | multibyte, then the character is read as a multibyte character, and that | 1038 | source, such as a multibyte buffer or string, or a file that would be |
| 1034 | makes the string multibyte. If the string constant is read from a | 1039 | visited as multibyte, then Emacs reads the non-@acronym{ASCII} |
| 1035 | unibyte source, then the character is read as unibyte and that makes the | 1040 | character as a multibyte character and automatically makes the string |
| 1036 | string unibyte. | 1041 | a multibyte string. If the string constant is read from a unibyte |
| 1037 | 1042 | source, then Emacs reads the non-@acronym{ASCII} character as unibyte, | |
| 1038 | You can also represent a multibyte non-@acronym{ASCII} character with its | 1043 | and makes the string unibyte. |
| 1039 | character code: use a hex escape, @samp{\x@var{nnnnnnn}}, with as many | 1044 | |
| 1040 | digits as necessary. (Multibyte non-@acronym{ASCII} character codes are all | 1045 | Instead of writing a non-@acronym{ASCII} character literally into a |
| 1041 | greater than 256.) Any character which is not a valid hex digit | 1046 | multibyte string, you can write it as its character code using a hex |
| 1042 | terminates this construct. If the next character in the string could be | 1047 | escape, @samp{\x@var{nnnnnnn}}, with as many digits as necessary. |
| 1043 | interpreted as a hex digit, write @w{@samp{\ }} (backslash and space) to | 1048 | (Multibyte non-@acronym{ASCII} character codes are all greater than |
| 1044 | terminate the hex escape---for example, @w{@samp{\xe0\ }} represents | 1049 | 256.) You can also specify a character in a multibyte string using |
| 1045 | one character, @samp{a} with grave accent. @w{@samp{\ }} in a string | 1050 | the @samp{\u} or @samp{\U} Unicode escape syntax (@pxref{General |
| 1046 | constant is just like backslash-newline; it does not contribute any | 1051 | Escape Syntax}). In either case, any character which is not a valid |
| 1047 | character to the string, but it does terminate the preceding hex escape. | 1052 | hex digit terminates the construct. If the next character in the |
| 1053 | string 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 | ||
| 1056 | accent. @w{@samp{\ }} in a string constant is just like | ||
| 1057 | backslash-newline; it does not contribute any character to the string, | ||
| 1058 | but it does terminate the preceding hex escape. Using any hex escape | ||
| 1059 | in a string (even for an @acronym{ASCII} character) automatically | ||
| 1060 | forces 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 |
| 1050 | character code, which must be in the range from 128 (0200 octal) to | 1063 | character code, which must be in the range from 128 (0200 octal) to |
| 1051 | 255 (0377 octal). If you write all such character codes in octal and | 1064 | 255 (0377 octal). If you write all such character codes in octal and |
| 1052 | the string contains no other characters forcing it to be multibyte, | 1065 | the string contains no other characters forcing it to be multibyte, |
| 1053 | this produces a unibyte string. However, using any hex escape in a | 1066 | this produces a unibyte string. |
| 1054 | string (even for an @acronym{ASCII} character) forces the string to be | ||
| 1055 | multibyte. | ||
| 1056 | |||
| 1057 | You can also specify characters in a string by their numeric values | ||
| 1058 | in Unicode, using @samp{\u} and @samp{\U} (@pxref{Character Type}). | ||
| 1059 | |||
| 1060 | @xref{Text Representations}, for more information about the two | ||
| 1061 | text 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 |
| 1926 | objects. Other functions test equality of contents between objects of specific | 1931 | objects. Other functions test equality of contents between objects of |
| 1927 | types, e.g., strings. For these predicates, see the appropriate chapter | 1932 | specific types, e.g.@: strings. For these predicates, see the |
| 1928 | describing the data type. | 1933 | appropriate chapter describing the data type. |
| 1929 | 1934 | ||
| 1930 | @defun eq object1 object2 | 1935 | @defun eq object1 object2 |
| 1931 | This function returns @code{t} if @var{object1} and @var{object2} are | 1936 | This function returns @code{t} if @var{object1} and @var{object2} are |
| 1932 | the same object, @code{nil} otherwise. | 1937 | the same object, and @code{nil} otherwise. |
| 1933 | 1938 | ||
| 1934 | @code{eq} returns @code{t} if @var{object1} and @var{object2} are | 1939 | If @var{object1} and @var{object2} are integers with the same value, |
| 1935 | integers with the same value. Also, since symbol names are normally | 1940 | they are considered to be the same object (i.e.@: @code{eq} returns |
| 1936 | unique, 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 | 1942 | same name, they are normally the same object---but see @ref{Creating |
| 1938 | arguments with the same contents or elements are not necessarily | 1943 | Symbols} 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 | 1944 | strings), two arguments with the same contents or elements are not |
| 1940 | object, meaning that a change in the contents of one will be reflected | 1945 | necessarily @code{eq} to each other: they are @code{eq} only if they |
| 1941 | by the same change in the contents of the other. | 1946 | are the same object, meaning that a change in the contents of one will |
| 1947 | be 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 | ||
| 1991 | The @code{make-symbol} function returns an uninterned symbol, distinct | 1998 | The @code{make-symbol} function returns an uninterned symbol, distinct |
| 1992 | from the symbol that is used if you write the name in a Lisp expression. | 1999 | from the symbol that is used if you write the name in a Lisp expression. |
| 1993 | Distinct symbols with the same name are not @code{eq}. @xref{Creating | 2000 | Distinct 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 |
| 2005 | This function returns @code{t} if @var{object1} and @var{object2} have | 2012 | This function returns @code{t} if @var{object1} and @var{object2} have |
| 2006 | equal components, @code{nil} otherwise. Whereas @code{eq} tests if its | 2013 | equal components, and @code{nil} otherwise. Whereas @code{eq} tests |
| 2007 | arguments are the same object, @code{equal} looks inside nonidentical | 2014 | if its arguments are the same object, @code{equal} looks inside |
| 2008 | arguments to see if their elements or contents are the same. So, if two | 2015 | nonidentical arguments to see if their elements or contents are the |
| 2009 | objects are @code{eq}, they are @code{equal}, but the converse is not | 2016 | same. So, if two objects are @code{eq}, they are @code{equal}, but |
| 2010 | always true. | 2017 | the 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 | ||
| 2061 | Comparison of strings is case-sensitive, but does not take account of | 2068 | Comparison of strings is case-sensitive, but does not take account of |
| 2062 | text properties---it compares only the characters in the strings. Use | 2069 | text 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 |
| 2064 | technical reasons, a unibyte string and a multibyte string are | 2071 | compare text properties. For technical reasons, a unibyte string and |
| 2065 | @code{equal} if and only if they contain the same sequence of | 2072 | a multibyte string are @code{equal} if and only if they contain the |
| 2066 | character codes and all these codes are either in the range 0 through | 2073 | same sequence of character codes and all these codes are either in the |
| 2067 | 127 (@acronym{ASCII}) or 160 through 255 (@code{eight-bit-graphic}). | 2074 | range 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 |
| 12 | types: lists and arrays. In other words, any list is a sequence, and | 12 | and arrays. In other words, any list is a sequence, and any array is |
| 13 | any array is a sequence. The common property that all sequences have is | 13 | a sequence. The common property that all sequences have is that each |
| 14 | that each is an ordered collection of elements. | 14 | is 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 |
| 17 | elements. All the elements are accessible in constant time. The four | 17 | elements. 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. |
| 63 | common property of all sequences is that they are ordered collections of | ||
| 64 | elements. This section describes functions that accept any kind of | ||
| 65 | sequence. | ||
| 66 | 64 | ||
| 67 | @defun sequencep object | 65 | @defun sequencep object |
| 68 | Returns @code{t} if @var{object} is a list, vector, string, | 66 | This function returns @code{t} if @var{object} is a list, vector, |
| 69 | bool-vector, or char-table, @code{nil} otherwise. | 67 | string, 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 |
| 152 | Returns a copy of @var{sequence}. The copy is the same type of object | 150 | This function returns a copy of @var{sequence}. The copy is the same |
| 153 | as the original sequence, and it has the same elements in the same order. | 151 | type of object as the original sequence, and it has the same elements |
| 152 | in the same order. | ||
| 154 | 153 | ||
| 155 | Storing a new element into the copy does not affect the original | 154 | Storing 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 | |||
| 394 | representation of a byte-compiled function (@pxref{Byte Compilation}), | 393 | representation of a byte-compiled function (@pxref{Byte Compilation}), |
| 395 | and more. | 394 | and 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 |
| 398 | and count up from there. | 397 | element 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. |
| 401 | Thus, a vector whose elements are the symbols @code{a}, @code{b} and | 400 | Thus, a vector whose elements are the symbols @code{a}, @code{b} and |
| @@ -728,3 +727,96 @@ bv | |||
| 728 | @noindent | 727 | @noindent |
| 729 | These results make sense because the binary codes for control-_ and | 728 | These results make sense because the binary codes for control-_ and |
| 730 | control-W are 11111 and 10111, respectively. | 729 | control-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, | ||
| 736 | deletion, rotation, and modulo-indexed reference and traversal. An | ||
| 737 | efficient ring data structure is implemented by the @code{ring} | ||
| 738 | package. It provides the functions listed in this section. | ||
| 739 | |||
| 740 | Note that several ``rings'' in Emacs, like the kill ring and the | ||
| 741 | mark ring, are actually implemented as simple lists, @emph{not} using | ||
| 742 | the @code{ring} package; thus the following functions won't work on | ||
| 743 | them. | ||
| 744 | |||
| 745 | @defun make-ring size | ||
| 746 | This 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 | ||
| 751 | This returns @code{t} if @var{object} is a ring, @code{nil} otherwise. | ||
| 752 | @end defun | ||
| 753 | |||
| 754 | @defun ring-size ring | ||
| 755 | This returns the maximum capacity of the @var{ring}. | ||
| 756 | @end defun | ||
| 757 | |||
| 758 | @defun ring-length ring | ||
| 759 | This returns the number of objects that @var{ring} currently contains. | ||
| 760 | The value will never exceed that returned by @code{ring-size}. | ||
| 761 | @end defun | ||
| 762 | |||
| 763 | @defun ring-elements ring | ||
| 764 | This returns a list of the objects in @var{ring}, in order, newest first. | ||
| 765 | @end defun | ||
| 766 | |||
| 767 | @defun ring-copy ring | ||
| 768 | This returns a new ring which is a copy of @var{ring}. | ||
| 769 | The new ring contains the same (@code{eq}) objects as @var{ring}. | ||
| 770 | @end defun | ||
| 771 | |||
| 772 | @defun ring-empty-p ring | ||
| 773 | This 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 | ||
| 777 | correspond to older elements. Indices are computed modulo the ring | ||
| 778 | length. Index @minus{}1 corresponds to the oldest element, @minus{}2 | ||
| 779 | to the next-oldest, and so forth. | ||
| 780 | |||
| 781 | @defun ring-ref ring index | ||
| 782 | This 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 | ||
| 788 | This inserts @var{object} into @var{ring}, making it the newest | ||
| 789 | element, and returns @var{object}. | ||
| 790 | |||
| 791 | If the ring is full, insertion removes the oldest element to | ||
| 792 | make room for the new element. | ||
| 793 | @end defun | ||
| 794 | |||
| 795 | @defun ring-remove ring &optional index | ||
| 796 | Remove an object from @var{ring}, and return that object. The | ||
| 797 | argument @var{index} specifies which item to remove; if it is | ||
| 798 | @code{nil}, that means to remove the oldest item. If @var{ring} is | ||
| 799 | empty, @code{ring-remove} signals an error. | ||
| 800 | @end defun | ||
| 801 | |||
| 802 | @defun ring-insert-at-beginning ring object | ||
| 803 | This inserts @var{object} into @var{ring}, treating it as the oldest | ||
| 804 | element. The return value is not significant. | ||
| 805 | |||
| 806 | If the ring is full, this function removes the newest element to make | ||
| 807 | room 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 | ||
| 812 | use 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 |
| 411 | This function returns @code{t} if the characters of the two strings | 411 | This function returns @code{t} if the characters of the two strings |
| 412 | match exactly. Symbols are also allowed as arguments, in which case | 412 | match exactly. Symbols are also allowed as arguments, in which case |
| 413 | their print names are used. | 413 | the symbol names are used. Case is always significant, regardless of |
| 414 | Case is always significant, regardless of @code{case-fold-search}. | 414 | @code{case-fold-search}. |
| 415 | |||
| 416 | This function is equivalent to @code{equal} for comparing two strings | ||
| 417 | (@pxref{Equality Predicates}). In particular, the text properties of | ||
| 418 | the two strings are ignored. But if either argument is not a string | ||
| 419 | or 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 | ||
| 425 | The function @code{string=} ignores the text properties of the two | ||
| 426 | strings. When @code{equal} (@pxref{Equality Predicates}) compares two | ||
| 427 | strings, it uses @code{string=}. | ||
| 428 | |||
| 429 | For technical reasons, a unibyte and a multibyte string are | 430 | For 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 |
| 431 | character codes and all these codes are either in the range 0 through | 432 | character 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 |
| 44 | The @dfn{print name cell} holds a string that names the symbol for | 44 | The symbol's name. |
| 45 | reading 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 |
| 49 | The @dfn{value cell} holds the current value of the symbol as a | 48 | The symbol's current value as a variable. |
| 50 | variable. When a symbol is used as a form, the value of the form is the | ||
| 51 | contents 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 |
| 56 | The @dfn{function cell} holds the function definition of the symbol. | 52 | The symbol's function definition. It can also hold a symbol, a |
| 57 | When a symbol is used as a function, its function definition is used in | 53 | keymap, or a keyboard macro. |
| 58 | its place. This cell is also used to make a symbol stand for a keymap | ||
| 59 | or a keyboard macro, for editor command execution. Because each symbol | ||
| 60 | has separate value and function cells, variables names and function names do | ||
| 61 | not 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 |
| 65 | The @dfn{property list cell} holds the property list of the symbol. See | 57 | The 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 |
| 70 | other three cells can be set individually to any specified Lisp object. | 61 | The print name cell always holds a string, and cannot be changed. |
| 71 | 62 | Each 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 | |
| 73 | Since 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. |
| 74 | not to have two symbols with the same name. The Lisp reader ensures | 65 | Since symbols are represented textually by their names, it is |
| 75 | this: every time it reads a symbol, it looks for an existing symbol with | 66 | important not to have two symbols with the same name. The Lisp reader |
| 76 | the specified name before it creates a new one. (In GNU Emacs Lisp, | 67 | ensures this: every time it reads a symbol, it looks for an existing |
| 77 | this lookup uses a hashing algorithm and an obarray; see @ref{Creating | 68 | symbol with the specified name before it creates a new one. To get a |
| 78 | Symbols}.) | 69 | symbol's name, use the function @code{symbol-name} (@pxref{Creating |
| 79 | 70 | Symbols}). | |
| 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 |
| 82 | a Lisp expression (@pxref{Evaluation}). Any Lisp object is a legitimate | 73 | you get if the symbol itself is evaluated as a Lisp expression. |
| 83 | value. Certain symbols have values that cannot be changed; these | 74 | @xref{Variables}, for details about how values are set and retrieved, |
| 84 | include @code{nil} and @code{t}, and any symbol whose name starts with | 75 | including complications such as @dfn{local bindings} and @dfn{scoping |
| 85 | @samp{:} (those are called @dfn{keywords}). @xref{Constant Variables}. | 76 | rules}. Most symbols can have any Lisp object as a value, but certain |
| 86 | 77 | special 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 |
| 88 | the function stored in the function cell of the symbol @code{foo}. We | 79 | @samp{:} (those are called @dfn{keywords}). @xref{Constant |
| 89 | make the distinction explicit only when necessary. In normal | 80 | Variables}. |
| 90 | usage, 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 |
| 92 | Lisp interpreter expects to see there (@pxref{Evaluation}). Keyboard | 83 | refer to ``the function @code{foo}'' when we really mean the function |
| 93 | macros (@pxref{Keyboard Macros}), keymaps (@pxref{Keymaps}) and | 84 | stored in the function cell of @code{foo}; we make the distinction |
| 94 | autoload objects (@pxref{Autoloading}) are also sometimes stored in | 85 | explicit only when necessary. Typically, the function cell is used to |
| 95 | the function cells of symbols. | 86 | hold a function (@pxref{Functions}) or a macro (@pxref{Macros}). |
| 87 | However, it can also be used to hold a symbol (@pxref{Function | ||
| 88 | Indirection}), keyboard macro (@pxref{Keyboard Macros}), keymap | ||
| 89 | (@pxref{Keymaps}), or autoload object (@pxref{Autoloading}). To get | ||
| 90 | the 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 |
| 98 | property list (@pxref{Property Lists}), as a number of functions expect | 94 | property list. To get a symbol's function cell, use the function |
| 99 | to 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 |
| 102 | that the cell does not reference any object. (This is not the same | 98 | that 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 | |||
| 104 | symbol @code{nil}.) Examining a function or value cell that is void | 100 | symbol @code{nil}.) Examining a function or value cell that is void |
| 105 | results in an error, such as @samp{Symbol's value as variable is void}. | 101 | results 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 | 104 | names and function names do not conflict. For example, the symbol |
| 109 | the 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 |
| 110 | the four cells of the symbol @code{buffer-file-name}: | 106 | visited in the current buffer) as well as a function definition (a |
| 107 | primitive function that returns the name of the file): | ||
| 111 | 108 | ||
| 112 | @example | 109 | @example |
| 113 | (symbol-name 'buffer-file-name) | 110 | buffer-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 | ||
| 124 | Because this symbol is the variable which holds the name of the file | ||
| 125 | being visited in the current buffer, the value cell contents we see are | ||
| 126 | the name of the source file of this chapter of the Emacs Lisp Manual. | ||
| 127 | The property list cell contains the list @code{(variable-documentation | ||
| 128 | 29529)} which tells the documentation functions where to find the | ||
| 129 | documentation string for the variable @code{buffer-file-name} in the | ||
| 130 | @file{DOC-@var{version}} file. (29529 is the offset from the beginning | ||
| 131 | of the @file{DOC-@var{version}} file to where that documentation string | ||
| 132 | begins---see @ref{Documentation Basics}.) The function cell contains | ||
| 133 | the function for returning the name of the file. | ||
| 134 | @code{buffer-file-name} names a primitive function, which has no read | ||
| 135 | syntax and prints in hash notation (@pxref{Primitive Function Type}). A | ||
| 136 | symbol 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 |
| 144 | intention to use a certain symbol in a particular way. In Emacs Lisp, | 121 | announces your intention to use a symbol in a particular way. It |
| 145 | you can define a symbol as a variable, or define it as a function (or | 122 | typically specifies a value or meaning for the symbol for one kind of |
| 146 | macro), or both independently. | 123 | use, plus documentation for its meaning when used in this way. Thus, |
| 147 | 124 | when you define a symbol as a variable, you can supply an initial | |
| 148 | A definition construct typically specifies a value or meaning for the | 125 | value for the variable, plus documentation for the variable. |
| 149 | symbol for one kind of use, plus documentation for its meaning when used | ||
| 150 | in this way. Thus, when you define a symbol as a variable, you can | ||
| 151 | supply an initial value for the variable, plus documentation for the | ||
| 152 | variable. | ||
| 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 |
| 155 | symbol as a global variable. They are documented in detail in | 128 | symbol as a @dfn{global variable}---a variable that can be accessed at |
| 156 | @ref{Defining Variables}. For defining user option variables that can | 129 | any point in a Lisp program. @xref{Variables}, for details about |
| 157 | be customized, use @code{defcustom} (@pxref{Customization}). | 130 | variables. 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. | ||
| 136 | However, you ought to write a variable definition for each global | ||
| 137 | variable that you want to use; otherwise, your Lisp program may not | ||
| 138 | act 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 |
| 160 | expression and storing it in the function cell of the symbol. This | 142 | expression 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 | |||
| 171 | that cell can hold only one Lisp object at any given time. | 153 | that 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 |
| 175 | as a variable or function. Thus, you can make a symbol a global | 157 | both as a variable (e.g.@: with @code{defvar}) and as a function or |
| 176 | variable with @code{setq}, whether you define it first or not. The real | 158 | macro (e.g.@: with @code{defun}). Such definitions do not conflict. |
| 177 | purpose of definitions is to guide programmers and programming tools. | 159 | |
| 178 | They 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, | 161 | example, the @kbd{C-h f} and @kbd{C-h v} commands create help buffers |
| 180 | utilities such as @file{etags} and @file{make-docfile} recognize | 162 | containing links to the relevant variable, function, or macro |
| 181 | definitions, and add appropriate information to tag tables and the | 163 | definitions. @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 |
| 258 | several obarrays. | 239 | for 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 |
| 450 | information to various Lisp function names or variables. If your | 431 | information to various Lisp function names or variables. If your |
| 451 | program keeps all of its associations in one association list, it will | 432 | program keeps all such information in one association list, it will |
| 452 | typically need to search that entire list each time it checks for an | 433 | typically need to search that entire list each time it checks for an |
| 453 | association. This could be slow. By contrast, if you keep the same | 434 | association for a particular Lisp function name or variable, which |
| 454 | information in the property lists of the function names or variables | 435 | could be slow. By contrast, if you keep the same information in the |
| 455 | themselves, each search will scan only the length of one property list, | 436 | property lists of the function names or variables themselves, each |
| 456 | which is usually short. This is why the documentation for a variable is | 437 | search will scan only the length of one property list, which is |
| 438 | usually short. This is why the documentation for a variable is | ||
| 457 | recorded in a property named @code{variable-documentation}. The byte | 439 | recorded in a property named @code{variable-documentation}. The byte |
| 458 | compiler likewise uses properties to record those functions needing | 440 | compiler likewise uses properties to record those functions needing |
| 459 | special treatment. | 441 | special 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 | ||
| 1664 | This is a list of regular expressions. If a file has a name | ||
| 1665 | matching an element of this list, then it is not scanned for | ||
| 1666 | any form of file-local variable. For examples of why you might want | ||
| 1667 | to 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 |
| 1664 | This function parses, and binds or evaluates as appropriate, any local | 1671 | This function parses, and binds or evaluates as appropriate, any local |
| 1665 | variables specified by the contents of the current buffer. The variable | 1672 | variables 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 |
| 3105 | This function returns a new object representing @var{frame}'s current | 3105 | This function returns a new object representing @var{frame}'s current |
| 3106 | window configuration. The default for @var{frame} is the selected | 3106 | window configuration. The default for @var{frame} is the selected |
| 3107 | frame. This function saves copies of window parameters listed by the | 3107 | frame. The variable @code{window-persistent-parameters} specifies |
| 3108 | variable @code{window-persistent-parameters}, see @ref{Window | 3108 | whether and which window parameters are saved by this function, see |
| 3109 | Parameters} 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 |
| 3215 | frame into the root window of that very frame only). | 3215 | frame 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 |
| 3218 | This function returns the state of @var{window} as a Lisp object. The | 3218 | This function returns the state of @var{window} as a Lisp object. The |
| 3219 | argument @var{window} can be any window and defaults to the root window | 3219 | argument @var{window} can be any window and defaults to the root window |
| 3220 | of the selected frame. | 3220 | of the selected frame. |
| 3221 | 3221 | ||
| 3222 | If the optional argument @var{ignore} is non-@code{nil}, this means to | 3222 | If the optional argument @var{writable} is non-@code{nil}, this means to |
| 3223 | not use markers for sampling positions like @code{window-point} or | 3223 | not 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 |
| 3225 | state shall be written on disk and read back in another session. | 3225 | state shall be written to disk and read back in another session. |
| 3226 | 3226 | ||
| 3227 | The variable @code{window-persistent-parameters} specifies whether and | 3227 | Together, the argument @var{writable} and the variable |
| 3228 | which window parameters are saved by this function, see @ref{Window | 3228 | @code{window-persistent-parameters} specify which window parameters are |
| 3229 | Parameters} for details. | 3229 | saved by this function, see @ref{Window Parameters} for details. |
| 3230 | @end defun | 3230 | @end defun |
| 3231 | 3231 | ||
| 3232 | The value returned by @code{window-state-get} can be converted, using | 3232 | The value returned by @code{window-state-get} can be used in the same |
| 3233 | one of the functions defined by Desktop Save Mode (@pxref{Desktop Save | 3233 | session to make a clone of a window in another window. It can be also |
| 3234 | Mode}), to an object that can be written to a file. Such objects can be | 3234 | written to disk and read back in another session. In either case, use |
| 3235 | read back and converted to a Lisp object representing the state of the | 3235 | the function described next to restore the state of the window. |
| 3236 | window. That Lisp object can be used as argument for the following | ||
| 3237 | function 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 |
| 3240 | This function puts the window state @var{state} into @var{window}. The | 3238 | This 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 | |||
| 3281 | window parameters. This means, that when you change the value of a | 3279 | window parameters. This means, that when you change the value of a |
| 3282 | parameter within the body of a @code{save-window-excursion}, the | 3280 | parameter within the body of a @code{save-window-excursion}, the |
| 3283 | previous value is not restored upon exit of that macro. It also means | 3281 | previous value is not restored upon exit of that macro. It also means |
| 3284 | that when you clone via @code{window-state-put} a window state saved | 3282 | that when you restore via @code{window-state-put} a window state saved |
| 3285 | earlier by @code{window-state-get}, the cloned windows come up with no | 3283 | earlier by @code{window-state-get}, all cloned windows have their |
| 3286 | parameters at all. The following variable allows to override the | 3284 | parameters reset to @code{nil}. The following variable allows to |
| 3287 | standard behavior. | 3285 | override the standard behavior. |
| 3288 | 3286 | ||
| 3289 | @defvar window-persistent-parameters | 3287 | @defvar window-persistent-parameters |
| 3290 | This variable is an alist specifying which parameters get saved by | 3288 | This 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 | ||
| 3295 | The @sc{car} of each entry of this alist is the symbol specifying the | 3293 | The @sc{car} of each entry of this alist is the symbol specifying the |
| 3296 | parameter. The @sc{cdr} must be one of the following: | 3294 | parameter. The @sc{cdr} should be one of the following: |
| 3297 | 3295 | ||
| 3298 | @table @asis | 3296 | @table @asis |
| 3299 | @item @code{state} | ||
| 3300 | This value means the parameter is saved by @code{window-state-get} | ||
| 3301 | provided 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} |
| 3298 | This value means the parameter is neither saved by | ||
| 3299 | @code{window-state-get} nor by @code{current-window-configuration}. | ||
| 3300 | |||
| 3301 | @item @code{t} | ||
| 3305 | This value specifies that the parameter is saved by | 3302 | This 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} |
| 3307 | argument is @code{nil}, by @code{window-state-get}. | 3304 | argument is @code{nil}, by @code{window-state-get}. |
| 3308 | 3305 | ||
| 3309 | @item @code{t} | 3306 | @item @code{writable} |
| 3310 | This means that the parameter is saved unconditionally by both | 3307 | This 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 |
| 3312 | value should not be used for parameters whose values do not have a read | 3309 | value should not be used for parameters whose values do not have a read |
| 3313 | syntax. Otherwise, invoking @code{window-state-put} in another session | 3310 | syntax. Otherwise, invoking @code{window-state-put} in another session |
| 3314 | may fail with an @code{invalid-read-syntax} error. | 3311 | may fail with an @code{invalid-read-syntax} error. |
| 3315 | @end table | 3312 | @end table |
| 3316 | |||
| 3317 | Parameters 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 | ||
| 3320 | alone by @code{set-window-configuration} respectively are not installed | ||
| 3321 | by @code{window-state-put}. | ||
| 3322 | @end defvar | 3313 | @end defvar |
| 3323 | 3314 | ||
| 3324 | Some functions, notably @code{delete-window}, | 3315 | Some 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 @@ | |||
| 1 | 2012-01-23 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * pcl-cvs.texi (About PCL-CVS): Refer to vc-dir rather than vc-dired. | ||
| 4 | |||
| 5 | 2012-01-19 Eric Hanchrow <eric.hanchrow@gmail.com> | ||
| 6 | |||
| 7 | * tramp.texi (File): Tweak wording for the `scpc' option. | ||
| 8 | |||
| 1 | 2012-01-06 Lars Magne Ingebrigtsen <larsi@gnus.org> | 9 | 2012-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 |
| 9 | Copyright @copyright{} 1991-2012 | 9 | Copyright @copyright{} 1991-2012 Free Software Foundation, Inc. |
| 10 | Free Software Foundation, Inc. | ||
| 11 | 10 | ||
| 12 | @quotation | 11 | @quotation |
| 13 | Permission is granted to copy, distribute and/or modify this document | 12 | Permission is granted to copy, distribute and/or modify this document |
| @@ -136,10 +135,9 @@ Customization | |||
| 136 | PCL-CVS is a front-end to CVS versions 1.9 and later. | 135 | PCL-CVS is a front-end to CVS versions 1.9 and later. |
| 137 | It concisely shows the present status of a checked out module in an | 136 | It concisely shows the present status of a checked out module in an |
| 138 | Emacs buffer and provides single-key access to the most frequently used CVS | 137 | Emacs buffer and provides single-key access to the most frequently used CVS |
| 139 | commands. | 138 | commands. Note that the @code{vc-dir} command (@pxref{VC Directory |
| 140 | For Emacs users accustomed to VC, PCL-CVS can be thought of as a replacement | 139 | Mode, , , emacs, The GNU Emacs Manual}) provides similar |
| 141 | for VC-dired (@pxref{VC Directory Mode, , , emacs, The GNU | 140 | functionality, but for several version control systems, including CVS. |
| 142 | Emacs Manual}) specifically designed for CVS. | ||
| 143 | 141 | ||
| 144 | PCL-CVS was originally written many years ago by Per Cederqvist who | 142 | PCL-CVS was originally written many years ago by Per Cederqvist who |
| 145 | proudly maintained it until January 1996, at which point he released the | 143 | proudly 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 | ||
| 869 | Before you use this method, you shall check whether your @option{ssh} | 869 | Before you use this method, you should check whether your @option{ssh} |
| 870 | implementation does support this option. Try from the command line | 870 | implementation supports this option. Try from the command line |
| 871 | 871 | ||
| 872 | @example | 872 | @example |
| 873 | ssh localhost -o ControlMaster=yes | 873 | ssh localhost -o ControlMaster=yes /bin/true |
| 874 | @end example | 874 | @end example |
| 875 | 875 | ||
| 876 | If that command succeeds silently, then you can use @option{scpc}; but | ||
| 877 | if it fails like | ||
| 878 | |||
| 879 | @example | ||
| 880 | command-line: line 0: Bad configuration option: ControlMaster | ||
| 881 | @end example | ||
| 882 | |||
| 883 | then you cannot use it. | ||
| 884 | |||
| 876 | This method supports the @samp{-p} argument. | 885 | This method supports the @samp{-p} argument. |
| 877 | 886 | ||
| 878 | 887 | ||