diff options
| author | Joakim Verona | 2012-02-05 14:40:28 +0100 |
|---|---|---|
| committer | Joakim Verona | 2012-02-05 14:40:28 +0100 |
| commit | 8c5c7f5afa968d06efb6788cf680d5463c389d85 (patch) | |
| tree | a70876b87a7dbdcb936524880492f8fdc661fab0 /doc | |
| parent | fbdce5fed745bc78911980466d9374d1101487fc (diff) | |
| parent | 1ff980ae49715eb372acff8a193e36497a7665c4 (diff) | |
| download | emacs-8c5c7f5afa968d06efb6788cf680d5463c389d85.tar.gz emacs-8c5c7f5afa968d06efb6788cf680d5463c389d85.zip | |
ustream
Diffstat (limited to 'doc')
32 files changed, 968 insertions, 751 deletions
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index 871422f9bfe..ab4161c75b8 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog | |||
| @@ -1,3 +1,23 @@ | |||
| 1 | 2012-02-05 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * trouble.texi (Checklist): Mention debug-on-event. | ||
| 4 | |||
| 5 | * maintaining.texi (Maintaining): Add cross-ref to ERT. | ||
| 6 | |||
| 7 | 2012-02-04 Glenn Morris <rgm@gnu.org> | ||
| 8 | |||
| 9 | * macos.texi (Customization options specific to Mac OS / GNUstep): | ||
| 10 | New subsection. | ||
| 11 | |||
| 12 | * display.texi (Colors): Mention list-colors-sort. | ||
| 13 | |||
| 14 | * files.texi (File Conveniences): Mention image animation. | ||
| 15 | |||
| 16 | 2012-01-31 Chong Yidong <cyd@gnu.org> | ||
| 17 | |||
| 18 | * windows.texi (Split Window): C-mouse-2 doesn't work on GTK+ | ||
| 19 | scroll bars (Bug#10666). | ||
| 20 | |||
| 1 | 2012-01-28 Chong Yidong <cyd@gnu.org> | 21 | 2012-01-28 Chong Yidong <cyd@gnu.org> |
| 2 | 22 | ||
| 3 | * files.texi (Filesets): Fix typos. | 23 | * files.texi (Filesets): Fix typos. |
| @@ -8,7 +28,7 @@ | |||
| 8 | 28 | ||
| 9 | * buffers.texi (Select Buffer): Clarify explanation of switching | 29 | * buffers.texi (Select Buffer): Clarify explanation of switching |
| 10 | to new buffers. Fix description of next-buffer and | 30 | to new buffers. Fix description of next-buffer and |
| 11 | previous-buffer (Bug#10334). | 31 | previous-buffer (Bug#10334). |
| 12 | (Misc Buffer): Add xref to View Mode. | 32 | (Misc Buffer): Add xref to View Mode. |
| 13 | 33 | ||
| 14 | * text.texi (Fill Commands): Fix description of | 34 | * text.texi (Fill Commands): Fix description of |
diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi index 6e69b723204..8159b8cc6aa 100644 --- a/doc/emacs/display.texi +++ b/doc/emacs/display.texi | |||
| @@ -524,16 +524,18 @@ specify a color for a face---for instance, when customizing the face | |||
| 524 | or an @dfn{RGB triplet}. | 524 | or an @dfn{RGB triplet}. |
| 525 | 525 | ||
| 526 | @findex list-colors-display | 526 | @findex list-colors-display |
| 527 | @vindex list-colors-sort | ||
| 527 | A color name is a pre-defined name, such as @samp{dark orange} or | 528 | A color name is a pre-defined name, such as @samp{dark orange} or |
| 528 | @samp{medium sea green}. To view a list of color names, type @kbd{M-x | 529 | @samp{medium sea green}. To view a list of color names, type @kbd{M-x |
| 529 | list-colors-display}. If you run this command on a graphical display, | 530 | list-colors-display}. To control the order in which colors are shown, |
| 530 | it shows the full range of color names known to Emacs (these are the | 531 | customize @code{list-colors-sort}. If you run this command on a |
| 531 | standard X11 color names, defined in X's @file{rgb.txt} file). If you | 532 | graphical display, it shows the full range of color names known to Emacs |
| 532 | run the command on a text-only terminal, it shows only a small subset | 533 | (these are the standard X11 color names, defined in X's @file{rgb.txt} |
| 533 | of colors that can be safely displayed on such terminals. However, | 534 | file). If you run the command on a text-only terminal, it shows only a |
| 534 | Emacs understands X11 color names even on text-only terminals; if a | 535 | small subset of colors that can be safely displayed on such terminals. |
| 535 | face is given a color specified by an X11 color name, it is displayed | 536 | However, Emacs understands X11 color names even on text-only terminals; |
| 536 | using the closest-matching terminal color. | 537 | if a face is given a color specified by an X11 color name, it is |
| 538 | displayed using the closest-matching terminal color. | ||
| 537 | 539 | ||
| 538 | An RGB triplet is a string of the form @samp{#RRGGBB}. Each of the | 540 | An RGB triplet is a string of the form @samp{#RRGGBB}. Each of the |
| 539 | R, G, and B components is a hexadecimal number specifying the | 541 | R, G, and B components is a hexadecimal number specifying the |
diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi index 081614aa3b9..b2eb68d2812 100644 --- a/doc/emacs/files.texi +++ b/doc/emacs/files.texi | |||
| @@ -1907,7 +1907,10 @@ point. Partial Completion mode offers other features extending | |||
| 1907 | 1907 | ||
| 1908 | @findex image-mode | 1908 | @findex image-mode |
| 1909 | @findex image-toggle-display | 1909 | @findex image-toggle-display |
| 1910 | @findex image-toggle-animation | ||
| 1910 | @cindex images, viewing | 1911 | @cindex images, viewing |
| 1912 | @cindex image animation | ||
| 1913 | @cindex animated images | ||
| 1911 | Visiting image files automatically selects Image mode. This major | 1914 | Visiting image files automatically selects Image mode. This major |
| 1912 | mode allows you to toggle between displaying the file as an image in | 1915 | mode allows you to toggle between displaying the file as an image in |
| 1913 | the Emacs buffer, and displaying its underlying text representation, | 1916 | the Emacs buffer, and displaying its underlying text representation, |
| @@ -1915,7 +1918,12 @@ using the command @kbd{C-c C-c} (@code{image-toggle-display}). This | |||
| 1915 | works only when Emacs can display the specific image type. If the | 1918 | works only when Emacs can display the specific image type. If the |
| 1916 | displayed image is wider or taller than the frame, the usual point | 1919 | displayed image is wider or taller than the frame, the usual point |
| 1917 | motion keys (@kbd{C-f}, @kbd{C-p}, and so forth) cause different parts | 1920 | motion keys (@kbd{C-f}, @kbd{C-p}, and so forth) cause different parts |
| 1918 | of the image to be displayed. | 1921 | of the image to be displayed. If the image can be animated, then |
| 1922 | the command @kbd{RET} (@code{image-toggle-animation}), will start (or | ||
| 1923 | stop) animating it. Animation plays once, unless the option | ||
| 1924 | @code{image-animate-loop} is non-@code{nil}. Currently, Emacs only | ||
| 1925 | supports animated GIF files (@pxref{Animated Images,,, elisp, The Emacs | ||
| 1926 | Lisp Reference Manual}). | ||
| 1919 | 1927 | ||
| 1920 | @findex thumbs-mode | 1928 | @findex thumbs-mode |
| 1921 | @findex mode, thumbs | 1929 | @findex mode, thumbs |
diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi index 1adeee480a6..38ee620dbd5 100644 --- a/doc/emacs/frames.texi +++ b/doc/emacs/frames.texi | |||
| @@ -370,7 +370,6 @@ side-by-side windows with the boundary running through the click | |||
| 370 | position (@pxref{Split Window}). | 370 | position (@pxref{Split Window}). |
| 371 | @end table | 371 | @end table |
| 372 | 372 | ||
| 373 | @kindex C-Mouse-2 @r{(scroll bar)} | ||
| 374 | @kindex Mouse-1 @r{(scroll bar)} | 373 | @kindex Mouse-1 @r{(scroll bar)} |
| 375 | Furthermore, by clicking and dragging @kbd{Mouse-1} on the divider | 374 | Furthermore, by clicking and dragging @kbd{Mouse-1} on the divider |
| 376 | between two side-by-side mode lines, you can move the vertical | 375 | between two side-by-side mode lines, you can move the vertical |
diff --git a/doc/emacs/macos.texi b/doc/emacs/macos.texi index a36dc0cbcc5..e6d936e8e9f 100644 --- a/doc/emacs/macos.texi +++ b/doc/emacs/macos.texi | |||
| @@ -130,6 +130,18 @@ open the dragged files in the current frame use the following line: | |||
| 130 | @end lisp | 130 | @end lisp |
| 131 | 131 | ||
| 132 | 132 | ||
| 133 | @subsection Customization options specific to Mac OS / GNUstep | ||
| 134 | |||
| 135 | The following customization options are specific to the Nextstep port. | ||
| 136 | |||
| 137 | @table @code | ||
| 138 | @item ns-auto-hide-menu-bar | ||
| 139 | Non-nil means the menu-bar is hidden by default, but appears if you | ||
| 140 | move the mouse pointer over it. (Requires OS X 10.6 or later.) | ||
| 141 | |||
| 142 | @end table | ||
| 143 | |||
| 144 | |||
| 133 | @node Mac / GNUstep Events, GNUstep Support, Mac / GNUstep Customization, Mac OS / GNUstep | 145 | @node Mac / GNUstep Events, GNUstep Support, Mac / GNUstep Customization, Mac OS / GNUstep |
| 134 | @section Windowing System Events under Mac OS / GNUstep | 146 | @section Windowing System Events under Mac OS / GNUstep |
| 135 | 147 | ||
diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index 2ec477031ca..d2f92bf0da5 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi | |||
| @@ -6,7 +6,10 @@ | |||
| 6 | @chapter Maintaining Large Programs | 6 | @chapter Maintaining Large Programs |
| 7 | 7 | ||
| 8 | This chapter describes Emacs features for maintaining large | 8 | This chapter describes Emacs features for maintaining large |
| 9 | programs. | 9 | programs. If you are maintaining a large Lisp program, then in |
| 10 | addition to the features described here, you may find | ||
| 11 | the @file{ERT} (``Emacs Lisp Regression Testing'') library useful | ||
| 12 | (@pxref{Top,,ERT,ert, Emacs Lisp Regression Testing}). | ||
| 10 | 13 | ||
| 11 | @menu | 14 | @menu |
| 12 | * Version Control:: Using version control systems. | 15 | * Version Control:: Using version control systems. |
diff --git a/doc/emacs/trouble.texi b/doc/emacs/trouble.texi index 8cb5ab44a2e..6c6dbea9525 100644 --- a/doc/emacs/trouble.texi +++ b/doc/emacs/trouble.texi | |||
| @@ -784,6 +784,12 @@ non-@code{nil} will start the Lisp debugger and show a backtrace. | |||
| 784 | This backtrace is useful for debugging such long loops, so if you can | 784 | This backtrace is useful for debugging such long loops, so if you can |
| 785 | produce it, copy it into the bug report. | 785 | produce it, copy it into the bug report. |
| 786 | 786 | ||
| 787 | @vindex debug-on-event | ||
| 788 | If you cannot get Emacs to respond to @kbd{C-g} (e.g., because | ||
| 789 | @code{inhibit-quit} is set), then you can try sending the signal | ||
| 790 | specified by @code{debug-on-event} (default SIGUSR2) from outside | ||
| 791 | Emacs to cause it to enter the debugger. | ||
| 792 | |||
| 787 | @item | 793 | @item |
| 788 | Check whether any programs you have loaded into the Lisp world, | 794 | Check whether any programs you have loaded into the Lisp world, |
| 789 | including your initialization file, set any variables that may affect | 795 | including your initialization file, set any variables that may affect |
diff --git a/doc/emacs/windows.texi b/doc/emacs/windows.texi index 76ab79361e4..3733eed3eca 100644 --- a/doc/emacs/windows.texi +++ b/doc/emacs/windows.texi | |||
| @@ -72,7 +72,7 @@ Split the selected window into two windows, one above the other | |||
| 72 | Split the selected window into two windows, positioned side by side | 72 | Split the selected window into two windows, positioned side by side |
| 73 | (@code{split-window-right}). | 73 | (@code{split-window-right}). |
| 74 | @item C-Mouse-2 | 74 | @item C-Mouse-2 |
| 75 | In the mode line or scroll bar of a window, split that window. | 75 | In the mode line of a window, split that window. |
| 76 | @end table | 76 | @end table |
| 77 | 77 | ||
| 78 | @kindex C-x 2 | 78 | @kindex C-x 2 |
| @@ -125,11 +125,14 @@ lines in every partial-width window regardless of its width. | |||
| 125 | On text terminals, side-by-side windows are separated by a vertical | 125 | On text terminals, side-by-side windows are separated by a vertical |
| 126 | divider which is drawn using the @code{vertical-border} face. | 126 | divider which is drawn using the @code{vertical-border} face. |
| 127 | 127 | ||
| 128 | @kindex C-Mouse-2 @r{(mode line)} | ||
| 128 | @kindex C-Mouse-2 @r{(scroll bar)} | 129 | @kindex C-Mouse-2 @r{(scroll bar)} |
| 129 | You can also split a window horizontally or vertically by clicking | 130 | If you click @kbd{C-Mouse-2} in the mode line of a window, that |
| 130 | @kbd{C-Mouse-2} in the mode line or the scroll bar. If you click on | 131 | splits the window, putting a vertical divider where you click. |
| 131 | the mode line, that puts the vertical divider where you click; if you | 132 | Depending on how Emacs is compiled, you can also split a window by |
| 132 | click in the scroll bar, that puts the new mode-line where you click. | 133 | clicking @kbd{C-Mouse-2} in the scroll bar, which puts a horizontal |
| 134 | divider where you click (this feature does not work when Emacs uses | ||
| 135 | GTK+ scroll bars). | ||
| 133 | 136 | ||
| 134 | @node Other Window | 137 | @node Other Window |
| 135 | @section Using Other Windows | 138 | @section Using Other Windows |
diff --git a/doc/lispintro/ChangeLog b/doc/lispintro/ChangeLog index 66f9d3cace4..bf08571f6fb 100644 --- a/doc/lispintro/ChangeLog +++ b/doc/lispintro/ChangeLog | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | 2012-01-28 Andreas Schwab <schwab@linux-m68k.org> | 1 | 2012-01-28 Andreas Schwab <schwab@linux-m68k.org> |
| 2 | 2 | ||
| 3 | * emacs-lisp-intro.texi (Top): Move setting of COUNT-WORDS outside | 3 | * emacs-lisp-intro.texi (Top): Move setting of COUNT-WORDS outside |
| 4 | of @menu. (Bug#10628) | 4 | of @menu. (Bug#10628) |
| 5 | 5 | ||
| 6 | 2012-01-19 Juanma Barranquero <lekktu@gmail.com> | 6 | 2012-01-19 Juanma Barranquero <lekktu@gmail.com> |
| 7 | 7 | ||
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 8f949eb24dd..bd7b27bbe60 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,3 +1,109 @@ | |||
| 1 | 2012-02-05 Chong Yidong <cyd@gnu.org> | ||
| 2 | |||
| 3 | * customize.texi (Common Keywords): Minor clarifications. | ||
| 4 | Document custom-unlispify-remove-prefixes. | ||
| 5 | (Variable Definitions): Backquotes in defcustom seem to work fine | ||
| 6 | now. Various other copyedits. | ||
| 7 | |||
| 8 | * eval.texi (Backquote): Move from macros.texi. | ||
| 9 | |||
| 10 | * macros.texi (Expansion): Minor clarification. | ||
| 11 | (Backquote): Move node to eval.texi. | ||
| 12 | (Defining Macros): Move an example from Backquote node. | ||
| 13 | (Argument Evaluation): No need to mention Pascal. | ||
| 14 | (Indenting Macros): Add xref to Defining Macros. | ||
| 15 | |||
| 16 | 2012-02-05 Glenn Morris <rgm@gnu.org> | ||
| 17 | |||
| 18 | * debugging.texi (Error Debugging): Mention debug-on-event default. | ||
| 19 | |||
| 20 | 2012-02-04 Glenn Morris <rgm@gnu.org> | ||
| 21 | |||
| 22 | * backups.texi (Reverting): Mention revert-buffer-in-progress-p. | ||
| 23 | |||
| 24 | * debugging.texi (Error Debugging): Mention debug-on-event. | ||
| 25 | * commands.texi (Misc Events): Mention sigusr1,2 and debugging. | ||
| 26 | |||
| 27 | * modes.texi (Running Hooks): Try to clarify with-wrapper-hook. | ||
| 28 | |||
| 29 | * text.texi (Buffer Contents): | ||
| 30 | Update filter-buffer-substring description. | ||
| 31 | |||
| 32 | 2012-02-04 Chong Yidong <cyd@gnu.org> | ||
| 33 | |||
| 34 | * functions.texi (What Is a Function): Add closures. Mention | ||
| 35 | "return value" terminology. Add xref for command-execute. Remove | ||
| 36 | unused "keystroke command" terminology. | ||
| 37 | (Lambda Expressions): Give a different example than in the | ||
| 38 | following subsection. Add xref to Anonymous Functions. | ||
| 39 | (Function Documentation): Remove gratuitous markup. | ||
| 40 | (Function Names): Move introductory text to `What Is a Function'. | ||
| 41 | (Defining Functions): Fix defun argument spec. | ||
| 42 | (Anonymous Functions): Document lambda macro explicitly. Mention | ||
| 43 | effects on lexical binding. | ||
| 44 | (Function Cells): Downplay direct usage of fset. | ||
| 45 | (Closures): New node. | ||
| 46 | (Inline Functions): Remove "open-code" terminology. | ||
| 47 | (Declaring Functions): Minor tweak; .m is not C code. | ||
| 48 | |||
| 49 | * variables.texi (Variables): Don't refer to "global value". | ||
| 50 | (Local Variables, Void Variables): Copyedits. | ||
| 51 | (Lexical Binding): Minor clarification of example. | ||
| 52 | (File Local Variables): Mention :safe and :risky defcustom args. | ||
| 53 | (Lexical Binding): Add xref to Closures node. | ||
| 54 | |||
| 55 | 2012-02-04 Glenn Morris <rgm@gnu.org> | ||
| 56 | |||
| 57 | * minibuf.texi (High-Level Completion): Updates for read-color. | ||
| 58 | |||
| 59 | 2012-02-03 Glenn Morris <rgm@gnu.org> | ||
| 60 | |||
| 61 | * display.texi (GIF Images): Mention animation. | ||
| 62 | Remove commented-out old example of animation. | ||
| 63 | (Animated Images): New subsection. | ||
| 64 | * elisp.texi (Top): | ||
| 65 | * vol1.texi (Top): | ||
| 66 | * vol2.texi (Top): Add Animated Images menu entry. | ||
| 67 | |||
| 68 | * display.texi (Image Formats): Remove oddly specific information | ||
| 69 | on versions of image libraries. | ||
| 70 | (GIF Images, TIFF Images): Minor rephrasing. | ||
| 71 | |||
| 72 | 2012-02-02 Glenn Morris <rgm@gnu.org> | ||
| 73 | |||
| 74 | * processes.texi (Synchronous Processes): | ||
| 75 | Mention call-process's :file gets overwritten. | ||
| 76 | |||
| 77 | * commands.texi (Reading One Event): | ||
| 78 | * help.texi (Help Functions): Document read-char-choice. | ||
| 79 | |||
| 80 | * hooks.texi (Standard Hooks): | ||
| 81 | * modes.texi (Keymaps and Minor Modes): | ||
| 82 | * text.texi (Commands for Insertion): Document post-self-insert-hook. | ||
| 83 | |||
| 84 | * hooks.texi (Standard Hooks): Add prog-mode-hook. | ||
| 85 | |||
| 86 | * hooks.texi (Standard Hooks): | ||
| 87 | * modes.texi (Major Mode Conventions, Mode Hooks): | ||
| 88 | Document change-major-mode-after-body-hook. | ||
| 89 | |||
| 90 | 2012-02-01 Glenn Morris <rgm@gnu.org> | ||
| 91 | |||
| 92 | * modes.texi (Defining Minor Modes): | ||
| 93 | Mention disabling global minor modes on a per-major-mode basis. | ||
| 94 | |||
| 95 | 2012-01-31 Chong Yidong <cyd@gnu.org> | ||
| 96 | |||
| 97 | * syntax.texi (Parsing Expressions): Clarify intro (Bug#10657). | ||
| 98 | (Parser State): Remove unnecessary statement (Bug#10661). | ||
| 99 | |||
| 100 | * eval.texi (Intro Eval): Add footnote about "sexp" terminology. | ||
| 101 | |||
| 102 | 2012-01-31 Glenn Morris <rgm@gnu.org> | ||
| 103 | |||
| 104 | * modes.texi (Defining Minor Modes): | ||
| 105 | Document define-minor-mode's new :variable keyword. | ||
| 106 | |||
| 1 | 2012-01-29 Chong Yidong <cyd@gnu.org> | 107 | 2012-01-29 Chong Yidong <cyd@gnu.org> |
| 2 | 108 | ||
| 3 | * syntax.texi (Syntax Class Table): Tweak description of newline | 109 | * syntax.texi (Syntax Class Table): Tweak description of newline |
diff --git a/doc/lispref/backups.texi b/doc/lispref/backups.texi index 969220845d0..a4b3a0b9bef 100644 --- a/doc/lispref/backups.texi +++ b/doc/lispref/backups.texi | |||
| @@ -696,6 +696,9 @@ operation, reverting preserves all the markers. If they are not | |||
| 696 | identical, reverting does change the buffer; in that case, it preserves | 696 | identical, reverting does change the buffer; in that case, it preserves |
| 697 | the markers in the unchanged text (if any) at the beginning and end of | 697 | the markers in the unchanged text (if any) at the beginning and end of |
| 698 | the buffer. Preserving any additional markers would be problematical. | 698 | the buffer. Preserving any additional markers would be problematical. |
| 699 | |||
| 700 | This command binds @code{revert-buffer-in-progress-p} to a | ||
| 701 | non-@code{nil} value while it operates. | ||
| 699 | @end deffn | 702 | @end deffn |
| 700 | 703 | ||
| 701 | You can customize how @code{revert-buffer} does its work by setting | 704 | You can customize how @code{revert-buffer} does its work by setting |
diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi index 3d2b813b592..91e224a439f 100644 --- a/doc/lispref/commands.texi +++ b/doc/lispref/commands.texi | |||
| @@ -1696,6 +1696,7 @@ parameters are used to display the help-echo text are described in | |||
| 1696 | These events are generated when the Emacs process receives | 1696 | These events are generated when the Emacs process receives |
| 1697 | the signals @code{SIGUSR1} and @code{SIGUSR2}. They contain no | 1697 | the signals @code{SIGUSR1} and @code{SIGUSR2}. They contain no |
| 1698 | additional data because signals do not carry additional information. | 1698 | additional data because signals do not carry additional information. |
| 1699 | They can be useful for debugging (@pxref{Error Debugging}). | ||
| 1699 | 1700 | ||
| 1700 | To catch a user signal, bind the corresponding event to an interactive | 1701 | To catch a user signal, bind the corresponding event to an interactive |
| 1701 | command in the @code{special-event-map} (@pxref{Active Keymaps}). | 1702 | command in the @code{special-event-map} (@pxref{Active Keymaps}). |
| @@ -2472,6 +2473,17 @@ The argument @var{prompt} is either a string to be displayed in the | |||
| 2472 | echo area as a prompt, or @code{nil}, meaning not to display a prompt. | 2473 | echo area as a prompt, or @code{nil}, meaning not to display a prompt. |
| 2473 | @end defun | 2474 | @end defun |
| 2474 | 2475 | ||
| 2476 | @defun read-char-choice prompt chars &optional inhibit-quit | ||
| 2477 | This function uses @code{read-key} to read and return a single | ||
| 2478 | character. It ignores any input that is not a member of @var{chars}, | ||
| 2479 | a list of accepted characters. Optionally, it will also ignore | ||
| 2480 | keyboard-quit events while it is waiting for valid input. If you bind | ||
| 2481 | @code{help-form} (@pxref{Help Functions}) to a non-@code{nil} value | ||
| 2482 | while calling @code{read-char-choice}, then pressing @code{help-char} | ||
| 2483 | causes it to evaluate @code{help-form} and display the result. It | ||
| 2484 | then continues to wait for a valid input character, or keyboard-quit. | ||
| 2485 | @end defun | ||
| 2486 | |||
| 2475 | @node Event Mod | 2487 | @node Event Mod |
| 2476 | @subsection Modifying and Translating Input Events | 2488 | @subsection Modifying and Translating Input Events |
| 2477 | 2489 | ||
diff --git a/doc/lispref/customize.texi b/doc/lispref/customize.texi index 6d6c5df10ed..b8c30fff8ae 100644 --- a/doc/lispref/customize.texi +++ b/doc/lispref/customize.texi | |||
| @@ -24,9 +24,10 @@ definitions---as well as face definitions (@pxref{Defining Faces}). | |||
| 24 | @section Common Item Keywords | 24 | @section Common Item Keywords |
| 25 | 25 | ||
| 26 | @cindex customization keywords | 26 | @cindex customization keywords |
| 27 | All kinds of customization declarations (for variables and groups, and | 27 | The customization declarations that we will describe in the next few |
| 28 | for faces) accept keyword arguments for specifying various information. | 28 | sections (@code{defcustom}, @code{defgroup}, etc.) all accept keyword |
| 29 | This section describes some keywords that apply to all kinds. | 29 | arguments for specifying various information. This section describes |
| 30 | keywords that apply to all types of customization declarations. | ||
| 30 | 31 | ||
| 31 | All of these keywords, except @code{:tag}, can be used more than once | 32 | All of these keywords, except @code{:tag}, can be used more than once |
| 32 | in a given item. Each use of the keyword has an independent effect. | 33 | in a given item. Each use of the keyword has an independent effect. |
| @@ -108,8 +109,7 @@ You can specify the text to use in the customization buffer by adding | |||
| 108 | for example, @code{(info-link :tag "foo" "(emacs)Top")} makes a link to | 109 | for example, @code{(info-link :tag "foo" "(emacs)Top")} makes a link to |
| 109 | the Emacs manual which appears in the buffer as @samp{foo}. | 110 | the Emacs manual which appears in the buffer as @samp{foo}. |
| 110 | 111 | ||
| 111 | An item can have more than one external link; however, most items have | 112 | You can use this keyword more than once, to add multiple links. |
| 112 | none at all. | ||
| 113 | 113 | ||
| 114 | @item :load @var{file} | 114 | @item :load @var{file} |
| 115 | @kindex load@r{, customization keyword} | 115 | @kindex load@r{, customization keyword} |
| @@ -136,14 +136,13 @@ version. The value @var{version} must be a string. | |||
| 136 | @kindex package-version@r{, customization keyword} | 136 | @kindex package-version@r{, customization keyword} |
| 137 | This keyword specifies that the item was first introduced in | 137 | This keyword specifies that the item was first introduced in |
| 138 | @var{package} version @var{version}, or that its meaning or default | 138 | @var{package} version @var{version}, or that its meaning or default |
| 139 | value was changed in that version. The value of @var{package} is a | 139 | value was changed in that version. This keyword takes priority over |
| 140 | symbol and @var{version} is a string. | 140 | @code{:version}. |
| 141 | 141 | ||
| 142 | This keyword takes priority over @code{:version}. | 142 | @var{package} should be the official name of the package, as a symbol |
| 143 | 143 | (e.g.@: @code{MH-E}). @var{version} should be a string. If the | |
| 144 | @var{package} should be the official name of the package, such as MH-E | 144 | package @var{package} is released as part of Emacs, @var{package} and |
| 145 | or Gnus. If the package @var{package} is released as part of Emacs, | 145 | @var{version} should appear in the value of |
| 146 | @var{package} and @var{version} should appear in the value of | ||
| 147 | @code{customize-package-emacs-version-alist}. | 146 | @code{customize-package-emacs-version-alist}. |
| 148 | @end table | 147 | @end table |
| 149 | 148 | ||
| @@ -226,41 +225,31 @@ also use this keyword in @code{defgroup}: | |||
| 226 | @table @code | 225 | @table @code |
| 227 | @item :prefix @var{prefix} | 226 | @item :prefix @var{prefix} |
| 228 | @kindex prefix@r{, @code{defgroup} keyword} | 227 | @kindex prefix@r{, @code{defgroup} keyword} |
| 229 | If the name of an item in the group starts with @var{prefix}, then the | 228 | If the name of an item in the group starts with @var{prefix}, and the |
| 230 | tag for that item is constructed (by default) by omitting @var{prefix}. | 229 | customizable variable @code{custom-unlispify-remove-prefixes} is |
| 231 | 230 | non-@code{nil}, the item's tag will omit @var{prefix}. A group can | |
| 232 | One group can have any number of prefixes. | 231 | have any number of prefixes. |
| 233 | @end table | 232 | @end table |
| 234 | @end defmac | 233 | @end defmac |
| 235 | 234 | ||
| 236 | The prefix-discarding feature is currently turned off, which means | 235 | @defopt custom-unlispify-remove-prefixes |
| 237 | that @code{:prefix} currently has no effect. We did this because we | 236 | If this variable is non-@code{nil}, the prefixes specified by a |
| 238 | found that discarding the specified prefixes often led to confusing | 237 | group's @code{:prefix} keyword are omitted from tag names, whenever |
| 239 | names for options. This happened because the people who wrote the | 238 | the user customizes the group. |
| 240 | @code{defgroup} definitions for various groups added @code{:prefix} | ||
| 241 | keywords whenever they make logical sense---that is, whenever the | ||
| 242 | variables in the library have a common prefix. | ||
| 243 | |||
| 244 | In order to obtain good results with @code{:prefix}, it would be | ||
| 245 | necessary to check the specific effects of discarding a particular | ||
| 246 | prefix, given the specific items in a group and their names and | ||
| 247 | documentation. If the resulting text is not clear, then @code{:prefix} | ||
| 248 | should not be used in that case. | ||
| 249 | 239 | ||
| 250 | It should be possible to recheck all the customization groups, delete | 240 | The default value is @code{nil}, i.e.@: the prefix-discarding feature |
| 251 | the @code{:prefix} specifications which give unclear results, and then | 241 | is disabled. This is because discarding prefixes often leads to |
| 252 | turn this feature back on, if someone would like to do the work. | 242 | confusing names for options and faces. |
| 243 | @end defopt | ||
| 253 | 244 | ||
| 254 | @node Variable Definitions | 245 | @node Variable Definitions |
| 255 | @section Defining Customization Variables | 246 | @section Defining Customization Variables |
| 256 | @cindex define customization options | 247 | @cindex define customization options |
| 257 | @cindex customization variables, how to define | 248 | @cindex customization variables, how to define |
| 258 | 249 | ||
| 259 | Use @code{defcustom} to declare user-customizable variables. | ||
| 260 | |||
| 261 | @defmac defcustom option standard doc [keyword value]@dots{} | 250 | @defmac defcustom option standard doc [keyword value]@dots{} |
| 262 | This macro declares @var{option} as a customizable @dfn{user option}. | 251 | This macro declares @var{option} as a user option (i.e.@: a |
| 263 | You should not quote @var{option}. | 252 | customizable variable). You should not quote @var{option}. |
| 264 | 253 | ||
| 265 | The argument @var{standard} is an expression that specifies the | 254 | The argument @var{standard} is an expression that specifies the |
| 266 | standard value for @var{option}. Evaluating the @code{defcustom} form | 255 | standard value for @var{option}. Evaluating the @code{defcustom} form |
| @@ -275,31 +264,25 @@ cases applies, @code{defcustom} installs the result of evaluating | |||
| 275 | The expression @var{standard} can be evaluated at various other times, | 264 | The expression @var{standard} can be evaluated at various other times, |
| 276 | too---whenever the customization facility needs to know @var{option}'s | 265 | too---whenever the customization facility needs to know @var{option}'s |
| 277 | standard value. So be sure to use an expression which is harmless to | 266 | standard value. So be sure to use an expression which is harmless to |
| 278 | evaluate at any time. We recommend avoiding backquotes in | 267 | evaluate at any time. |
| 279 | @var{standard}, because they are not expanded when editing the value, | ||
| 280 | so list values will appear to have the wrong structure. | ||
| 281 | 268 | ||
| 282 | The argument @var{doc} specifies the documentation string for the | 269 | The argument @var{doc} specifies the documentation string for the |
| 283 | variable. | 270 | variable. |
| 284 | 271 | ||
| 285 | Every @code{defcustom} should specify @code{:group} at least once. | 272 | Every @code{defcustom} should specify @code{:group} at least once. |
| 286 | 273 | ||
| 287 | If you specify the @code{:set} keyword, to make the variable take other | ||
| 288 | special actions when set through the customization buffer, the | ||
| 289 | variable's documentation string should tell the user specifically how | ||
| 290 | to do the same job in hand-written Lisp code. | ||
| 291 | |||
| 292 | When you evaluate a @code{defcustom} form with @kbd{C-M-x} in Emacs Lisp | 274 | When you evaluate a @code{defcustom} form with @kbd{C-M-x} in Emacs Lisp |
| 293 | mode (@code{eval-defun}), a special feature of @code{eval-defun} | 275 | mode (@code{eval-defun}), a special feature of @code{eval-defun} |
| 294 | arranges to set the variable unconditionally, without testing whether | 276 | arranges to set the variable unconditionally, without testing whether |
| 295 | its value is void. (The same feature applies to @code{defvar}.) | 277 | its value is void. (The same feature applies to @code{defvar}.) |
| 296 | @xref{Defining Variables}. | 278 | @xref{Defining Variables}. |
| 297 | 279 | ||
| 298 | If you put a @code{defcustom} in a file that is preloaded at dump time | 280 | If you put a @code{defcustom} in a pre-loaded Emacs Lisp file |
| 299 | (@pxref{Building Emacs}), and the standard value installed for the | 281 | (@pxref{Building Emacs}), the standard value installed at dump time |
| 300 | variable at that time might not be correct, use | 282 | might be incorrect, e.g.@: because another variable that it depends on |
| 283 | has not been assigned the right value yet. In that case, use | ||
| 301 | @code{custom-reevaluate-setting}, described below, to re-evaluate the | 284 | @code{custom-reevaluate-setting}, described below, to re-evaluate the |
| 302 | standard value during or after Emacs startup. | 285 | standard value after Emacs starts up. |
| 303 | @end defmac | 286 | @end defmac |
| 304 | 287 | ||
| 305 | @code{defcustom} accepts the following additional keywords: | 288 | @code{defcustom} accepts the following additional keywords: |
| @@ -330,6 +313,9 @@ the value properly for this option (which may not mean simply setting | |||
| 330 | the option as a Lisp variable). The default for @var{setfunction} is | 313 | the option as a Lisp variable). The default for @var{setfunction} is |
| 331 | @code{set-default}. | 314 | @code{set-default}. |
| 332 | 315 | ||
| 316 | If you specify this keyword, the variable's documentation string | ||
| 317 | should describe how to do the same job in hand-written Lisp code. | ||
| 318 | |||
| 333 | @item :get @var{getfunction} | 319 | @item :get @var{getfunction} |
| 334 | @kindex get@r{, @code{defcustom} keyword} | 320 | @kindex get@r{, @code{defcustom} keyword} |
| 335 | Specify @var{getfunction} as the way to extract the value of this | 321 | Specify @var{getfunction} as the way to extract the value of this |
| @@ -341,7 +327,7 @@ value). The default is @code{default-value}. | |||
| 341 | You have to really understand the workings of Custom to use | 327 | You have to really understand the workings of Custom to use |
| 342 | @code{:get} correctly. It is meant for values that are treated in | 328 | @code{:get} correctly. It is meant for values that are treated in |
| 343 | Custom as variables but are not actually stored in Lisp variables. It | 329 | Custom as variables but are not actually stored in Lisp variables. It |
| 344 | is almost surely a mistake to specify @code{getfunction} for a value | 330 | is almost surely a mistake to specify @var{getfunction} for a value |
| 345 | that really is stored in a Lisp variable. | 331 | that really is stored in a Lisp variable. |
| 346 | 332 | ||
| 347 | @item :initialize @var{function} | 333 | @item :initialize @var{function} |
| @@ -380,16 +366,15 @@ already set or has been customized; otherwise, just use | |||
| 380 | These functions behave like @code{custom-initialize-set} | 366 | These functions behave like @code{custom-initialize-set} |
| 381 | (@code{custom-initialize-default}, respectively), but catch errors. | 367 | (@code{custom-initialize-default}, respectively), but catch errors. |
| 382 | If an error occurs during initialization, they set the variable to | 368 | If an error occurs during initialization, they set the variable to |
| 383 | @code{nil} using @code{set-default}, and throw no error. | 369 | @code{nil} using @code{set-default}, and signal no error. |
| 384 | 370 | ||
| 385 | These two functions are only meant for options defined in pre-loaded | 371 | These functions are meant for options defined in pre-loaded files, |
| 386 | files, where some variables or functions used to compute the option's | 372 | where the @var{standard} expression may signal an error because some |
| 387 | value may not yet be defined. The option normally gets updated in | 373 | required variable or function is not yet defined. The value normally |
| 388 | @file{startup.el}, ignoring the previously computed value. Because of | 374 | gets updated in @file{startup.el}, ignoring the value computed by |
| 389 | this typical usage, the value which these two functions compute | 375 | @code{defcustom}. After startup, if one unsets the value and |
| 390 | normally only matters when, after startup, one unsets the option's | 376 | reevaluates the @code{defcustom}, the @var{standard} expression can be |
| 391 | value and then reevaluates the defcustom. By that time, the necessary | 377 | evaluated without error. |
| 392 | variables and functions will be defined, so there will not be an error. | ||
| 393 | @end table | 378 | @end table |
| 394 | 379 | ||
| 395 | @item :risky @var{value} | 380 | @item :risky @var{value} |
| @@ -457,18 +442,16 @@ is an expression that evaluates to the value. | |||
| 457 | 442 | ||
| 458 | @defun custom-reevaluate-setting symbol | 443 | @defun custom-reevaluate-setting symbol |
| 459 | This function re-evaluates the standard value of @var{symbol}, which | 444 | This function re-evaluates the standard value of @var{symbol}, which |
| 460 | should be a user option declared via @code{defcustom}. (If the | 445 | should be a user option declared via @code{defcustom}. If the |
| 461 | variable was customized, this function re-evaluates the saved value | 446 | variable was customized, this function re-evaluates the saved value |
| 462 | instead.) This is useful for customizable options that are defined | 447 | instead. Then it sets the user option to that value (using the |
| 463 | before their value could be computed correctly, such as variables | 448 | option's @code{:set} property if that is defined). |
| 464 | defined in packages that are loaded at dump time, but depend on the | 449 | |
| 465 | run-time information. For example, the value could be a file whose | 450 | This is useful for customizable options that are defined before their |
| 466 | precise name depends on the hierarchy of files when Emacs runs, or a | 451 | value could be computed correctly. For example, during startup Emacs |
| 467 | name of a program that needs to be searched at run time. | 452 | calls this function for some user options that were defined in |
| 468 | 453 | pre-loaded Emacs Lisp files, but whose initial values depend on | |
| 469 | A good place to put calls to this function is in the function | 454 | information available only at run-time. |
| 470 | @code{command-line} that is run during startup (@pxref{Startup Summary}) | ||
| 471 | or in the various hooks it calls. | ||
| 472 | @end defun | 455 | @end defun |
| 473 | 456 | ||
| 474 | @defun custom-variable-p arg | 457 | @defun custom-variable-p arg |
diff --git a/doc/lispref/debugging.texi b/doc/lispref/debugging.texi index 9466f21a563..cc92fc225f9 100644 --- a/doc/lispref/debugging.texi +++ b/doc/lispref/debugging.texi | |||
| @@ -148,6 +148,15 @@ enter the debugger. | |||
| 148 | @code{debug-on-error} is @code{nil}. | 148 | @code{debug-on-error} is @code{nil}. |
| 149 | @end defopt | 149 | @end defopt |
| 150 | 150 | ||
| 151 | @defopt debug-on-event | ||
| 152 | If you set @code{debug-on-event} to a special event (@pxref{Special | ||
| 153 | Events}), Emacs will try to enter the debugger as soon as it receives | ||
| 154 | this event, bypassing @code{special-event-map}. At present, the only | ||
| 155 | supported values correspond to the signals @code{SIGUSR1} and | ||
| 156 | @code{SIGUSR2} (this is the default). This can be helpful when | ||
| 157 | @code{inhibit-quit} is set and Emacs is not otherwise responding. | ||
| 158 | @end defopt | ||
| 159 | |||
| 151 | To debug an error that happens during loading of the init | 160 | To debug an error that happens during loading of the init |
| 152 | file, use the option @samp{--debug-init}. This binds | 161 | file, use the option @samp{--debug-init}. This binds |
| 153 | @code{debug-on-error} to @code{t} while loading the init file, and | 162 | @code{debug-on-error} to @code{t} while loading the init file, and |
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index a351dbfb407..e97e6c264a3 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi | |||
| @@ -4134,6 +4134,7 @@ displayed (@pxref{Display Feature Testing}). | |||
| 4134 | * Other Image Types:: Various other formats are supported. | 4134 | * Other Image Types:: Various other formats are supported. |
| 4135 | * Defining Images:: Convenient ways to define an image for later use. | 4135 | * Defining Images:: Convenient ways to define an image for later use. |
| 4136 | * Showing Images:: Convenient ways to display an image once it is defined. | 4136 | * Showing Images:: Convenient ways to display an image once it is defined. |
| 4137 | * Animated Images:: Some image formats can be animated. | ||
| 4137 | * Image Cache:: Internal mechanisms of image display. | 4138 | * Image Cache:: Internal mechanisms of image display. |
| 4138 | @end menu | 4139 | @end menu |
| 4139 | 4140 | ||
| @@ -4151,12 +4152,10 @@ names for these dynamic libraries (though it is not possible to add | |||
| 4151 | new image formats). Note that image types @code{pbm} and @code{xbm} | 4152 | new image formats). Note that image types @code{pbm} and @code{xbm} |
| 4152 | do not depend on external libraries and are always available in Emacs. | 4153 | do not depend on external libraries and are always available in Emacs. |
| 4153 | 4154 | ||
| 4154 | The supported image formats include XBM, XPM (this requires the | 4155 | The supported image formats (and the necessary library files) |
| 4155 | libraries @code{libXpm} version 3.4k and @code{libz}), GIF (requiring | 4156 | include XBM, XPM (@code{libXpm} and @code{libz}), GIF (@code{libgif} |
| 4156 | @code{libungif} 4.1.0), PostScript, PBM, JPEG (requiring the | 4157 | or @code{libungif}), PostScript, PBM, JPEG (@code{libjpeg}), TIFF |
| 4157 | @code{libjpeg} library version v6a), TIFF (requiring @code{libtiff} | 4158 | (@code{libtiff}), PNG (@code{libpng}), and SVG (@code{librsvg}). |
| 4158 | v3.4), PNG (requiring @code{libpng} 1.0.2), and SVG (requiring | ||
| 4159 | @code{librsvg} 2.0.0). | ||
| 4160 | 4159 | ||
| 4161 | You specify one of these formats with an image type symbol. The image | 4160 | You specify one of these formats with an image type symbol. The image |
| 4162 | type symbols are @code{xbm}, @code{xpm}, @code{gif}, @code{postscript}, | 4161 | type symbols are @code{xbm}, @code{xpm}, @code{gif}, @code{postscript}, |
| @@ -4471,33 +4470,13 @@ specifies the actual color to use for displaying that name. | |||
| 4471 | 4470 | ||
| 4472 | @table @code | 4471 | @table @code |
| 4473 | @item :index @var{index} | 4472 | @item :index @var{index} |
| 4474 | You can use @code{:index} to specify one image from a GIF file that | 4473 | You can use @code{:index} to specify image number @var{index} from a |
| 4475 | contains more than one image. This property specifies use of image | 4474 | GIF file that contains more than one image. If the GIF file doesn't |
| 4476 | number @var{index} from the file. If the GIF file doesn't contain an | 4475 | contain an image with the specified index, the image displays as a |
| 4477 | image with index @var{index}, the image displays as a hollow box. | 4476 | hollow box. GIF files with more than one image can be animated, |
| 4477 | @pxref{Animated Images}. | ||
| 4478 | @end table | 4478 | @end table |
| 4479 | 4479 | ||
| 4480 | @ignore | ||
| 4481 | This could be used to implement limited support for animated GIFs. | ||
| 4482 | For example, the following function displays a multi-image GIF file | ||
| 4483 | at point-min in the current buffer, switching between sub-images | ||
| 4484 | every 0.1 seconds. | ||
| 4485 | |||
| 4486 | (defun show-anim (file max) | ||
| 4487 | "Display multi-image GIF file FILE which contains MAX subimages." | ||
| 4488 | (display-anim (current-buffer) file 0 max t)) | ||
| 4489 | |||
| 4490 | (defun display-anim (buffer file idx max first-time) | ||
| 4491 | (when (= idx max) | ||
| 4492 | (setq idx 0)) | ||
| 4493 | (let ((img (create-image file nil :image idx))) | ||
| 4494 | (with-current-buffer buffer | ||
| 4495 | (goto-char (point-min)) | ||
| 4496 | (unless first-time (delete-char 1)) | ||
| 4497 | (insert-image img)) | ||
| 4498 | (run-with-timer 0.1 nil 'display-anim buffer file (1+ idx) max nil))) | ||
| 4499 | @end ignore | ||
| 4500 | |||
| 4501 | @node TIFF Images | 4480 | @node TIFF Images |
| 4502 | @subsection TIFF Images | 4481 | @subsection TIFF Images |
| 4503 | @cindex TIFF | 4482 | @cindex TIFF |
| @@ -4506,10 +4485,10 @@ every 0.1 seconds. | |||
| 4506 | 4485 | ||
| 4507 | @table @code | 4486 | @table @code |
| 4508 | @item :index @var{index} | 4487 | @item :index @var{index} |
| 4509 | You can use @code{:index} to specify one image from a TIFF file that | 4488 | You can use @code{:index} to specify image number @var{index} from a |
| 4510 | contains more than one image. This property specifies use of image | 4489 | TIFF file that contains more than one image. If the TIFF file doesn't |
| 4511 | number @var{index} from the file. If the TIFF file doesn't contain an | 4490 | contain an image with the specified index, the image displays as a |
| 4512 | image with index @var{index}, the image displays as a hollow box. | 4491 | hollow box. |
| 4513 | @end table | 4492 | @end table |
| 4514 | 4493 | ||
| 4515 | @node PostScript Images | 4494 | @node PostScript Images |
| @@ -4857,6 +4836,39 @@ cache, it can always be displayed, even if the value of | |||
| 4857 | @var{max-image-size} is subsequently changed (@pxref{Image Cache}). | 4836 | @var{max-image-size} is subsequently changed (@pxref{Image Cache}). |
| 4858 | @end defvar | 4837 | @end defvar |
| 4859 | 4838 | ||
| 4839 | @node Animated Images | ||
| 4840 | @subsection Animated Images | ||
| 4841 | |||
| 4842 | @cindex animation | ||
| 4843 | @cindex image animation | ||
| 4844 | Some image files can contain more than one image. This can be used to | ||
| 4845 | create animation. Currently, Emacs only supports animated GIF files. | ||
| 4846 | The following functions related to animated images are available. | ||
| 4847 | |||
| 4848 | @defun image-animated-p image | ||
| 4849 | This function returns non-nil if @var{image} can be animated. | ||
| 4850 | The actual return value is a cons @code{(@var{nimages} . @var{delay})}, | ||
| 4851 | where @var{nimages} is the number of frames and @var{delay} is the | ||
| 4852 | delay in seconds between them. | ||
| 4853 | @end defun | ||
| 4854 | |||
| 4855 | @defun image-animate image &optional index limit | ||
| 4856 | This function animates @var{image}. The optional integer @var{index} | ||
| 4857 | specifies the frame from which to start (default 0). The optional | ||
| 4858 | argument @var{limit} controls the length of the animation. If omitted | ||
| 4859 | or @code{nil}, the image animates once only; if @code{t} it loops | ||
| 4860 | forever; if a number animation stops after that many seconds. | ||
| 4861 | @end defun | ||
| 4862 | |||
| 4863 | @noindent Animation operates by means of a timer. Note that Emacs imposes a | ||
| 4864 | minimum frame delay of 0.01 seconds. | ||
| 4865 | |||
| 4866 | @defun image-animate-timer image | ||
| 4867 | This function returns the timer responsible for animating @var{image}, | ||
| 4868 | if there is one. | ||
| 4869 | @end defun | ||
| 4870 | |||
| 4871 | |||
| 4860 | @node Image Cache | 4872 | @node Image Cache |
| 4861 | @subsection Image Cache | 4873 | @subsection Image Cache |
| 4862 | @cindex image cache | 4874 | @cindex image cache |
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi index 31e887ea68b..f69823101d0 100644 --- a/doc/lispref/elisp.texi +++ b/doc/lispref/elisp.texi | |||
| @@ -374,6 +374,7 @@ Evaluation | |||
| 374 | * Forms:: How various sorts of objects are evaluated. | 374 | * Forms:: How various sorts of objects are evaluated. |
| 375 | * Quoting:: Avoiding evaluation (to put constants in | 375 | * Quoting:: Avoiding evaluation (to put constants in |
| 376 | the program). | 376 | the program). |
| 377 | * Backquote:: Easier construction of list structure. | ||
| 377 | * Eval:: How to invoke the Lisp interpreter explicitly. | 378 | * Eval:: How to invoke the Lisp interpreter explicitly. |
| 378 | 379 | ||
| 379 | Kinds of Forms | 380 | Kinds of Forms |
| @@ -459,6 +460,7 @@ Functions | |||
| 459 | * Anonymous Functions:: Lambda expressions are functions with no names. | 460 | * Anonymous Functions:: Lambda expressions are functions with no names. |
| 460 | * Function Cells:: Accessing or setting the function definition | 461 | * Function Cells:: Accessing or setting the function definition |
| 461 | of a symbol. | 462 | of a symbol. |
| 463 | * Closures:: Functions that enclose a lexical environment. | ||
| 462 | * Obsolete Functions:: Declaring functions obsolete. | 464 | * Obsolete Functions:: Declaring functions obsolete. |
| 463 | * Inline Functions:: Defining functions that the compiler | 465 | * Inline Functions:: Defining functions that the compiler |
| 464 | will open code. | 466 | will open code. |
| @@ -481,7 +483,6 @@ Macros | |||
| 481 | * Expansion:: How, when and why macros are expanded. | 483 | * Expansion:: How, when and why macros are expanded. |
| 482 | * Compiling Macros:: How macros are expanded by the compiler. | 484 | * Compiling Macros:: How macros are expanded by the compiler. |
| 483 | * Defining Macros:: How to write a macro definition. | 485 | * Defining Macros:: How to write a macro definition. |
| 484 | * Backquote:: Easier construction of list structure. | ||
| 485 | * Problems with Macros:: Don't evaluate the macro arguments too many times. | 486 | * Problems with Macros:: Don't evaluate the macro arguments too many times. |
| 486 | Don't hide the user's variables. | 487 | Don't hide the user's variables. |
| 487 | * Indenting Macros:: Specifying how to indent macro calls. | 488 | * Indenting Macros:: Specifying how to indent macro calls. |
| @@ -1351,6 +1352,7 @@ Images | |||
| 1351 | * Defining Images:: Convenient ways to define an image for later use. | 1352 | * Defining Images:: Convenient ways to define an image for later use. |
| 1352 | * Showing Images:: Convenient ways to display an image once | 1353 | * Showing Images:: Convenient ways to display an image once |
| 1353 | it is defined. | 1354 | it is defined. |
| 1355 | * Animated Images:: Some image formats can be animated. | ||
| 1354 | * Image Cache:: Internal mechanisms of image display. | 1356 | * Image Cache:: Internal mechanisms of image display. |
| 1355 | 1357 | ||
| 1356 | Buttons | 1358 | Buttons |
diff --git a/doc/lispref/eval.texi b/doc/lispref/eval.texi index fc18e503543..cb3a4c54fac 100644 --- a/doc/lispref/eval.texi +++ b/doc/lispref/eval.texi | |||
| @@ -23,6 +23,7 @@ function @code{eval}. | |||
| 23 | * Intro Eval:: Evaluation in the scheme of things. | 23 | * Intro Eval:: Evaluation in the scheme of things. |
| 24 | * Forms:: How various sorts of objects are evaluated. | 24 | * Forms:: How various sorts of objects are evaluated. |
| 25 | * Quoting:: Avoiding evaluation (to put constants in the program). | 25 | * Quoting:: Avoiding evaluation (to put constants in the program). |
| 26 | * Backquote:: Easier construction of list structure. | ||
| 26 | * Eval:: How to invoke the Lisp interpreter explicitly. | 27 | * Eval:: How to invoke the Lisp interpreter explicitly. |
| 27 | @end menu | 28 | @end menu |
| 28 | 29 | ||
| @@ -39,12 +40,15 @@ interpreter. | |||
| 39 | 40 | ||
| 40 | @cindex form | 41 | @cindex form |
| 41 | @cindex expression | 42 | @cindex expression |
| 42 | A Lisp object that is intended for evaluation is called an | 43 | @cindex S-expression |
| 43 | @dfn{expression} or a @dfn{form}. The fact that forms are data | 44 | A Lisp object that is intended for evaluation is called a @dfn{form} |
| 44 | objects and not merely text is one of the fundamental differences | 45 | or @dfn{expression}@footnote{It is sometimes also referred to as an |
| 45 | between Lisp-like languages and typical programming languages. Any | 46 | @dfn{S-expression} or @dfn{sexp}, but we generally do not use this |
| 46 | object can be evaluated, but in practice only numbers, symbols, lists | 47 | terminology in this manual.}. The fact that forms are data objects |
| 47 | and strings are evaluated very often. | 48 | and not merely text is one of the fundamental differences between |
| 49 | Lisp-like languages and typical programming languages. Any object can | ||
| 50 | be evaluated, but in practice only numbers, symbols, lists and strings | ||
| 51 | are evaluated very often. | ||
| 48 | 52 | ||
| 49 | In subsequent sections, we will describe the details of what | 53 | In subsequent sections, we will describe the details of what |
| 50 | evaluation means for each kind of form. | 54 | evaluation means for each kind of form. |
| @@ -96,12 +100,12 @@ interpretation. @xref{Command Loop}. | |||
| 96 | @node Forms | 100 | @node Forms |
| 97 | @section Kinds of Forms | 101 | @section Kinds of Forms |
| 98 | 102 | ||
| 99 | A Lisp object that is intended to be evaluated is called a @dfn{form}. | 103 | A Lisp object that is intended to be evaluated is called a |
| 100 | How Emacs evaluates a form depends on its data type. Emacs has three | 104 | @dfn{form} (or an @dfn{expression}). How Emacs evaluates a form |
| 101 | different kinds of form that are evaluated differently: symbols, lists, | 105 | depends on its data type. Emacs has three different kinds of form |
| 102 | and ``all other types.'' This section describes all three kinds, one by | 106 | that are evaluated differently: symbols, lists, and ``all other |
| 103 | one, starting with the ``all other types'' which are self-evaluating | 107 | types.'' This section describes all three kinds, one by one, starting |
| 104 | forms. | 108 | with the ``all other types'' which are self-evaluating forms. |
| 105 | 109 | ||
| 106 | @menu | 110 | @menu |
| 107 | * Self-Evaluating Forms:: Forms that evaluate to themselves. | 111 | * Self-Evaluating Forms:: Forms that evaluate to themselves. |
| @@ -576,6 +580,96 @@ Functions}), which causes an anonymous lambda expression written in Lisp | |||
| 576 | to be compiled, and @samp{`} (@pxref{Backquote}), which is used to quote | 580 | to be compiled, and @samp{`} (@pxref{Backquote}), which is used to quote |
| 577 | only part of a list, while computing and substituting other parts. | 581 | only part of a list, while computing and substituting other parts. |
| 578 | 582 | ||
| 583 | @node Backquote | ||
| 584 | @section Backquote | ||
| 585 | @cindex backquote (list substitution) | ||
| 586 | @cindex ` (list substitution) | ||
| 587 | @findex ` | ||
| 588 | |||
| 589 | @dfn{Backquote constructs} allow you to quote a list, but | ||
| 590 | selectively evaluate elements of that list. In the simplest case, it | ||
| 591 | is identical to the special form @code{quote} | ||
| 592 | @iftex | ||
| 593 | @end iftex | ||
| 594 | @ifnottex | ||
| 595 | (described in the previous section; @pxref{Quoting}). | ||
| 596 | @end ifnottex | ||
| 597 | For example, these two forms yield identical results: | ||
| 598 | |||
| 599 | @example | ||
| 600 | @group | ||
| 601 | `(a list of (+ 2 3) elements) | ||
| 602 | @result{} (a list of (+ 2 3) elements) | ||
| 603 | @end group | ||
| 604 | @group | ||
| 605 | '(a list of (+ 2 3) elements) | ||
| 606 | @result{} (a list of (+ 2 3) elements) | ||
| 607 | @end group | ||
| 608 | @end example | ||
| 609 | |||
| 610 | @findex , @r{(with backquote)} | ||
| 611 | The special marker @samp{,} inside of the argument to backquote | ||
| 612 | indicates a value that isn't constant. The Emacs Lisp evaluator | ||
| 613 | evaluates the argument of @samp{,}, and puts the value in the list | ||
| 614 | structure: | ||
| 615 | |||
| 616 | @example | ||
| 617 | @group | ||
| 618 | `(a list of ,(+ 2 3) elements) | ||
| 619 | @result{} (a list of 5 elements) | ||
| 620 | @end group | ||
| 621 | @end example | ||
| 622 | |||
| 623 | @noindent | ||
| 624 | Substitution with @samp{,} is allowed at deeper levels of the list | ||
| 625 | structure also. For example: | ||
| 626 | |||
| 627 | @example | ||
| 628 | @group | ||
| 629 | `(1 2 (3 ,(+ 4 5))) | ||
| 630 | @result{} (1 2 (3 9)) | ||
| 631 | @end group | ||
| 632 | @end example | ||
| 633 | |||
| 634 | @findex ,@@ @r{(with backquote)} | ||
| 635 | @cindex splicing (with backquote) | ||
| 636 | You can also @dfn{splice} an evaluated value into the resulting list, | ||
| 637 | using the special marker @samp{,@@}. The elements of the spliced list | ||
| 638 | become elements at the same level as the other elements of the resulting | ||
| 639 | list. The equivalent code without using @samp{`} is often unreadable. | ||
| 640 | Here are some examples: | ||
| 641 | |||
| 642 | @example | ||
| 643 | @group | ||
| 644 | (setq some-list '(2 3)) | ||
| 645 | @result{} (2 3) | ||
| 646 | @end group | ||
| 647 | @group | ||
| 648 | (cons 1 (append some-list '(4) some-list)) | ||
| 649 | @result{} (1 2 3 4 2 3) | ||
| 650 | @end group | ||
| 651 | @group | ||
| 652 | `(1 ,@@some-list 4 ,@@some-list) | ||
| 653 | @result{} (1 2 3 4 2 3) | ||
| 654 | @end group | ||
| 655 | |||
| 656 | @group | ||
| 657 | (setq list '(hack foo bar)) | ||
| 658 | @result{} (hack foo bar) | ||
| 659 | @end group | ||
| 660 | @group | ||
| 661 | (cons 'use | ||
| 662 | (cons 'the | ||
| 663 | (cons 'words (append (cdr list) '(as elements))))) | ||
| 664 | @result{} (use the words foo bar as elements) | ||
| 665 | @end group | ||
| 666 | @group | ||
| 667 | `(use the words ,@@(cdr list) as elements) | ||
| 668 | @result{} (use the words foo bar as elements) | ||
| 669 | @end group | ||
| 670 | @end example | ||
| 671 | |||
| 672 | |||
| 579 | @node Eval | 673 | @node Eval |
| 580 | @section Eval | 674 | @section Eval |
| 581 | 675 | ||
diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index ada00867bd0..9ee94557066 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi | |||
| @@ -21,8 +21,9 @@ define them. | |||
| 21 | * Anonymous Functions:: Lambda expressions are functions with no names. | 21 | * Anonymous Functions:: Lambda expressions are functions with no names. |
| 22 | * Function Cells:: Accessing or setting the function definition | 22 | * Function Cells:: Accessing or setting the function definition |
| 23 | of a symbol. | 23 | of a symbol. |
| 24 | * Closures:: Functions that enclose a lexical environment. | ||
| 24 | * Obsolete Functions:: Declaring functions obsolete. | 25 | * Obsolete Functions:: Declaring functions obsolete. |
| 25 | * Inline Functions:: Defining functions that the compiler will open code. | 26 | * Inline Functions:: Functions that the compiler will expand inline. |
| 26 | * Declaring Functions:: Telling the compiler that a function is defined. | 27 | * Declaring Functions:: Telling the compiler that a function is defined. |
| 27 | * Function Safety:: Determining whether a function is safe to call. | 28 | * Function Safety:: Determining whether a function is safe to call. |
| 28 | * Related Topics:: Cross-references to specific Lisp primitives | 29 | * Related Topics:: Cross-references to specific Lisp primitives |
| @@ -32,104 +33,117 @@ define them. | |||
| 32 | @node What Is a Function | 33 | @node What Is a Function |
| 33 | @section What Is a Function? | 34 | @section What Is a Function? |
| 34 | 35 | ||
| 35 | In a general sense, a function is a rule for carrying on a computation | 36 | @cindex return value |
| 36 | given several values called @dfn{arguments}. The result of the | 37 | @cindex value of function |
| 37 | computation is called the value of the function. The computation can | 38 | @cindex argument |
| 38 | also have side effects: lasting changes in the values of variables or | 39 | In a general sense, a function is a rule for carrying out a |
| 39 | the contents of data structures. | 40 | computation given input values called @dfn{arguments}. The result of |
| 40 | 41 | the computation is called the @dfn{value} or @dfn{return value} of the | |
| 41 | Here are important terms for functions in Emacs Lisp and for other | 42 | function. The computation can also have side effects, such as lasting |
| 42 | function-like objects. | 43 | changes in the values of variables or the contents of data structures. |
| 44 | |||
| 45 | In most computer languages, every function has a name. But in Lisp, | ||
| 46 | a function in the strictest sense has no name: it is an object which | ||
| 47 | can @emph{optionally} be associated with a symbol (e.g.@: @code{car}) | ||
| 48 | that serves as the function name. @xref{Function Names}. When a | ||
| 49 | function has been given a name, we usually also refer to that symbol | ||
| 50 | as a ``function'' (e.g.@: we refer to ``the function @code{car}''). | ||
| 51 | In this manual, the distinction between a function name and the | ||
| 52 | function object itself is usually unimportant, but we will take note | ||
| 53 | wherever it is relevant. | ||
| 54 | |||
| 55 | Certain function-like objects, called @dfn{special forms} and | ||
| 56 | @dfn{macros}, also accept arguments to carry out computations. | ||
| 57 | However, as explained below, these are not considered functions in | ||
| 58 | Emacs Lisp. | ||
| 59 | |||
| 60 | Here are important terms for functions and function-like objects: | ||
| 43 | 61 | ||
| 44 | @table @dfn | 62 | @table @dfn |
| 45 | @item function | 63 | @item lambda expression |
| 46 | @cindex function | 64 | A function (in the strict sense, i.e.@: a function object) which is |
| 47 | In Emacs Lisp, a @dfn{function} is anything that can be applied to | 65 | written in Lisp. These are described in the following section. |
| 48 | arguments in a Lisp program. In some cases, we use it more | 66 | @ifnottex |
| 49 | specifically to mean a function written in Lisp. Special forms and | 67 | @xref{Lambda Expressions}. |
| 50 | macros are not functions. | 68 | @end ifnottex |
| 51 | 69 | ||
| 52 | @item primitive | 70 | @item primitive |
| 53 | @cindex primitive | 71 | @cindex primitive |
| 54 | @cindex subr | 72 | @cindex subr |
| 55 | @cindex built-in function | 73 | @cindex built-in function |
| 56 | A @dfn{primitive} is a function callable from Lisp that is written in C, | 74 | A function which is callable from Lisp but is actually written in C. |
| 57 | such as @code{car} or @code{append}. These functions are also called | 75 | Primitives are also called @dfn{built-in functions}, or @dfn{subrs}. |
| 58 | @dfn{built-in functions}, or @dfn{subrs}. (Special forms are also | 76 | Examples include functions like @code{car} and @code{append}. In |
| 59 | considered primitives.) | 77 | addition, all special forms (see below) are also considered |
| 60 | 78 | primitives. | |
| 61 | Usually the reason we implement a function as a primitive is either | 79 | |
| 62 | because it is fundamental, because it provides a low-level interface | 80 | Usually, a function is implemented as a primitive because it is a |
| 63 | to operating system services, or because it needs to run fast. | 81 | fundamental part of Lisp (e.g.@: @code{car}), or because it provides a |
| 64 | Primitives can be modified or added only by changing the C sources and | 82 | low-level interface to operating system services, or because it needs |
| 65 | recompiling the editor. See @ref{Writing Emacs Primitives}. | 83 | to run fast. Unlike functions defined in Lisp, primitives can be |
| 66 | 84 | modified or added only by changing the C sources and recompiling | |
| 67 | @item lambda expression | 85 | Emacs. See @ref{Writing Emacs Primitives}. |
| 68 | A @dfn{lambda expression} is a function written in Lisp. | ||
| 69 | These are described in the following section. | ||
| 70 | @ifnottex | ||
| 71 | @xref{Lambda Expressions}. | ||
| 72 | @end ifnottex | ||
| 73 | 86 | ||
| 74 | @item special form | 87 | @item special form |
| 75 | A @dfn{special form} is a primitive that is like a function but does not | 88 | A primitive that is like a function but does not evaluate all of its |
| 76 | evaluate all of its arguments in the usual way. It may evaluate only | 89 | arguments in the usual way. It may evaluate only some of the |
| 77 | some of the arguments, or may evaluate them in an unusual order, or | 90 | arguments, or may evaluate them in an unusual order, or several times. |
| 78 | several times. Many special forms are described in @ref{Control | 91 | Examples include @code{if}, @code{and}, and @code{while}. |
| 79 | Structures}. | 92 | @xref{Special Forms}. |
| 80 | 93 | ||
| 81 | @item macro | 94 | @item macro |
| 82 | @cindex macro | 95 | @cindex macro |
| 83 | A @dfn{macro} is a construct defined in Lisp by the programmer. It | 96 | A construct defined in Lisp, which differs from a function in that it |
| 84 | differs from a function in that it translates a Lisp expression that you | 97 | translates a Lisp expression into another expression which is to be |
| 85 | write into an equivalent expression to be evaluated instead of the | 98 | evaluated instead of the original expression. Macros enable Lisp |
| 86 | original expression. Macros enable Lisp programmers to do the sorts of | 99 | programmers to do the sorts of things that special forms can do. |
| 87 | things that special forms can do. @xref{Macros}, for how to define and | 100 | @xref{Macros}. |
| 88 | use macros. | ||
| 89 | 101 | ||
| 90 | @item command | 102 | @item command |
| 91 | @cindex command | 103 | @cindex command |
| 92 | A @dfn{command} is an object that @code{command-execute} can invoke; it | 104 | An object which can be invoked via the @code{command-execute} |
| 93 | is a possible definition for a key sequence. Some functions are | 105 | primitive, usually due to the user typing in a key sequence |
| 94 | commands; a function written in Lisp is a command if it contains an | 106 | @dfn{bound} to that command. @xref{Interactive Call}. A command is |
| 95 | interactive declaration (@pxref{Defining Commands}). Such a function | 107 | usually a function; if the function is written in Lisp, it is made |
| 96 | can be called from Lisp expressions like other functions; in this case, | 108 | into a command by an @code{interactive} form in the function |
| 97 | the fact that the function is a command makes no difference. | 109 | definition (@pxref{Defining Commands}). Commands that are functions |
| 110 | can also be called from Lisp expressions, just like other functions. | ||
| 98 | 111 | ||
| 99 | Keyboard macros (strings and vectors) are commands also, even though | 112 | Keyboard macros (strings and vectors) are commands also, even though |
| 100 | they are not functions. A symbol is a command if its function | 113 | they are not functions. @xref{Keyboard Macros}. We say that a symbol |
| 101 | definition is a command; such symbols can be invoked with @kbd{M-x}. | 114 | is a command if its function cell contains a command (@pxref{Symbol |
| 102 | The symbol is a function as well if the definition is a function. | 115 | Components}); such a @dfn{named command} can be invoked with |
| 103 | @xref{Interactive Call}. | 116 | @kbd{M-x}. |
| 104 | 117 | ||
| 105 | @item keystroke command | 118 | @item closure |
| 106 | @cindex keystroke command | 119 | A function object that is much like a lambda expression, except that |
| 107 | A @dfn{keystroke command} is a command that is bound to a key sequence | 120 | it also encloses an ``environment'' of lexical variable bindings. |
| 108 | (typically one to three keystrokes). The distinction is made here | 121 | @xref{Closures}. |
| 109 | merely to avoid confusion with the meaning of ``command'' in non-Emacs | ||
| 110 | editors; for Lisp programs, the distinction is normally unimportant. | ||
| 111 | 122 | ||
| 112 | @item byte-code function | 123 | @item byte-code function |
| 113 | A @dfn{byte-code function} is a function that has been compiled by the | 124 | A function that has been compiled by the byte compiler. |
| 114 | byte compiler. @xref{Byte-Code Type}. | 125 | @xref{Byte-Code Type}. |
| 115 | 126 | ||
| 116 | @item autoload object | 127 | @item autoload object |
| 117 | @cindex autoload object | 128 | @cindex autoload object |
| 118 | An @dfn{autoload object} is a place-holder for a real function. If | 129 | A place-holder for a real function. If the autoload object is called, |
| 119 | the autoload object is called, it will make Emacs load the file | 130 | Emacs loads the file containing the definition of the real function, |
| 120 | containing the definition of the real function, and then call the real | 131 | and then calls the real function. @xref{Autoload}. |
| 121 | function instead. | ||
| 122 | @end table | 132 | @end table |
| 123 | 133 | ||
| 134 | You can use the function @code{functionp} to test if an object is a | ||
| 135 | function: | ||
| 136 | |||
| 124 | @defun functionp object | 137 | @defun functionp object |
| 125 | This function returns @code{t} if @var{object} is any kind of | 138 | This function returns @code{t} if @var{object} is any kind of |
| 126 | function, i.e.@: can be passed to @code{funcall}. Note that | 139 | function, i.e.@: can be passed to @code{funcall}. Note that |
| 127 | @code{functionp} returns @code{nil} for special forms (@pxref{Special | 140 | @code{functionp} returns @code{t} for symbols that are function names, |
| 128 | Forms}). | 141 | and returns @code{nil} for special forms. |
| 129 | @end defun | 142 | @end defun |
| 130 | 143 | ||
| 131 | Unlike @code{functionp}, the next three functions do @emph{not} | 144 | @noindent |
| 132 | treat a symbol as its function definition. | 145 | Unlike @code{functionp}, the next three functions do @emph{not} treat |
| 146 | a symbol as its function definition. | ||
| 133 | 147 | ||
| 134 | @defun subrp object | 148 | @defun subrp object |
| 135 | This function returns @code{t} if @var{object} is a built-in function | 149 | This function returns @code{t} if @var{object} is a built-in function |
| @@ -172,21 +186,26 @@ function with @code{&rest} arguments, or the symbol @code{unevalled} if | |||
| 172 | @section Lambda Expressions | 186 | @section Lambda Expressions |
| 173 | @cindex lambda expression | 187 | @cindex lambda expression |
| 174 | 188 | ||
| 175 | A function written in Lisp is a list that looks like this: | 189 | A lambda expression is a function object written in Lisp. Here is |
| 190 | an example: | ||
| 176 | 191 | ||
| 177 | @example | 192 | @example |
| 178 | (lambda (@var{arg-variables}@dots{}) | 193 | (lambda (x) |
| 179 | @r{[}@var{documentation-string}@r{]} | 194 | "Return the hyperbolic cosine of X." |
| 180 | @r{[}@var{interactive-declaration}@r{]} | 195 | (* 0.5 (+ (exp x) (exp (- x))))) |
| 181 | @var{body-forms}@dots{}) | ||
| 182 | @end example | 196 | @end example |
| 183 | 197 | ||
| 184 | @noindent | 198 | @noindent |
| 185 | Such a list is called a @dfn{lambda expression}. In Emacs Lisp, it | 199 | In Emacs Lisp, such a list is valid as an expression---it evaluates to |
| 186 | actually is valid as an expression---it evaluates to itself. In some | 200 | itself. But its main use is not to be evaluated as an expression, but |
| 187 | other Lisp dialects, a lambda expression is not a valid expression at | 201 | to be called as a function. |
| 188 | all. In either case, its main use is not to be evaluated as an | 202 | |
| 189 | expression, but to be called as a function. | 203 | A lambda expression, by itself, has no name; it is an @dfn{anonymous |
| 204 | function}. Although lambda expressions can be used this way | ||
| 205 | (@pxref{Anonymous Functions}), they are more commonly associated with | ||
| 206 | symbols to make @dfn{named functions} (@pxref{Function Names}). | ||
| 207 | Before going into these details, the following subsections describe | ||
| 208 | the components of a lambda expression and what they do. | ||
| 190 | 209 | ||
| 191 | @menu | 210 | @menu |
| 192 | * Lambda Components:: The parts of a lambda expression. | 211 | * Lambda Components:: The parts of a lambda expression. |
| @@ -198,10 +217,7 @@ expression, but to be called as a function. | |||
| 198 | @node Lambda Components | 217 | @node Lambda Components |
| 199 | @subsection Components of a Lambda Expression | 218 | @subsection Components of a Lambda Expression |
| 200 | 219 | ||
| 201 | @ifnottex | 220 | A lambda expression is a list that looks like this: |
| 202 | |||
| 203 | A function written in Lisp (a ``lambda expression'') is a list that | ||
| 204 | looks like this: | ||
| 205 | 221 | ||
| 206 | @example | 222 | @example |
| 207 | (lambda (@var{arg-variables}@dots{}) | 223 | (lambda (@var{arg-variables}@dots{}) |
| @@ -209,7 +225,6 @@ looks like this: | |||
| 209 | [@var{interactive-declaration}] | 225 | [@var{interactive-declaration}] |
| 210 | @var{body-forms}@dots{}) | 226 | @var{body-forms}@dots{}) |
| 211 | @end example | 227 | @end example |
| 212 | @end ifnottex | ||
| 213 | 228 | ||
| 214 | @cindex lambda list | 229 | @cindex lambda list |
| 215 | The first element of a lambda expression is always the symbol | 230 | The first element of a lambda expression is always the symbol |
| @@ -243,9 +258,9 @@ code to do the work of the function (or, as a Lisp programmer would say, | |||
| 243 | function is the value returned by the last element of the body. | 258 | function is the value returned by the last element of the body. |
| 244 | 259 | ||
| 245 | @node Simple Lambda | 260 | @node Simple Lambda |
| 246 | @subsection A Simple Lambda-Expression Example | 261 | @subsection A Simple Lambda Expression Example |
| 247 | 262 | ||
| 248 | Consider for example the following function: | 263 | Consider the following example: |
| 249 | 264 | ||
| 250 | @example | 265 | @example |
| 251 | (lambda (a b c) (+ a b c)) | 266 | (lambda (a b c) (+ a b c)) |
| @@ -283,18 +298,15 @@ This evaluates the arguments @code{1}, @code{(* 2 3)}, and @code{(- 5 | |||
| 283 | 4)} from left to right. Then it applies the lambda expression to the | 298 | 4)} from left to right. Then it applies the lambda expression to the |
| 284 | argument values 1, 6 and 1 to produce the value 8. | 299 | argument values 1, 6 and 1 to produce the value 8. |
| 285 | 300 | ||
| 286 | It is not often useful to write a lambda expression as the @sc{car} of | 301 | As these examples show, you can use a form with a lambda expression |
| 287 | a form in this way. You can get the same result, of making local | 302 | as its @sc{car} to make local variables and give them values. In the |
| 288 | variables and giving them values, using the special form @code{let} | 303 | old days of Lisp, this technique was the only way to bind and |
| 289 | (@pxref{Local Variables}). And @code{let} is clearer and easier to use. | 304 | initialize local variables. But nowadays, it is clearer to use the |
| 290 | In practice, lambda expressions are either stored as the function | 305 | special form @code{let} for this purpose (@pxref{Local Variables}). |
| 291 | definitions of symbols, to produce named functions, or passed as | 306 | Lambda expressions are mainly used as anonymous functions for passing |
| 292 | arguments to other functions (@pxref{Anonymous Functions}). | 307 | as arguments to other functions (@pxref{Anonymous Functions}), or |
| 293 | 308 | stored as symbol function definitions to produce named functions | |
| 294 | However, calls to explicit lambda expressions were very useful in the | 309 | (@pxref{Function Names}). |
| 295 | old days of Lisp, before the special form @code{let} was invented. At | ||
| 296 | that time, they were the only way to bind and initialize local | ||
| 297 | variables. | ||
| 298 | 310 | ||
| 299 | @node Argument List | 311 | @node Argument List |
| 300 | @subsection Other Features of Argument Lists | 312 | @subsection Other Features of Argument Lists |
| @@ -405,12 +417,12 @@ after a @code{&rest} argument. | |||
| 405 | @subsection Documentation Strings of Functions | 417 | @subsection Documentation Strings of Functions |
| 406 | @cindex documentation of function | 418 | @cindex documentation of function |
| 407 | 419 | ||
| 408 | A lambda expression may optionally have a @dfn{documentation string} just | 420 | A lambda expression may optionally have a @dfn{documentation string} |
| 409 | after the lambda list. This string does not affect execution of the | 421 | just after the lambda list. This string does not affect execution of |
| 410 | function; it is a kind of comment, but a systematized comment which | 422 | the function; it is a kind of comment, but a systematized comment |
| 411 | actually appears inside the Lisp world and can be used by the Emacs help | 423 | which actually appears inside the Lisp world and can be used by the |
| 412 | facilities. @xref{Documentation}, for how the @var{documentation-string} is | 424 | Emacs help facilities. @xref{Documentation}, for how the |
| 413 | accessed. | 425 | documentation string is accessed. |
| 414 | 426 | ||
| 415 | It is a good idea to provide documentation strings for all the | 427 | It is a good idea to provide documentation strings for all the |
| 416 | functions in your program, even those that are called only from within | 428 | functions in your program, even those that are called only from within |
| @@ -463,55 +475,45 @@ way users think of the parts of the macro call. | |||
| 463 | @cindex named function | 475 | @cindex named function |
| 464 | @cindex function name | 476 | @cindex function name |
| 465 | 477 | ||
| 466 | In most computer languages, every function has a name; the idea of a | 478 | A symbol can serve as the name of a function. This happens when the |
| 467 | function without a name is nonsensical. In Lisp, a function in the | 479 | symbol's @dfn{function cell} (@pxref{Symbol Components}) contains a |
| 468 | strictest sense has no name. It is simply a list whose first element is | 480 | function object (e.g.@: a lambda expression). Then the symbol itself |
| 469 | @code{lambda}, a byte-code function object, or a primitive subr-object. | 481 | becomes a valid, callable function, equivalent to the function object |
| 470 | 482 | in its function cell. | |
| 471 | However, a symbol can serve as the name of a function. This happens | 483 | |
| 472 | when you put the function in the symbol's @dfn{function cell} | 484 | The contents of the function cell are also called the symbol's |
| 473 | (@pxref{Symbol Components}). Then the symbol itself becomes a valid, | 485 | @dfn{function definition}. The procedure of using a symbol's function |
| 474 | callable function, equivalent to the list or subr-object that its | 486 | definition in place of the symbol is called @dfn{symbol function |
| 475 | function cell refers to. The contents of the function cell are also | 487 | indirection}; see @ref{Function Indirection}. If you have not given a |
| 476 | called the symbol's @dfn{function definition}. The procedure of using a | 488 | symbol a function definition, its function cell is said to be |
| 477 | symbol's function definition in place of the symbol is called | 489 | @dfn{void}, and it cannot be used as a function. |
| 478 | @dfn{symbol function indirection}; see @ref{Function Indirection}. | 490 | |
| 479 | 491 | In practice, nearly all functions have names, and are referred to by | |
| 480 | In practice, nearly all functions are given names in this way and | 492 | their names. You can create a named Lisp function by defining a |
| 481 | referred to through their names. For example, the symbol @code{car} works | 493 | lambda expression and putting it in a function cell (@pxref{Function |
| 482 | as a function and does what it does because the primitive subr-object | 494 | Cells}). However, it is more common to use the @code{defun} special |
| 483 | @code{#<subr car>} is stored in its function cell. | 495 | form, described in the next section. |
| 496 | @ifnottex | ||
| 497 | @xref{Defining Functions}. | ||
| 498 | @end ifnottex | ||
| 484 | 499 | ||
| 485 | We give functions names because it is convenient to refer to them by | 500 | We give functions names because it is convenient to refer to them by |
| 486 | their names in Lisp expressions. For primitive subr-objects such as | 501 | their names in Lisp expressions. Also, a named Lisp function can |
| 487 | @code{#<subr car>}, names are the only way you can refer to them: there | 502 | easily refer to itself---it can be recursive. Furthermore, primitives |
| 488 | is no read syntax for such objects. For functions written in Lisp, the | 503 | can only be referred to textually by their names, since primitive |
| 489 | name is more convenient to use in a call than an explicit lambda | 504 | function objects (@pxref{Primitive Function Type}) have no read |
| 490 | expression. Also, a function with a name can refer to itself---it can | 505 | syntax. |
| 491 | be recursive. Writing the function's name in its own definition is much | 506 | |
| 492 | more convenient than making the function definition point to itself | 507 | A function need not have a unique name. A given function object |
| 493 | (something that is not impossible but that has various disadvantages in | 508 | @emph{usually} appears in the function cell of only one symbol, but |
| 494 | practice). | 509 | this is just a convention. It is easy to store it in several symbols |
| 495 | 510 | using @code{fset}; then each of the symbols is a valid name for the | |
| 496 | We often identify functions with the symbols used to name them. For | 511 | same function. |
| 497 | example, we often speak of ``the function @code{car},'' not | 512 | |
| 498 | distinguishing between the symbol @code{car} and the primitive | 513 | Note that a symbol used as a function name may also be used as a |
| 499 | subr-object that is its function definition. For most purposes, the | 514 | variable; these two uses of a symbol are independent and do not |
| 500 | distinction is not important. | 515 | conflict. (This is not the case in some dialects of Lisp, like |
| 501 | 516 | Scheme.) | |
| 502 | Even so, keep in mind that a function need not have a unique name. While | ||
| 503 | a given function object @emph{usually} appears in the function cell of only | ||
| 504 | one symbol, this is just a matter of convenience. It is easy to store | ||
| 505 | it in several symbols using @code{fset}; then each of the symbols is | ||
| 506 | equally well a name for the same function. | ||
| 507 | |||
| 508 | A symbol used as a function name may also be used as a variable; these | ||
| 509 | two uses of a symbol are independent and do not conflict. (Some Lisp | ||
| 510 | dialects, such as Scheme, do not distinguish between a symbol's value | ||
| 511 | and its function definition; a symbol's value as a variable is also its | ||
| 512 | function definition.) If you have not given a symbol a function | ||
| 513 | definition, you cannot use it as a function; whether the symbol has a | ||
| 514 | value as a variable makes no difference to this. | ||
| 515 | 517 | ||
| 516 | @node Defining Functions | 518 | @node Defining Functions |
| 517 | @section Defining Functions | 519 | @section Defining Functions |
| @@ -521,7 +523,7 @@ value as a variable makes no difference to this. | |||
| 521 | is called @dfn{defining a function}, and it is done with the | 523 | is called @dfn{defining a function}, and it is done with the |
| 522 | @code{defun} special form. | 524 | @code{defun} special form. |
| 523 | 525 | ||
| 524 | @defspec defun name argument-list body-forms | 526 | @defspec defun name argument-list body-forms... |
| 525 | @code{defun} is the usual way to define new Lisp functions. It | 527 | @code{defun} is the usual way to define new Lisp functions. It |
| 526 | defines the symbol @var{name} as a function that looks like this: | 528 | defines the symbol @var{name} as a function that looks like this: |
| 527 | 529 | ||
| @@ -534,14 +536,9 @@ defines the symbol @var{name} as a function that looks like this: | |||
| 534 | value. | 536 | value. |
| 535 | 537 | ||
| 536 | As described previously, @var{argument-list} is a list of argument | 538 | As described previously, @var{argument-list} is a list of argument |
| 537 | names and may include the keywords @code{&optional} and @code{&rest} | 539 | names and may include the keywords @code{&optional} and @code{&rest}. |
| 538 | (@pxref{Lambda Expressions}). Also, the first two of the | 540 | Also, the first two of the @var{body-forms} may be a documentation |
| 539 | @var{body-forms} may be a documentation string and an interactive | 541 | string and an interactive declaration. @xref{Lambda Components}. |
| 540 | declaration. | ||
| 541 | |||
| 542 | There is no conflict if the same symbol @var{name} is also used as a | ||
| 543 | variable, since the symbol's value cell is independent of the function | ||
| 544 | cell. @xref{Symbol Components}. | ||
| 545 | 542 | ||
| 546 | Here are some examples: | 543 | Here are some examples: |
| 547 | 544 | ||
| @@ -575,7 +572,7 @@ Here are some examples: | |||
| 575 | 572 | ||
| 576 | @group | 573 | @group |
| 577 | (defun capitalize-backwards () | 574 | (defun capitalize-backwards () |
| 578 | "Upcase the last letter of a word." | 575 | "Upcase the last letter of the word at point." |
| 579 | (interactive) | 576 | (interactive) |
| 580 | (backward-word 1) | 577 | (backward-word 1) |
| 581 | (forward-word 1) | 578 | (forward-word 1) |
| @@ -587,9 +584,10 @@ Here are some examples: | |||
| 587 | 584 | ||
| 588 | Be careful not to redefine existing functions unintentionally. | 585 | Be careful not to redefine existing functions unintentionally. |
| 589 | @code{defun} redefines even primitive functions such as @code{car} | 586 | @code{defun} redefines even primitive functions such as @code{car} |
| 590 | without any hesitation or notification. Redefining a function already | 587 | without any hesitation or notification. Emacs does not prevent you |
| 591 | defined is often done deliberately, and there is no way to distinguish | 588 | from doing this, because redefining a function is sometimes done |
| 592 | deliberate redefinition from unintentional redefinition. | 589 | deliberately, and there is no way to distinguish deliberate |
| 590 | redefinition from unintentional redefinition. | ||
| 593 | @end defspec | 591 | @end defspec |
| 594 | 592 | ||
| 595 | @cindex function aliases | 593 | @cindex function aliases |
| @@ -626,7 +624,8 @@ call the primitive's C definition directly, so changing the symbol's | |||
| 626 | definition will have no effect on them. | 624 | definition will have no effect on them. |
| 627 | 625 | ||
| 628 | See also @code{defsubst}, which defines a function like @code{defun} | 626 | See also @code{defsubst}, which defines a function like @code{defun} |
| 629 | and tells the Lisp compiler to open-code it. @xref{Inline Functions}. | 627 | and tells the Lisp compiler to perform inline expansion on it. |
| 628 | @xref{Inline Functions}. | ||
| 630 | 629 | ||
| 631 | @node Calling Functions | 630 | @node Calling Functions |
| 632 | @section Calling Functions | 631 | @section Calling Functions |
| @@ -790,11 +789,10 @@ This function returns @var{arg} and has no side effects. | |||
| 790 | This function ignores any arguments and returns @code{nil}. | 789 | This function ignores any arguments and returns @code{nil}. |
| 791 | @end defun | 790 | @end defun |
| 792 | 791 | ||
| 793 | Emacs Lisp functions can also be user-visible @dfn{commands}. A | 792 | Some functions are user-visible @dfn{commands}, which can be called |
| 794 | command is a function that has an @dfn{interactive} specification. | 793 | interactively (usually by a key sequence). It is possible to invoke |
| 795 | You may want to call these functions as if they were called | 794 | such a command exactly as though it was called interactively, by using |
| 796 | interactively. See @ref{Interactive Call} for details on how to do | 795 | the @code{call-interactively} function. @xref{Interactive Call}. |
| 797 | that. | ||
| 798 | 796 | ||
| 799 | @node Mapping Functions | 797 | @node Mapping Functions |
| 800 | @section Mapping Functions | 798 | @section Mapping Functions |
| @@ -802,12 +800,12 @@ that. | |||
| 802 | 800 | ||
| 803 | A @dfn{mapping function} applies a given function (@emph{not} a | 801 | A @dfn{mapping function} applies a given function (@emph{not} a |
| 804 | special form or macro) to each element of a list or other collection. | 802 | special form or macro) to each element of a list or other collection. |
| 805 | Emacs Lisp has several such functions; @code{mapcar} and | 803 | Emacs Lisp has several such functions; this section describes |
| 806 | @code{mapconcat}, which scan a list, are described here. | 804 | @code{mapcar}, @code{mapc}, and @code{mapconcat}, which map over a |
| 807 | @xref{Definition of mapatoms}, for the function @code{mapatoms} which | 805 | list. @xref{Definition of mapatoms}, for the function @code{mapatoms} |
| 808 | maps over the symbols in an obarray. @xref{Definition of maphash}, | 806 | which maps over the symbols in an obarray. @xref{Definition of |
| 809 | for the function @code{maphash} which maps over key/value associations | 807 | maphash}, for the function @code{maphash} which maps over key/value |
| 810 | in a hash table. | 808 | associations in a hash table. |
| 811 | 809 | ||
| 812 | These mapping functions do not allow char-tables because a char-table | 810 | These mapping functions do not allow char-tables because a char-table |
| 813 | is a sparse array whose nominal range of indices is very large. To map | 811 | is a sparse array whose nominal range of indices is very large. To map |
| @@ -898,48 +896,67 @@ bool-vector, or a string. | |||
| 898 | @section Anonymous Functions | 896 | @section Anonymous Functions |
| 899 | @cindex anonymous function | 897 | @cindex anonymous function |
| 900 | 898 | ||
| 901 | In Lisp, a function is a list that starts with @code{lambda}, a | 899 | Although functions are usually defined with @code{defun} and given |
| 902 | byte-code function compiled from such a list, or alternatively a | 900 | names at the same time, it is sometimes convenient to use an explicit |
| 903 | primitive subr-object; names are ``extra.'' Although functions are | 901 | lambda expression---an @dfn{anonymous function}. Anonymous functions |
| 904 | usually defined with @code{defun} and given names at the same time, it | 902 | are valid wherever function names are. They are often assigned as |
| 905 | is occasionally more concise to use an explicit lambda expression---an | 903 | variable values, or as arguments to functions; for instance, you might |
| 906 | anonymous function. Such a list is valid wherever a function name is. | 904 | pass one as the @var{function} argument to @code{mapcar}, which |
| 905 | applies that function to each element of a list (@pxref{Mapping | ||
| 906 | Functions}). @xref{describe-symbols example}, for a realistic example | ||
| 907 | of this. | ||
| 908 | |||
| 909 | When defining a lambda expression that is to be used as an anonymous | ||
| 910 | function, you can in principle use any method to construct the list. | ||
| 911 | But typically you should use the @code{lambda} macro, or the | ||
| 912 | @code{function} special form, or the @code{#'} read syntax: | ||
| 913 | |||
| 914 | @defmac lambda args body... | ||
| 915 | This macro returns an anonymous function with argument list @var{args} | ||
| 916 | and body forms given by @var{body}. In effect, this macro makes | ||
| 917 | @code{lambda} forms ``self-quoting'': evaluating a form whose @sc{car} | ||
| 918 | is @code{lambda} yields the form itself: | ||
| 919 | |||
| 920 | @example | ||
| 921 | (lambda (x) (* x x)) | ||
| 922 | @result{} (lambda (x) (* x x)) | ||
| 923 | @end example | ||
| 924 | |||
| 925 | The @code{lambda} form has one other effect: it tells the Emacs | ||
| 926 | evaluator and byte-compiler that its argument is a function, by using | ||
| 927 | @code{function} as a subroutine (see below). | ||
| 928 | @end defmac | ||
| 907 | 929 | ||
| 908 | Any method of creating such a list makes a valid function. Even this: | 930 | @defspec function function-object |
| 931 | @cindex function quoting | ||
| 932 | This special form returns @var{function-object} without evaluating it. | ||
| 933 | In this, it is similar to @code{quote} (@pxref{Quoting}). But unlike | ||
| 934 | @code{quote}, it also serves as a note to the Emacs evaluator and | ||
| 935 | byte-compiler that @var{function-object} is intended to be used as a | ||
| 936 | function. Assuming @var{function-object} is a valid lambda | ||
| 937 | expression, this has two effects: | ||
| 909 | 938 | ||
| 910 | @smallexample | 939 | @itemize |
| 911 | @group | 940 | @item |
| 912 | (setq silly (append '(lambda (x)) (list (list '+ (* 3 4) 'x)))) | 941 | When the code is byte-compiled, @var{function-object} is compiled into |
| 913 | @result{} (lambda (x) (+ 12 x)) | 942 | a byte-code function object (@pxref{Byte Compilation}). |
| 914 | @end group | ||
| 915 | @end smallexample | ||
| 916 | 943 | ||
| 917 | @noindent | 944 | @item |
| 918 | This computes a list that looks like @code{(lambda (x) (+ 12 x))} and | 945 | When lexical binding is enabled, @var{function-object} is converted |
| 919 | makes it the value (@emph{not} the function definition!) of | 946 | into a closure. @xref{Closures}. |
| 920 | @code{silly}. | 947 | @end itemize |
| 948 | @end defspec | ||
| 921 | 949 | ||
| 922 | Here is how we might call this function: | 950 | @cindex @samp{#'} syntax |
| 951 | The read syntax @code{#'} is a short-hand for using @code{function}. | ||
| 952 | The following forms are all equivalent: | ||
| 923 | 953 | ||
| 924 | @example | 954 | @example |
| 925 | @group | 955 | (lambda (x) (* x x)) |
| 926 | (funcall silly 1) | 956 | (function (lambda (x) (* x x))) |
| 927 | @result{} 13 | 957 | #'(lambda (x) (* x x)) |
| 928 | @end group | ||
| 929 | @end example | 958 | @end example |
| 930 | 959 | ||
| 931 | @noindent | ||
| 932 | It does @emph{not} work to write @code{(silly 1)}, because this | ||
| 933 | function is not the @emph{function definition} of @code{silly}. We | ||
| 934 | have not given @code{silly} any function definition, just a value as a | ||
| 935 | variable. | ||
| 936 | |||
| 937 | Most of the time, anonymous functions are constants that appear in | ||
| 938 | your program. For instance, you might want to pass one as an argument | ||
| 939 | to the function @code{mapcar}, which applies any given function to | ||
| 940 | each element of a list (@pxref{Mapping Functions}). | ||
| 941 | @xref{describe-symbols example}, for a realistic example of this. | ||
| 942 | |||
| 943 | In the following example, we define a @code{change-property} | 960 | In the following example, we define a @code{change-property} |
| 944 | function that takes a function as its third argument, followed by a | 961 | function that takes a function as its third argument, followed by a |
| 945 | @code{double-property} function that makes use of | 962 | @code{double-property} function that makes use of |
| @@ -959,15 +976,11 @@ function that takes a function as its third argument, followed by a | |||
| 959 | @end example | 976 | @end example |
| 960 | 977 | ||
| 961 | @noindent | 978 | @noindent |
| 962 | In the @code{double-property} function, we did not quote the | 979 | Note that we do not quote the @code{lambda} form. |
| 963 | @code{lambda} form. This is permissible, because a @code{lambda} form | ||
| 964 | is @dfn{self-quoting}: evaluating the form yields the form itself. | ||
| 965 | 980 | ||
| 966 | Whether or not you quote a @code{lambda} form makes a difference if | 981 | If you compile the above code, the anonymous function is also |
| 967 | you compile the code (@pxref{Byte Compilation}). If the @code{lambda} | 982 | compiled. This would not happen if, say, you had constructed the |
| 968 | form is unquoted, as in the above example, the anonymous function is | 983 | anonymous function by quoting it as a list: |
| 969 | also compiled. Suppose, however, that we quoted the @code{lambda} | ||
| 970 | form: | ||
| 971 | 984 | ||
| 972 | @example | 985 | @example |
| 973 | @group | 986 | @group |
| @@ -977,52 +990,10 @@ form: | |||
| 977 | @end example | 990 | @end example |
| 978 | 991 | ||
| 979 | @noindent | 992 | @noindent |
| 980 | If you compile this, the argument passed to @code{change-property} is | 993 | In that case, the anonymous function is kept as a lambda expression in |
| 981 | the precise list shown: | 994 | the compiled code. The byte-compiler cannot assume this list is a |
| 982 | 995 | function, even though it looks like one, since it does not know that | |
| 983 | @example | 996 | @code{change-property} intends to use it as a function. |
| 984 | (lambda (x) (* x 2)) | ||
| 985 | @end example | ||
| 986 | |||
| 987 | @noindent | ||
| 988 | The Lisp compiler cannot assume this list is a function, even though | ||
| 989 | it looks like one, since it does not know what @code{change-property} | ||
| 990 | will do with the list. Perhaps it will check whether the @sc{car} of | ||
| 991 | the third element is the symbol @code{*}! | ||
| 992 | |||
| 993 | @findex function | ||
| 994 | The @code{function} special form explicitly tells the byte-compiler | ||
| 995 | that its argument is a function: | ||
| 996 | |||
| 997 | @defspec function function-object | ||
| 998 | @cindex function quoting | ||
| 999 | This special form returns @var{function-object} without evaluating it. | ||
| 1000 | In this, it is equivalent to @code{quote}. However, it serves as a | ||
| 1001 | note to the Emacs Lisp compiler that @var{function-object} is intended | ||
| 1002 | to be used only as a function, and therefore can safely be compiled. | ||
| 1003 | Contrast this with @code{quote}, in @ref{Quoting}. | ||
| 1004 | @end defspec | ||
| 1005 | |||
| 1006 | @cindex @samp{#'} syntax | ||
| 1007 | The read syntax @code{#'} is a short-hand for using @code{function}. | ||
| 1008 | Generally, it is not necessary to use either @code{#'} or | ||
| 1009 | @code{function}; just use an unquoted @code{lambda} form instead. | ||
| 1010 | (Actually, @code{lambda} is a macro defined using @code{function}.) | ||
| 1011 | The following forms are all equivalent: | ||
| 1012 | |||
| 1013 | @example | ||
| 1014 | #'(lambda (x) (* x x)) | ||
| 1015 | (function (lambda (x) (* x x))) | ||
| 1016 | (lambda (x) (* x x)) | ||
| 1017 | @end example | ||
| 1018 | |||
| 1019 | We sometimes write @code{function} instead of @code{quote} when | ||
| 1020 | quoting the name of a function, but this usage is just a sort of | ||
| 1021 | comment: | ||
| 1022 | |||
| 1023 | @example | ||
| 1024 | (function @var{symbol}) @equiv{} (quote @var{symbol}) @equiv{} '@var{symbol} | ||
| 1025 | @end example | ||
| 1026 | 997 | ||
| 1027 | @node Function Cells | 998 | @node Function Cells |
| 1028 | @section Accessing Function Cell Contents | 999 | @section Accessing Function Cell Contents |
| @@ -1118,77 +1089,60 @@ This function stores @var{definition} in the function cell of | |||
| 1118 | this is not checked. The argument @var{symbol} is an ordinary evaluated | 1089 | this is not checked. The argument @var{symbol} is an ordinary evaluated |
| 1119 | argument. | 1090 | argument. |
| 1120 | 1091 | ||
| 1121 | There are three normal uses of this function: | 1092 | The primary use of this function is as a subroutine by constructs that |
| 1093 | define or alter functions, like @code{defadvice} (@pxref{Advising | ||
| 1094 | Functions}). (If @code{defun} were not a primitive, it could be | ||
| 1095 | written as a Lisp macro using @code{fset}.) You can also use it to | ||
| 1096 | give a symbol a function definition that is not a list, e.g.@: a | ||
| 1097 | keyboard macro (@pxref{Keyboard Macros}): | ||
| 1122 | 1098 | ||
| 1123 | @itemize @bullet | 1099 | @example |
| 1124 | @item | 1100 | ;; @r{Define a named keyboard macro.} |
| 1125 | Copying one symbol's function definition to another---in other words, | 1101 | (fset 'kill-two-lines "\^u2\^k") |
| 1126 | making an alternate name for a function. (If you think of this as the | 1102 | @result{} "\^u2\^k" |
| 1127 | definition of the new name, you should use @code{defalias} instead of | 1103 | @end example |
| 1128 | @code{fset}; see @ref{Definition of defalias}.) | ||
| 1129 | 1104 | ||
| 1130 | @item | 1105 | It you wish to use @code{fset} to make an alternate name for a |
| 1131 | Giving a symbol a function definition that is not a list and therefore | 1106 | function, consider using @code{defalias} instead. @xref{Definition of |
| 1132 | cannot be made with @code{defun}. For example, you can use @code{fset} | 1107 | defalias}. |
| 1133 | to give a symbol @code{s1} a function definition which is another symbol | 1108 | @end defun |
| 1134 | @code{s2}; then @code{s1} serves as an alias for whatever definition | ||
| 1135 | @code{s2} presently has. (Once again use @code{defalias} instead of | ||
| 1136 | @code{fset} if you think of this as the definition of @code{s1}.) | ||
| 1137 | 1109 | ||
| 1138 | @item | 1110 | @node Closures |
| 1139 | In constructs for defining or altering functions. If @code{defun} | 1111 | @section Closures |
| 1140 | were not a primitive, it could be written in Lisp (as a macro) using | ||
| 1141 | @code{fset}. | ||
| 1142 | @end itemize | ||
| 1143 | 1112 | ||
| 1144 | Here are examples of these uses: | 1113 | As explained in @ref{Variable Scoping}, Emacs can optionally enable |
| 1114 | lexical binding of variables. When lexical binding is enabled, any | ||
| 1115 | named function that you create (e.g.@: with @code{defun}), as well as | ||
| 1116 | any anonymous function that you create using the @code{lambda} macro | ||
| 1117 | or the @code{function} special form or the @code{#'} syntax | ||
| 1118 | (@pxref{Anonymous Functions}), is automatically converted into a | ||
| 1119 | closure. | ||
| 1145 | 1120 | ||
| 1146 | @example | 1121 | A closure is a function that also carries a record of the lexical |
| 1147 | @group | 1122 | environment that existed when the function was defined. When it is |
| 1148 | ;; @r{Save @code{foo}'s definition in @code{old-foo}.} | 1123 | invoked, any lexical variable references within its definition use the |
| 1149 | (fset 'old-foo (symbol-function 'foo)) | 1124 | retained lexical environment. In all other respects, closures behave |
| 1150 | @end group | 1125 | much like ordinary functions; in particular, they can be called in the |
| 1126 | same way as ordinary functions. | ||
| 1151 | 1127 | ||
| 1152 | @group | 1128 | @xref{Lexical Binding}, for an example of using a closure. |
| 1153 | ;; @r{Make the symbol @code{car} the function definition of @code{xfirst}.} | ||
| 1154 | ;; @r{(Most likely, @code{defalias} would be better than @code{fset} here.)} | ||
| 1155 | (fset 'xfirst 'car) | ||
| 1156 | @result{} car | ||
| 1157 | @end group | ||
| 1158 | @group | ||
| 1159 | (xfirst '(1 2 3)) | ||
| 1160 | @result{} 1 | ||
| 1161 | @end group | ||
| 1162 | @group | ||
| 1163 | (symbol-function 'xfirst) | ||
| 1164 | @result{} car | ||
| 1165 | @end group | ||
| 1166 | @group | ||
| 1167 | (symbol-function (symbol-function 'xfirst)) | ||
| 1168 | @result{} #<subr car> | ||
| 1169 | @end group | ||
| 1170 | 1129 | ||
| 1171 | @group | 1130 | Currently, an Emacs Lisp closure object is represented by a list |
| 1172 | ;; @r{Define a named keyboard macro.} | 1131 | with the symbol @code{closure} as the first element, a list |
| 1173 | (fset 'kill-two-lines "\^u2\^k") | 1132 | representing the lexical environment as the second element, and the |
| 1174 | @result{} "\^u2\^k" | 1133 | argument list and body forms as the remaining elements: |
| 1175 | @end group | ||
| 1176 | 1134 | ||
| 1177 | @group | 1135 | @example |
| 1178 | ;; @r{Here is a function that alters other functions.} | 1136 | ;; @r{lexical binding is enabled.} |
| 1179 | (defun copy-function-definition (new old) | 1137 | (lambda (x) (* x x)) |
| 1180 | "Define NEW with the same function definition as OLD." | 1138 | @result{} (closure (t) (x) (* x x)) |
| 1181 | (fset new (symbol-function old))) | ||
| 1182 | @end group | ||
| 1183 | @end example | 1139 | @end example |
| 1184 | @end defun | ||
| 1185 | 1140 | ||
| 1186 | @code{fset} is sometimes used to save the old definition of a | 1141 | @noindent |
| 1187 | function before redefining it. That permits the new definition to | 1142 | However, the fact that the internal structure of a closure is |
| 1188 | invoke the old definition. But it is unmodular and unclean for a Lisp | 1143 | ``exposed'' to the rest of the Lisp world is considered an internal |
| 1189 | file to redefine a function defined elsewhere. If you want to modify | 1144 | implementation detail. For this reason, we recommend against directly |
| 1190 | a function defined by another package, it is cleaner to use | 1145 | examining or altering the structure of closure objects. |
| 1191 | @code{defadvice} (@pxref{Advising Functions}). | ||
| 1192 | 1146 | ||
| 1193 | @node Obsolete Functions | 1147 | @node Obsolete Functions |
| 1194 | @section Declaring Functions Obsolete | 1148 | @section Declaring Functions Obsolete |
| @@ -1254,41 +1208,46 @@ this: | |||
| 1254 | @section Inline Functions | 1208 | @section Inline Functions |
| 1255 | @cindex inline functions | 1209 | @cindex inline functions |
| 1256 | 1210 | ||
| 1257 | @findex defsubst | 1211 | @defmac defsubst name argument-list body-forms... |
| 1258 | You can define an @dfn{inline function} by using @code{defsubst} instead | 1212 | Define an inline function. The syntax is exactly the same as |
| 1259 | of @code{defun}. An inline function works just like an ordinary | 1213 | @code{defun} (@pxref{Defining Functions}). |
| 1260 | function except for one thing: when you compile a call to the function, | 1214 | @end defmac |
| 1261 | the function's definition is open-coded into the caller. | 1215 | |
| 1216 | You can define an @dfn{inline function} by using @code{defsubst} | ||
| 1217 | instead of @code{defun}. An inline function works just like an | ||
| 1218 | ordinary function except for one thing: when you byte-compile a call | ||
| 1219 | to the function (@pxref{Byte Compilation}), the function's definition | ||
| 1220 | is expanded into the caller. | ||
| 1262 | 1221 | ||
| 1263 | Making a function inline makes explicit calls run faster. But it also | 1222 | Making a function inline often makes its function calls run faster. |
| 1264 | has disadvantages. For one thing, it reduces flexibility; if you | 1223 | But it also has disadvantages. For one thing, it reduces flexibility; |
| 1265 | change the definition of the function, calls already inlined still use | 1224 | if you change the definition of the function, calls already inlined |
| 1266 | the old definition until you recompile them. | 1225 | still use the old definition until you recompile them. |
| 1267 | 1226 | ||
| 1268 | Another disadvantage is that making a large function inline can increase | 1227 | Another disadvantage is that making a large function inline can |
| 1269 | the size of compiled code both in files and in memory. Since the speed | 1228 | increase the size of compiled code both in files and in memory. Since |
| 1270 | advantage of inline functions is greatest for small functions, you | 1229 | the speed advantage of inline functions is greatest for small |
| 1271 | generally should not make large functions inline. | 1230 | functions, you generally should not make large functions inline. |
| 1272 | 1231 | ||
| 1273 | Also, inline functions do not behave well with respect to debugging, | 1232 | Also, inline functions do not behave well with respect to debugging, |
| 1274 | tracing, and advising (@pxref{Advising Functions}). Since ease of | 1233 | tracing, and advising (@pxref{Advising Functions}). Since ease of |
| 1275 | debugging and the flexibility of redefining functions are important | 1234 | debugging and the flexibility of redefining functions are important |
| 1276 | features of Emacs, you should not make a function inline, even if it's | 1235 | features of Emacs, you should not make a function inline, even if it's |
| 1277 | small, unless its speed is really crucial, and you've timed the code | 1236 | small, unless its speed is really crucial, and you've timed the code |
| 1278 | to verify that using @code{defun} actually has performance problems. | 1237 | to verify that using @code{defun} actually has performance problems. |
| 1279 | 1238 | ||
| 1280 | It's possible to define a macro to expand into the same code that an | 1239 | It's possible to define a macro to expand into the same code that an |
| 1281 | inline function would execute. (@xref{Macros}.) But the macro would be | 1240 | inline function would execute (@pxref{Macros}). But the macro would |
| 1282 | limited to direct use in expressions---a macro cannot be called with | 1241 | be limited to direct use in expressions---a macro cannot be called |
| 1283 | @code{apply}, @code{mapcar} and so on. Also, it takes some work to | 1242 | with @code{apply}, @code{mapcar} and so on. Also, it takes some work |
| 1284 | convert an ordinary function into a macro. To convert it into an inline | 1243 | to convert an ordinary function into a macro. To convert it into an |
| 1285 | function is very easy; simply replace @code{defun} with @code{defsubst}. | 1244 | inline function is easy; just replace @code{defun} with |
| 1286 | Since each argument of an inline function is evaluated exactly once, you | 1245 | @code{defsubst}. Since each argument of an inline function is |
| 1287 | needn't worry about how many times the body uses the arguments, as you | 1246 | evaluated exactly once, you needn't worry about how many times the |
| 1288 | do for macros. (@xref{Argument Evaluation}.) | 1247 | body uses the arguments, as you do for macros. |
| 1289 | 1248 | ||
| 1290 | Inline functions can be used and open-coded later on in the same file, | 1249 | After an inline function is defined, its inline expansion can be |
| 1291 | following the definition, just like macros. | 1250 | performed later on in the same file, just like macros. |
| 1292 | 1251 | ||
| 1293 | @node Declaring Functions | 1252 | @node Declaring Functions |
| 1294 | @section Telling the Compiler that a Function is Defined | 1253 | @section Telling the Compiler that a Function is Defined |
| @@ -1352,12 +1311,10 @@ definition using @code{locate-library}; if that finds no file, they | |||
| 1352 | expand the definition file name relative to the directory of the file | 1311 | expand the definition file name relative to the directory of the file |
| 1353 | that contains the @code{declare-function} call. | 1312 | that contains the @code{declare-function} call. |
| 1354 | 1313 | ||
| 1355 | You can also say that a function is defined by C code by specifying a | 1314 | You can also say that a function is a primitive by specifying a file |
| 1356 | file name ending in @samp{.c} or @samp{.m}. @code{check-declare-file} | 1315 | name ending in @samp{.c} or @samp{.m}. This is useful only when you |
| 1357 | looks for these files in the C source code directory. This is useful | 1316 | call a primitive that is defined only on certain systems. Most |
| 1358 | only when you call a function that is defined only on certain systems. | 1317 | primitives are always defined, so they will never give you a warning. |
| 1359 | Most of the primitive functions of Emacs are always defined so they will | ||
| 1360 | never give you a warning. | ||
| 1361 | 1318 | ||
| 1362 | Sometimes a file will optionally use functions from an external package. | 1319 | Sometimes a file will optionally use functions from an external package. |
| 1363 | If you prefix the filename in the @code{declare-function} statement with | 1320 | If you prefix the filename in the @code{declare-function} statement with |
diff --git a/doc/lispref/help.texi b/doc/lispref/help.texi index 678ea83465f..f6556639e98 100644 --- a/doc/lispref/help.texi +++ b/doc/lispref/help.texi | |||
| @@ -582,11 +582,12 @@ If this variable is non-@code{nil}, its value is a form to evaluate | |||
| 582 | whenever the character @code{help-char} is read. If evaluating the form | 582 | whenever the character @code{help-char} is read. If evaluating the form |
| 583 | produces a string, that string is displayed. | 583 | produces a string, that string is displayed. |
| 584 | 584 | ||
| 585 | A command that calls @code{read-event} or @code{read-char} probably | 585 | A command that calls @code{read-event}, @code{read-char-choice}, or |
| 586 | should bind @code{help-form} to a non-@code{nil} expression while it | 586 | @code{read-char} probably should bind @code{help-form} to a |
| 587 | does input. (The time when you should not do this is when @kbd{C-h} has | 587 | non-@code{nil} expression while it does input. (The time when you |
| 588 | some other meaning.) Evaluating this expression should result in a | 588 | should not do this is when @kbd{C-h} has some other meaning.) |
| 589 | string that explains what the input is for and how to enter it properly. | 589 | Evaluating this expression should result in a string that explains |
| 590 | what the input is for and how to enter it properly. | ||
| 590 | 591 | ||
| 591 | Entry to the minibuffer binds this variable to the value of | 592 | Entry to the minibuffer binds this variable to the value of |
| 592 | @code{minibuffer-help-form} (@pxref{Definition of minibuffer-help-form}). | 593 | @code{minibuffer-help-form} (@pxref{Definition of minibuffer-help-form}). |
diff --git a/doc/lispref/hooks.texi b/doc/lispref/hooks.texi index 95655324ab4..ef3ebc4be35 100644 --- a/doc/lispref/hooks.texi +++ b/doc/lispref/hooks.texi | |||
| @@ -127,6 +127,9 @@ not exactly a hook, but does a similar job. | |||
| 127 | @xref{Calendar Customizing,,, emacs}. | 127 | @xref{Calendar Customizing,,, emacs}. |
| 128 | @end ifnottex | 128 | @end ifnottex |
| 129 | 129 | ||
| 130 | @item change-major-mode-after-body-hook | ||
| 131 | @xref{Mode Hooks}. | ||
| 132 | |||
| 130 | @item change-major-mode-hook | 133 | @item change-major-mode-hook |
| 131 | @xref{Creating Buffer-Local}. | 134 | @xref{Creating Buffer-Local}. |
| 132 | 135 | ||
| @@ -292,9 +295,15 @@ Manual}. | |||
| 292 | @item post-command-hook | 295 | @item post-command-hook |
| 293 | @xref{Command Overview}. | 296 | @xref{Command Overview}. |
| 294 | 297 | ||
| 298 | @item post-self-insert-hook | ||
| 299 | @xref{Keymaps and Minor Modes}. | ||
| 300 | |||
| 295 | @item pre-command-hook | 301 | @item pre-command-hook |
| 296 | @xref{Command Overview}. | 302 | @xref{Command Overview}. |
| 297 | 303 | ||
| 304 | @item prog-mode-hook | ||
| 305 | @xref{Basic Major Modes}. | ||
| 306 | |||
| 298 | @item resume-tty-functions | 307 | @item resume-tty-functions |
| 299 | @xref{Suspending Emacs}. | 308 | @xref{Suspending Emacs}. |
| 300 | 309 | ||
diff --git a/doc/lispref/macros.texi b/doc/lispref/macros.texi index 3804d963108..dca88d2b7c7 100644 --- a/doc/lispref/macros.texi +++ b/doc/lispref/macros.texi | |||
| @@ -27,7 +27,6 @@ instead. @xref{Inline Functions}. | |||
| 27 | * Expansion:: How, when and why macros are expanded. | 27 | * Expansion:: How, when and why macros are expanded. |
| 28 | * Compiling Macros:: How macros are expanded by the compiler. | 28 | * Compiling Macros:: How macros are expanded by the compiler. |
| 29 | * Defining Macros:: How to write a macro definition. | 29 | * Defining Macros:: How to write a macro definition. |
| 30 | * Backquote:: Easier construction of list structure. | ||
| 31 | * Problems with Macros:: Don't evaluate the macro arguments too many times. | 30 | * Problems with Macros:: Don't evaluate the macro arguments too many times. |
| 32 | Don't hide the user's variables. | 31 | Don't hide the user's variables. |
| 33 | * Indenting Macros:: Specifying how to indent macro calls. | 32 | * Indenting Macros:: Specifying how to indent macro calls. |
| @@ -78,10 +77,9 @@ to the argument values from the macro call, or to a list of them in the | |||
| 78 | case of a @code{&rest} argument. And the macro body executes and | 77 | case of a @code{&rest} argument. And the macro body executes and |
| 79 | returns its value just as a function body does. | 78 | returns its value just as a function body does. |
| 80 | 79 | ||
| 81 | The second crucial difference between macros and functions is that the | 80 | The second crucial difference between macros and functions is that |
| 82 | value returned by the macro body is not the value of the macro call. | 81 | the value returned by the macro body is an alternate Lisp expression, |
| 83 | Instead, it is an alternate expression for computing that value, also | 82 | also known as the @dfn{expansion} of the macro. The Lisp interpreter |
| 84 | known as the @dfn{expansion} of the macro. The Lisp interpreter | ||
| 85 | proceeds to evaluate the expansion as soon as it comes back from the | 83 | proceeds to evaluate the expansion as soon as it comes back from the |
| 86 | macro. | 84 | macro. |
| 87 | 85 | ||
| @@ -221,7 +219,26 @@ any @code{interactive} declaration is ignored since macros cannot be | |||
| 221 | called interactively. | 219 | called interactively. |
| 222 | @end defspec | 220 | @end defspec |
| 223 | 221 | ||
| 224 | The body of the macro definition can include a @code{declare} form, | 222 | Macros often need to construct large list structures from a mixture |
| 223 | of constants and nonconstant parts. To make this easier, use the | ||
| 224 | @samp{`} syntax (@pxref{Backquote}). For example: | ||
| 225 | |||
| 226 | @example | ||
| 227 | @example | ||
| 228 | @group | ||
| 229 | (defmacro t-becomes-nil (variable) | ||
| 230 | `(if (eq ,variable t) | ||
| 231 | (setq ,variable nil))) | ||
| 232 | @end group | ||
| 233 | |||
| 234 | @group | ||
| 235 | (t-becomes-nil foo) | ||
| 236 | @equiv{} (if (eq foo t) (setq foo nil)) | ||
| 237 | @end group | ||
| 238 | @end example | ||
| 239 | @end example | ||
| 240 | |||
| 241 | The body of a macro definition can include a @code{declare} form, | ||
| 225 | which can specify how @key{TAB} should indent macro calls, and how to | 242 | which can specify how @key{TAB} should indent macro calls, and how to |
| 226 | step through them for Edebug. | 243 | step through them for Edebug. |
| 227 | 244 | ||
| @@ -259,107 +276,11 @@ without evaluating any @var{specs}. | |||
| 259 | has no effect on how the macro expands, on what the macro means in the | 276 | has no effect on how the macro expands, on what the macro means in the |
| 260 | program. It only affects the secondary features listed above. | 277 | program. It only affects the secondary features listed above. |
| 261 | 278 | ||
| 262 | @node Backquote | ||
| 263 | @section Backquote | ||
| 264 | @cindex backquote (list substitution) | ||
| 265 | @cindex ` (list substitution) | ||
| 266 | @findex ` | ||
| 267 | |||
| 268 | Macros often need to construct large list structures from a mixture of | ||
| 269 | constants and nonconstant parts. To make this easier, use the @samp{`} | ||
| 270 | syntax (usually called @dfn{backquote}). | ||
| 271 | |||
| 272 | Backquote allows you to quote a list, but selectively evaluate | ||
| 273 | elements of that list. In the simplest case, it is identical to the | ||
| 274 | special form @code{quote} (@pxref{Quoting}). For example, these | ||
| 275 | two forms yield identical results: | ||
| 276 | |||
| 277 | @example | ||
| 278 | @group | ||
| 279 | `(a list of (+ 2 3) elements) | ||
| 280 | @result{} (a list of (+ 2 3) elements) | ||
| 281 | @end group | ||
| 282 | @group | ||
| 283 | '(a list of (+ 2 3) elements) | ||
| 284 | @result{} (a list of (+ 2 3) elements) | ||
| 285 | @end group | ||
| 286 | @end example | ||
| 287 | |||
| 288 | @findex , @r{(with backquote)} | ||
| 289 | The special marker @samp{,} inside of the argument to backquote | ||
| 290 | indicates a value that isn't constant. Backquote evaluates the | ||
| 291 | argument of @samp{,} and puts the value in the list structure: | ||
| 292 | |||
| 293 | @example | ||
| 294 | @group | ||
| 295 | (list 'a 'list 'of (+ 2 3) 'elements) | ||
| 296 | @result{} (a list of 5 elements) | ||
| 297 | @end group | ||
| 298 | @group | ||
| 299 | `(a list of ,(+ 2 3) elements) | ||
| 300 | @result{} (a list of 5 elements) | ||
| 301 | @end group | ||
| 302 | @end example | ||
| 303 | |||
| 304 | Substitution with @samp{,} is allowed at deeper levels of the list | ||
| 305 | structure also. For example: | ||
| 306 | |||
| 307 | @example | ||
| 308 | @group | ||
| 309 | (defmacro t-becomes-nil (variable) | ||
| 310 | `(if (eq ,variable t) | ||
| 311 | (setq ,variable nil))) | ||
| 312 | @end group | ||
| 313 | |||
| 314 | @group | ||
| 315 | (t-becomes-nil foo) | ||
| 316 | @equiv{} (if (eq foo t) (setq foo nil)) | ||
| 317 | @end group | ||
| 318 | @end example | ||
| 319 | |||
| 320 | @findex ,@@ @r{(with backquote)} | ||
| 321 | @cindex splicing (with backquote) | ||
| 322 | You can also @dfn{splice} an evaluated value into the resulting list, | ||
| 323 | using the special marker @samp{,@@}. The elements of the spliced list | ||
| 324 | become elements at the same level as the other elements of the resulting | ||
| 325 | list. The equivalent code without using @samp{`} is often unreadable. | ||
| 326 | Here are some examples: | ||
| 327 | |||
| 328 | @example | ||
| 329 | @group | ||
| 330 | (setq some-list '(2 3)) | ||
| 331 | @result{} (2 3) | ||
| 332 | @end group | ||
| 333 | @group | ||
| 334 | (cons 1 (append some-list '(4) some-list)) | ||
| 335 | @result{} (1 2 3 4 2 3) | ||
| 336 | @end group | ||
| 337 | @group | ||
| 338 | `(1 ,@@some-list 4 ,@@some-list) | ||
| 339 | @result{} (1 2 3 4 2 3) | ||
| 340 | @end group | ||
| 341 | |||
| 342 | @group | ||
| 343 | (setq list '(hack foo bar)) | ||
| 344 | @result{} (hack foo bar) | ||
| 345 | @end group | ||
| 346 | @group | ||
| 347 | (cons 'use | ||
| 348 | (cons 'the | ||
| 349 | (cons 'words (append (cdr list) '(as elements))))) | ||
| 350 | @result{} (use the words foo bar as elements) | ||
| 351 | @end group | ||
| 352 | @group | ||
| 353 | `(use the words ,@@(cdr list) as elements) | ||
| 354 | @result{} (use the words foo bar as elements) | ||
| 355 | @end group | ||
| 356 | @end example | ||
| 357 | |||
| 358 | @node Problems with Macros | 279 | @node Problems with Macros |
| 359 | @section Common Problems Using Macros | 280 | @section Common Problems Using Macros |
| 360 | 281 | ||
| 361 | The basic facts of macro expansion have counterintuitive consequences. | 282 | Macro expansion can have counterintuitive consequences. This |
| 362 | This section describes some important consequences that can lead to | 283 | section describes some important consequences that can lead to |
| 363 | trouble, and rules to follow to avoid trouble. | 284 | trouble, and rules to follow to avoid trouble. |
| 364 | 285 | ||
| 365 | @menu | 286 | @menu |
| @@ -407,9 +328,8 @@ program is actually run. | |||
| 407 | 328 | ||
| 408 | When defining a macro you must pay attention to the number of times | 329 | When defining a macro you must pay attention to the number of times |
| 409 | the arguments will be evaluated when the expansion is executed. The | 330 | the arguments will be evaluated when the expansion is executed. The |
| 410 | following macro (used to facilitate iteration) illustrates the problem. | 331 | following macro (used to facilitate iteration) illustrates the |
| 411 | This macro allows us to write a simple ``for'' loop such as one might | 332 | problem. This macro allows us to write a ``for'' loop construct. |
| 412 | find in Pascal. | ||
| 413 | 333 | ||
| 414 | @findex for | 334 | @findex for |
| 415 | @smallexample | 335 | @smallexample |
| @@ -683,9 +603,9 @@ either. | |||
| 683 | @node Indenting Macros | 603 | @node Indenting Macros |
| 684 | @section Indenting Macros | 604 | @section Indenting Macros |
| 685 | 605 | ||
| 686 | You can use the @code{declare} form in the macro definition to | 606 | Within a macro definition, you can use the @code{declare} form |
| 687 | specify how to @key{TAB} should indent calls to the macro. You | 607 | (@pxref{Defining Macros}) to specify how to @key{TAB} should indent |
| 688 | write it like this: | 608 | calls to the macro. An indentation specifiction is written like this: |
| 689 | 609 | ||
| 690 | @example | 610 | @example |
| 691 | (declare (indent @var{indent-spec})) | 611 | (declare (indent @var{indent-spec})) |
| @@ -715,6 +635,7 @@ the line uses the standard pattern. | |||
| 715 | @var{symbol} should be a function name; that function is called to | 635 | @var{symbol} should be a function name; that function is called to |
| 716 | calculate the indentation of a line within this expression. The | 636 | calculate the indentation of a line within this expression. The |
| 717 | function receives two arguments: | 637 | function receives two arguments: |
| 638 | |||
| 718 | @table @asis | 639 | @table @asis |
| 719 | @item @var{state} | 640 | @item @var{state} |
| 720 | The value returned by @code{parse-partial-sexp} (a Lisp primitive for | 641 | The value returned by @code{parse-partial-sexp} (a Lisp primitive for |
| @@ -723,6 +644,7 @@ beginning of this line. | |||
| 723 | @item @var{pos} | 644 | @item @var{pos} |
| 724 | The position at which the line being indented begins. | 645 | The position at which the line being indented begins. |
| 725 | @end table | 646 | @end table |
| 647 | |||
| 726 | @noindent | 648 | @noindent |
| 727 | It should return either a number, which is the number of columns of | 649 | It should return either a number, which is the number of columns of |
| 728 | indentation for that line, or a list whose car is such a number. The | 650 | indentation for that line, or a list whose car is such a number. The |
diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index e3008470233..a71138f5268 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi | |||
| @@ -1335,19 +1335,19 @@ but uses the predicate @code{user-variable-p} instead of | |||
| 1335 | @deffn Command read-color &optional prompt convert allow-empty display | 1335 | @deffn Command read-color &optional prompt convert allow-empty display |
| 1336 | This function reads a string that is a color specification, either the | 1336 | This function reads a string that is a color specification, either the |
| 1337 | color's name or an RGB hex value such as @code{#RRRGGGBBB}. It | 1337 | color's name or an RGB hex value such as @code{#RRRGGGBBB}. It |
| 1338 | prompts with @var{prompt} (default: @code{"Color (name or #R+G+B+):"}) | 1338 | prompts with @var{prompt} (default: @code{"Color (name or #RGB triplet):"}) |
| 1339 | and provides completion for color names, but not for hex RGB values. | 1339 | and provides completion for color names, but not for hex RGB values. |
| 1340 | In addition to names of standard colors, completion candidates include | 1340 | In addition to names of standard colors, completion candidates include |
| 1341 | the foreground and background colors at point. | 1341 | the foreground and background colors at point. |
| 1342 | 1342 | ||
| 1343 | Valid RGB values are described in @ref{Color Names}. | 1343 | Valid RGB values are described in @ref{Color Names}. |
| 1344 | 1344 | ||
| 1345 | The function's return value is the color name typed by the user in the | 1345 | The function's return value is the string typed by the user in the |
| 1346 | minibuffer. However, when called interactively or if the optional | 1346 | minibuffer. However, when called interactively or if the optional |
| 1347 | argument @var{convert} is non-@code{nil}, it converts the name into | 1347 | argument @var{convert} is non-@code{nil}, it converts any input color |
| 1348 | the color's RGB value and returns that value as a string. If an | 1348 | name into the corresponding RGB value string and instead returns that. |
| 1349 | invalid color name was specified, this function signals an error, | 1349 | This function requires a valid color specification to be input. |
| 1350 | except that empty color names are allowed when @code{allow-empty} is | 1350 | Empty color names are allowed when @code{allow-empty} is |
| 1351 | non-@code{nil} and the user enters null input. | 1351 | non-@code{nil} and the user enters null input. |
| 1352 | 1352 | ||
| 1353 | Interactively, or when @var{display} is non-@code{nil}, the return | 1353 | Interactively, or when @var{display} is non-@code{nil}, the return |
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index 53120d72bd1..638ab89e37f 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi | |||
| @@ -135,21 +135,32 @@ This macro runs the abnormal hook @code{hook} as a series of nested | |||
| 135 | ``wrapper functions'' around the @var{body} forms. The effect is | 135 | ``wrapper functions'' around the @var{body} forms. The effect is |
| 136 | similar to nested @code{around} advices (@pxref{Around-Advice}). | 136 | similar to nested @code{around} advices (@pxref{Around-Advice}). |
| 137 | 137 | ||
| 138 | Each hook function must accept an argument list consisting of a function | 138 | Each hook function should accept an argument list consisting of a function |
| 139 | @var{fun}, followed by the additional arguments listed in @var{args}. | 139 | @var{fun}, followed by the additional arguments listed in @var{args}. |
| 140 | The function @var{fun} passed to the very first hook function in | 140 | The first hook function is passed a function @var{fun} that, if it is |
| 141 | @var{hook} does the same as @var{body}, if it is called with arguments | 141 | called with arguments @var{args}, performs @var{body} (i.e., the default |
| 142 | @var{args}. The @var{fun} passed to each successive hook function is | 142 | operation). The @var{fun} passed to each successive hook function is |
| 143 | constructed from all the preceding hook functions (and @var{body}); if | 143 | constructed from all the preceding hook functions (and @var{body}); if |
| 144 | this @var{fun} is called with arguments @var{args}, it does what the | 144 | this @var{fun} is called with arguments @var{args}, it does what the |
| 145 | @code{with-wrapper-hook} call would if the preceding hook functions were | 145 | @code{with-wrapper-hook} call would if the preceding hook functions were |
| 146 | the only ones in @var{hook}. | 146 | the only ones in @var{hook}. |
| 147 | 147 | ||
| 148 | In the function definition of the hook function, @var{fun} can be called | 148 | Each hook function may call its @var{fun} argument as many times as it |
| 149 | any number of times (including not calling it at all). This function | 149 | wishes, including never. In that case, such a hook function acts to |
| 150 | definition is then used to construct the @var{fun} passed to the next | 150 | replace the default definition altogether, and any preceding hook |
| 151 | hook function in @var{hook}, if any. The last or ``outermost'' | 151 | functions. Of course, a subsequent hook function may do the same thing. |
| 152 | @var{fun} is called once to produce the effect. | 152 | |
| 153 | Each hook function definition is used to construct the @var{fun} passed | ||
| 154 | to the next hook function in @var{hook}, if any. The last or | ||
| 155 | ``outermost'' @var{fun} is called once to produce the overall effect. | ||
| 156 | |||
| 157 | When might you want to use a wrapper hook? The function | ||
| 158 | @code{filter-buffer-substring} illustrates a common case. There is a | ||
| 159 | basic functionality, performed by @var{body}---in this case, to extract | ||
| 160 | a buffer-substring. Then any number of hook functions can act in | ||
| 161 | sequence to modify that string, before returning the final result. | ||
| 162 | A wrapper-hook also allows for a hook function to completely replace the | ||
| 163 | default definition (by not calling @var{fun}). | ||
| 153 | @end defmac | 164 | @end defmac |
| 154 | 165 | ||
| 155 | @node Setting Hooks | 166 | @node Setting Hooks |
| @@ -468,8 +479,9 @@ other packages would interfere with them. | |||
| 468 | @cindex major mode hook | 479 | @cindex major mode hook |
| 469 | Each major mode should have a normal @dfn{mode hook} named | 480 | Each major mode should have a normal @dfn{mode hook} named |
| 470 | @code{@var{modename}-mode-hook}. The very last thing the major mode command | 481 | @code{@var{modename}-mode-hook}. The very last thing the major mode command |
| 471 | should do is to call @code{run-mode-hooks}. This runs the mode hook, | 482 | should do is to call @code{run-mode-hooks}. This runs the normal |
| 472 | and then runs the normal hook @code{after-change-major-mode-hook}. | 483 | hook @code{change-major-mode-after-body-hook}, the mode hook, |
| 484 | and then the normal hook @code{after-change-major-mode-hook}. | ||
| 473 | @xref{Mode Hooks}. | 485 | @xref{Mode Hooks}. |
| 474 | 486 | ||
| 475 | @item | 487 | @item |
| @@ -939,8 +951,9 @@ before it runs the mode hook variable @code{@var{mode}-hook}. | |||
| 939 | @node Mode Hooks | 951 | @node Mode Hooks |
| 940 | @subsection Mode Hooks | 952 | @subsection Mode Hooks |
| 941 | 953 | ||
| 942 | Every major mode command should finish by running its mode hook and | 954 | Every major mode command should finish by running the mode-independent |
| 943 | the mode-independent normal hook @code{after-change-major-mode-hook}. | 955 | normal hook @code{change-major-mode-after-body-hook}, its mode hook, |
| 956 | and the normal hook @code{after-change-major-mode-hook}. | ||
| 944 | It does this by calling @code{run-mode-hooks}. If the major mode is a | 957 | It does this by calling @code{run-mode-hooks}. If the major mode is a |
| 945 | derived mode, that is if it calls another major mode (the parent mode) | 958 | derived mode, that is if it calls another major mode (the parent mode) |
| 946 | in its body, it should do this inside @code{delay-mode-hooks} so that | 959 | in its body, it should do this inside @code{delay-mode-hooks} so that |
| @@ -949,11 +962,12 @@ call to @code{run-mode-hooks} runs the parent's mode hook too. | |||
| 949 | @xref{Major Mode Conventions}. | 962 | @xref{Major Mode Conventions}. |
| 950 | 963 | ||
| 951 | Emacs versions before Emacs 22 did not have @code{delay-mode-hooks}. | 964 | Emacs versions before Emacs 22 did not have @code{delay-mode-hooks}. |
| 952 | When user-implemented major modes have not been updated to use it, | 965 | Versions before 24 did not have @code{change-major-mode-after-body-hook}. |
| 953 | they won't entirely follow these conventions: they may run the | 966 | When user-implemented major modes do not use @code{run-mode-hooks} and |
| 954 | parent's mode hook too early, or fail to run | 967 | have not been updated to use these newer features, they won't entirely |
| 955 | @code{after-change-major-mode-hook}. If you encounter such a major | 968 | follow these conventions: they may run the parent's mode hook too early, |
| 956 | mode, please correct it to follow these conventions. | 969 | or fail to run @code{after-change-major-mode-hook}. If you encounter |
| 970 | such a major mode, please correct it to follow these conventions. | ||
| 957 | 971 | ||
| 958 | When you defined a major mode using @code{define-derived-mode}, it | 972 | When you defined a major mode using @code{define-derived-mode}, it |
| 959 | automatically makes sure these conventions are followed. If you | 973 | automatically makes sure these conventions are followed. If you |
| @@ -963,6 +977,7 @@ use the following functions to handle these conventions automatically. | |||
| 963 | @defun run-mode-hooks &rest hookvars | 977 | @defun run-mode-hooks &rest hookvars |
| 964 | Major modes should run their mode hook using this function. It is | 978 | Major modes should run their mode hook using this function. It is |
| 965 | similar to @code{run-hooks} (@pxref{Hooks}), but it also runs | 979 | similar to @code{run-hooks} (@pxref{Hooks}), but it also runs |
| 980 | @code{change-major-mode-after-body-hook} and | ||
| 966 | @code{after-change-major-mode-hook}. | 981 | @code{after-change-major-mode-hook}. |
| 967 | 982 | ||
| 968 | When this function is called during the execution of a | 983 | When this function is called during the execution of a |
| @@ -982,6 +997,11 @@ The hooks will actually run during the next call to | |||
| 982 | construct. | 997 | construct. |
| 983 | @end defmac | 998 | @end defmac |
| 984 | 999 | ||
| 1000 | @defvar change-major-mode-after-body-hook | ||
| 1001 | This is a normal hook run by @code{run-mode-hooks}. It is run before | ||
| 1002 | the mode hooks. | ||
| 1003 | @end defvar | ||
| 1004 | |||
| 985 | @defvar after-change-major-mode-hook | 1005 | @defvar after-change-major-mode-hook |
| 986 | This is a normal hook run by @code{run-mode-hooks}. It is run at the | 1006 | This is a normal hook run by @code{run-mode-hooks}. It is run at the |
| 987 | very end of every properly-written major mode command. | 1007 | very end of every properly-written major mode command. |
| @@ -1332,11 +1352,12 @@ alist @code{minor-mode-map-alist}. @xref{Definition of minor-mode-map-alist}. | |||
| 1332 | @cindex @code{self-insert-command}, minor modes | 1352 | @cindex @code{self-insert-command}, minor modes |
| 1333 | One use of minor mode keymaps is to modify the behavior of certain | 1353 | One use of minor mode keymaps is to modify the behavior of certain |
| 1334 | self-inserting characters so that they do something else as well as | 1354 | self-inserting characters so that they do something else as well as |
| 1335 | self-insert. In general, this is the only way to do that, since the | 1355 | self-insert. (Another way to customize @code{self-insert-command} is |
| 1336 | facilities for customizing @code{self-insert-command} are limited to | 1356 | through @code{post-self-insert-hook}. Apart from this, the facilities |
| 1337 | special cases (designed for abbrevs and Auto Fill mode). (Do not try | 1357 | for customizing @code{self-insert-command} are limited to special cases, |
| 1338 | substituting your own definition of @code{self-insert-command} for the | 1358 | designed for abbrevs and Auto Fill mode. Do not try substituting your |
| 1339 | standard one. The editor command loop handles this function specially.) | 1359 | own definition of @code{self-insert-command} for the standard one. The |
| 1360 | editor command loop handles this function specially.) | ||
| 1340 | 1361 | ||
| 1341 | The key sequences bound in a minor mode should consist of @kbd{C-c} | 1362 | The key sequences bound in a minor mode should consist of @kbd{C-c} |
| 1342 | followed by one of @kbd{.,/?`'"[]\|~!#$%^&*()-_+=}. (The other | 1363 | followed by one of @kbd{.,/?`'"[]\|~!#$%^&*()-_+=}. (The other |
| @@ -1351,11 +1372,11 @@ implementing a mode in one self-contained definition. | |||
| 1351 | @defmac define-minor-mode mode doc [init-value [lighter [keymap]]] keyword-args@dots{} body@dots{} | 1372 | @defmac define-minor-mode mode doc [init-value [lighter [keymap]]] keyword-args@dots{} body@dots{} |
| 1352 | This macro defines a new minor mode whose name is @var{mode} (a | 1373 | This macro defines a new minor mode whose name is @var{mode} (a |
| 1353 | symbol). It defines a command named @var{mode} to toggle the minor | 1374 | symbol). It defines a command named @var{mode} to toggle the minor |
| 1354 | mode, with @var{doc} as its documentation string. It also defines a | 1375 | mode, with @var{doc} as its documentation string. By default, it also |
| 1355 | variable named @var{mode}, which is set to @code{t} or @code{nil} by | 1376 | defines a variable named @var{mode}, which is set to @code{t} or |
| 1356 | enabling or disabling the mode. The variable is initialized to | 1377 | @code{nil} by enabling or disabling the mode. The variable is |
| 1357 | @var{init-value}. Except in unusual circumstances (see below), this | 1378 | initialized to @var{init-value}. Except in unusual circumstances (see |
| 1358 | value must be @code{nil}. | 1379 | below), this value must be @code{nil}. |
| 1359 | 1380 | ||
| 1360 | The string @var{lighter} says what to display in the mode line | 1381 | The string @var{lighter} says what to display in the mode line |
| 1361 | when the mode is enabled; if it is @code{nil}, the mode is not displayed | 1382 | when the mode is enabled; if it is @code{nil}, the mode is not displayed |
| @@ -1410,6 +1431,17 @@ This is equivalent to specifying @var{lighter} positionally. | |||
| 1410 | 1431 | ||
| 1411 | @item :keymap @var{keymap} | 1432 | @item :keymap @var{keymap} |
| 1412 | This is equivalent to specifying @var{keymap} positionally. | 1433 | This is equivalent to specifying @var{keymap} positionally. |
| 1434 | |||
| 1435 | @item :variable @var{place} | ||
| 1436 | This replaces the default variable @var{mode}, used to store the state | ||
| 1437 | of the mode. If you specify this, the @var{mode} variable is not | ||
| 1438 | defined, and any @var{init-value} argument is unused. @var{place} | ||
| 1439 | can be a different named variable (which you must define yourself), or | ||
| 1440 | anything that can be used with the @code{setf} function | ||
| 1441 | (@pxref{Generalized Variables,,, cl, Common Lisp Extensions}). | ||
| 1442 | @var{place} can also be a cons @code{(@var{get} . @var{set})}, | ||
| 1443 | where @var{get} is an expression that returns the current state, | ||
| 1444 | and @var{set} is a function of one argument (a state) that sets it. | ||
| 1413 | @end table | 1445 | @end table |
| 1414 | 1446 | ||
| 1415 | Any other keyword arguments are passed directly to the | 1447 | Any other keyword arguments are passed directly to the |
| @@ -1510,8 +1542,15 @@ starts, for example by providing a @code{:require} keyword. | |||
| 1510 | 1542 | ||
| 1511 | Use @code{:group @var{group}} in @var{keyword-args} to specify the | 1543 | Use @code{:group @var{group}} in @var{keyword-args} to specify the |
| 1512 | custom group for the mode variable of the global minor mode. | 1544 | custom group for the mode variable of the global minor mode. |
| 1545 | |||
| 1546 | Generally speaking, when you define a globalized minor mode, you should | ||
| 1547 | also define a non-globalized version, so that people can use (or | ||
| 1548 | disable) it in individual buffers. This also allows them to disable a | ||
| 1549 | globally enabled minor mode in a specific major mode, by using that | ||
| 1550 | mode's hook. | ||
| 1513 | @end defmac | 1551 | @end defmac |
| 1514 | 1552 | ||
| 1553 | |||
| 1515 | @node Mode Line Format | 1554 | @node Mode Line Format |
| 1516 | @section Mode-Line Format | 1555 | @section Mode-Line Format |
| 1517 | @cindex mode line | 1556 | @cindex mode line |
diff --git a/doc/lispref/numbers.texi b/doc/lispref/numbers.texi index bec9f295227..82336aa537f 100644 --- a/doc/lispref/numbers.texi +++ b/doc/lispref/numbers.texi | |||
| @@ -284,7 +284,7 @@ floating point), and returns @code{t} if so, @code{nil} otherwise. | |||
| 284 | 284 | ||
| 285 | @defun natnump object | 285 | @defun natnump object |
| 286 | @cindex natural numbers | 286 | @cindex natural numbers |
| 287 | This predicate (whose name comes from the phrase ``natual number'') | 287 | This predicate (whose name comes from the phrase ``natural number'') |
| 288 | tests to see whether its argument is a nonnegative integer, and | 288 | tests to see whether its argument is a nonnegative integer, and |
| 289 | returns @code{t} if so, @code{nil} otherwise. 0 is considered | 289 | returns @code{t} if so, @code{nil} otherwise. 0 is considered |
| 290 | non-negative. | 290 | non-negative. |
diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi index 38eb5a86471..4cfc954cd1f 100644 --- a/doc/lispref/processes.texi +++ b/doc/lispref/processes.texi | |||
| @@ -300,7 +300,8 @@ MS-DOS doesn't support asynchronous subprocesses, so this option doesn't | |||
| 300 | work there. | 300 | work there. |
| 301 | 301 | ||
| 302 | @item @code{(:file @var{file-name})} | 302 | @item @code{(:file @var{file-name})} |
| 303 | Send the output to the file name specified. | 303 | Send the output to the file name specified, overwriting it if it |
| 304 | already exists. | ||
| 304 | 305 | ||
| 305 | @item @code{(@var{real-destination} @var{error-destination})} | 306 | @item @code{(@var{real-destination} @var{error-destination})} |
| 306 | Keep the standard output stream separate from the standard error stream; | 307 | Keep the standard output stream separate from the standard error stream; |
diff --git a/doc/lispref/syntax.texi b/doc/lispref/syntax.texi index 71742e37a51..3d153e43b2d 100644 --- a/doc/lispref/syntax.texi +++ b/doc/lispref/syntax.texi | |||
| @@ -606,11 +606,13 @@ expression prefix syntax class, and characters with the @samp{p} flag. | |||
| 606 | @section Parsing Expressions | 606 | @section Parsing Expressions |
| 607 | 607 | ||
| 608 | This section describes functions for parsing and scanning balanced | 608 | This section describes functions for parsing and scanning balanced |
| 609 | expressions, also known as @dfn{sexps}. Basically, a sexp is either a | 609 | expressions. We will refer to such expressions as @dfn{sexps}, |
| 610 | balanced parenthetical grouping, a string, or a symbol name (a | 610 | following the terminology of Lisp, even though these functions can act |
| 611 | sequence of characters whose syntax is either word constituent or | 611 | on languages other than Lisp. Basically, a sexp is either a balanced |
| 612 | symbol constituent). However, characters whose syntax is expression | 612 | parenthetical grouping, a string, or a ``symbol'' (i.e.@: a sequence |
| 613 | prefix are treated as part of the sexp if they appear next to it. | 613 | of characters whose syntax is either word constituent or symbol |
| 614 | constituent). However, characters whose syntax is expression prefix | ||
| 615 | are treated as part of the sexp if they appear next to it. | ||
| 614 | 616 | ||
| 615 | The syntax table controls the interpretation of characters, so these | 617 | The syntax table controls the interpretation of characters, so these |
| 616 | functions can be used for Lisp expressions when in Lisp mode and for C | 618 | functions can be used for Lisp expressions when in Lisp mode and for C |
| @@ -830,10 +832,6 @@ The value is @code{nil} if @var{state} represents a parse which has | |||
| 830 | arrived at a top level position. | 832 | arrived at a top level position. |
| 831 | @end defun | 833 | @end defun |
| 832 | 834 | ||
| 833 | We have provided this access function rather than document how the | ||
| 834 | data is represented in the state, because we plan to change the | ||
| 835 | representation in the future. | ||
| 836 | |||
| 837 | @node Low-Level Parsing | 835 | @node Low-Level Parsing |
| 838 | @subsection Low-Level Parsing | 836 | @subsection Low-Level Parsing |
| 839 | 837 | ||
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index 55b0c0a4be8..8e7434de2ed 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi | |||
| @@ -218,44 +218,46 @@ This is like @code{buffer-substring}, except that it does not copy text | |||
| 218 | properties, just the characters themselves. @xref{Text Properties}. | 218 | properties, just the characters themselves. @xref{Text Properties}. |
| 219 | @end defun | 219 | @end defun |
| 220 | 220 | ||
| 221 | @defun filter-buffer-substring start end &optional delete noprops | 221 | @defun filter-buffer-substring start end &optional delete |
| 222 | This function passes the buffer text between @var{start} and @var{end} | 222 | This function passes the buffer text between @var{start} and @var{end} |
| 223 | through the filter functions specified by the variable | 223 | through the filter functions specified by the wrapper hook |
| 224 | @code{buffer-substring-filters}, and returns the value from the last | 224 | @code{filter-buffer-substring-functions}, and returns the final |
| 225 | filter function. If @code{buffer-substring-filters} is @code{nil}, | 225 | result of applying all filters. The obsolete variable |
| 226 | the value is the unaltered text from the buffer, what | 226 | @code{buffer-substring-filters} is also consulted. If both of these |
| 227 | @code{buffer-substring} would return. | 227 | variables are @code{nil}, the value is the unaltered text from the |
| 228 | buffer, as @code{buffer-substring} would return. | ||
| 228 | 229 | ||
| 229 | If @var{delete} is non-@code{nil}, this function deletes the text | 230 | If @var{delete} is non-@code{nil}, this function deletes the text |
| 230 | between @var{start} and @var{end} after copying it, like | 231 | between @var{start} and @var{end} after copying it, like |
| 231 | @code{delete-and-extract-region}. | 232 | @code{delete-and-extract-region}. |
| 232 | 233 | ||
| 233 | If @var{noprops} is non-@code{nil}, the final string returned does not | ||
| 234 | include text properties, while the string passed through the filters | ||
| 235 | still includes text properties from the buffer text. | ||
| 236 | |||
| 237 | Lisp code should use this function instead of @code{buffer-substring}, | 234 | Lisp code should use this function instead of @code{buffer-substring}, |
| 238 | @code{buffer-substring-no-properties}, | 235 | @code{buffer-substring-no-properties}, |
| 239 | or @code{delete-and-extract-region} when copying into user-accessible | 236 | or @code{delete-and-extract-region} when copying into user-accessible |
| 240 | data structures such as the kill-ring, X clipboard, and registers. | 237 | data structures such as the kill-ring, X clipboard, and registers. |
| 241 | Major and minor modes can add functions to | 238 | Major and minor modes can add functions to |
| 242 | @code{buffer-substring-filters} to alter such text as it is copied out | 239 | @code{filter-buffer-substring-functions} to alter such text as it is |
| 243 | of the buffer. | 240 | copied out of the buffer. |
| 244 | @end defun | 241 | @end defun |
| 245 | 242 | ||
| 246 | @defvar buffer-substring-filters | 243 | @defvar filter-buffer-substring-functions |
| 247 | This variable should be a list of functions that accept a single | 244 | This variable is a wrapper hook (@pxref{Running Hooks}), whose members |
| 248 | argument, a string, and return a string. | 245 | should be functions that accept four arguments: @var{fun}, |
| 249 | @code{filter-buffer-substring} passes the buffer substring to the | 246 | @var{start}, @var{end}, and @var{delete}. @var{fun} is a function |
| 250 | first function in this list, and the return value of each function is | 247 | that takes three arguments (@var{start}, @var{end}, and @var{delete}), |
| 251 | passed to the next function. The return value of the last function is | 248 | and returns a string. In both cases, the @var{start}, @var{end}, and |
| 252 | used as the return value of @code{filter-buffer-substring}. | 249 | @var{delete} arguments are the same as those of |
| 253 | 250 | @code{filter-buffer-substring}. | |
| 254 | As a special convention, point is set to the start of the buffer text | 251 | |
| 255 | being operated on (i.e., the @var{start} argument for | 252 | The first hook function is passed a @var{fun} that is equivalent to |
| 256 | @code{filter-buffer-substring}) before these functions are called. | 253 | the default operation of @code{filter-buffer-substring}, i.e. it |
| 257 | 254 | returns the buffer-substring between @var{start} and @var{end} | |
| 258 | If this variable is @code{nil}, no filtering is performed. | 255 | (processed by any @code{buffer-substring-filters}) and optionally |
| 256 | deletes the original text from the buffer. In most cases, the hook | ||
| 257 | function will call @var{fun} once, and then do its own processing of | ||
| 258 | the result. The next hook function receives a @var{fun} equivalent to | ||
| 259 | this, and so on. The actual return value is the result of all the | ||
| 260 | hook functions acting in sequence. | ||
| 259 | @end defvar | 261 | @end defvar |
| 260 | 262 | ||
| 261 | @defun buffer-string | 263 | @defun buffer-string |
| @@ -500,6 +502,11 @@ syntax. (@xref{Abbrevs}, and @ref{Syntax Class Table}.) It is also | |||
| 500 | responsible for calling @code{blink-paren-function} when the inserted | 502 | responsible for calling @code{blink-paren-function} when the inserted |
| 501 | character has close parenthesis syntax (@pxref{Blinking}). | 503 | character has close parenthesis syntax (@pxref{Blinking}). |
| 502 | 504 | ||
| 505 | @vindex post-self-insert-hook | ||
| 506 | The final thing this command does is to run the hook | ||
| 507 | @code{post-self-insert-hook}. You could use this to automatically | ||
| 508 | reindent text as it is typed, for example. | ||
| 509 | |||
| 503 | Do not try substituting your own definition of | 510 | Do not try substituting your own definition of |
| 504 | @code{self-insert-command} for the standard one. The editor command | 511 | @code{self-insert-command} for the standard one. The editor command |
| 505 | loop handles this function specially. | 512 | loop handles this function specially. |
diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index 9e0c439e57e..bdb16cd10a8 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi | |||
| @@ -9,16 +9,13 @@ | |||
| 9 | 9 | ||
| 10 | A @dfn{variable} is a name used in a program to stand for a value. | 10 | A @dfn{variable} is a name used in a program to stand for a value. |
| 11 | In Lisp, each variable is represented by a Lisp symbol | 11 | In Lisp, each variable is represented by a Lisp symbol |
| 12 | (@pxref{Symbols}). The symbol's name serves as the variable name, and | 12 | (@pxref{Symbols}). The variable name is simply the symbol's name, and |
| 13 | the symbol's value cell holds the variable's value@footnote{Strictly | 13 | the variable's value is stored in the symbol's value cell@footnote{To |
| 14 | speaking, the symbol's value cell always holds the variable's current | 14 | be precise, under the default @dfn{dynamic binding} rules the value |
| 15 | value under the default @dfn{dynamic binding} rules. Under | 15 | cell always holds the variable's current value, but this is not the |
| 16 | @dfn{lexical binding} rules, the value cell holds the variable's | 16 | case under @dfn{lexical binding} rules. @xref{Variable Scoping}, for |
| 17 | @dfn{global value}. @xref{Variable Scoping}, for details.}. | 17 | details.}. @xref{Symbol Components}. In Emacs Lisp, the use of a |
| 18 | @xref{Symbol Components}. | 18 | symbol as a variable is independent of its use as a function name. |
| 19 | |||
| 20 | In Emacs Lisp, the use of a symbol as a variable is independent of | ||
| 21 | its use as a function name. | ||
| 22 | 19 | ||
| 23 | As previously noted in this manual, a Lisp program is represented | 20 | As previously noted in this manual, a Lisp program is represented |
| 24 | primarily by Lisp objects, and only secondarily as text. The textual | 21 | primarily by Lisp objects, and only secondarily as text. The textual |
| @@ -151,8 +148,8 @@ does not raise an error if you actually change it. | |||
| 151 | with new values. Sometimes it is useful to give a variable a | 148 | with new values. Sometimes it is useful to give a variable a |
| 152 | @dfn{local value}---a value that takes effect only within a certain | 149 | @dfn{local value}---a value that takes effect only within a certain |
| 153 | part of a Lisp program. When a variable has a local value, we say | 150 | part of a Lisp program. When a variable has a local value, we say |
| 154 | that it has a @dfn{local binding}, or that it is a @dfn{local | 151 | that it is @dfn{locally bound} to that value, and that it is a |
| 155 | variable}. | 152 | @dfn{local variable}. |
| 156 | 153 | ||
| 157 | For example, when a function is called, its argument variables | 154 | For example, when a function is called, its argument variables |
| 158 | receive local values, which are the actual arguments supplied to the | 155 | receive local values, which are the actual arguments supplied to the |
| @@ -186,10 +183,10 @@ local binding. To be more precise, a rule called the @dfn{scoping | |||
| 186 | rule} determines where in a program a local binding takes effect. The | 183 | rule} determines where in a program a local binding takes effect. The |
| 187 | default scoping rule in Emacs Lisp is called @dfn{dynamic scoping}, | 184 | default scoping rule in Emacs Lisp is called @dfn{dynamic scoping}, |
| 188 | which simply states that the current binding at any given point in the | 185 | which simply states that the current binding at any given point in the |
| 189 | execution of a program is the most recently-created local binding for | 186 | execution of a program is the most recently-created binding for that |
| 190 | that variable that still exists. For details about dynamic scoping, | 187 | variable that still exists. For details about dynamic scoping, and an |
| 191 | and an alternative scoping rule called @dfn{lexical scoping}, | 188 | alternative scoping rule called @dfn{lexical scoping}, @xref{Variable |
| 192 | @xref{Variable Scoping}. | 189 | Scoping}. |
| 193 | 190 | ||
| 194 | The special forms @code{let} and @code{let*} exist to create local | 191 | The special forms @code{let} and @code{let*} exist to create local |
| 195 | bindings: | 192 | bindings: |
| @@ -294,27 +291,27 @@ has room to execute. | |||
| 294 | @cindex @code{void-variable} error | 291 | @cindex @code{void-variable} error |
| 295 | @cindex void variable | 292 | @cindex void variable |
| 296 | 293 | ||
| 297 | If you have never given a symbol any value as a global variable, we | 294 | We say that a variable is void if its symbol has an unassigned value |
| 298 | say that that symbol's global value is @dfn{void}. Note that this | 295 | cell (@pxref{Symbol Components}). Under Emacs Lisp's default dynamic |
| 299 | does @emph{not} mean the value is @code{nil}. The symbol @code{nil} | 296 | binding rules (@pxref{Variable Scoping}), the value cell stores the |
| 300 | is a Lisp object and can be the value of a variable, just as any other | 297 | variable's current (local or global) value. Note that an unassigned |
| 301 | object can be; but it is still a value. | 298 | value cell is @emph{not} the same as having @code{nil} in the value |
| 302 | 299 | cell. The symbol @code{nil} is a Lisp object and can be the value of | |
| 303 | More precisely, a variable is void if its symbol has an unassigned | 300 | a variable, just as any other object can be; but it is still a value. |
| 304 | value cell (@pxref{Symbol Components}). Under Emacs Lisp's default | 301 | If a variable is void, trying to evaluate the variable signals a |
| 305 | dynamic binding rules, the value cell stores the variable's current | 302 | @code{void-variable} error rather than a value. |
| 306 | (local or global) value; if a variable is void, trying to evaluate the | 303 | |
| 307 | variable signals a @code{void-variable} error rather than a value. | 304 | Under lexical binding rules, the value cell only holds the |
| 308 | But when a variable is lexically bound, it can have a local value | 305 | variable's global value, i.e.@: the value outside of any lexical |
| 309 | which is determined by the lexical environment, even if the value cell | 306 | binding contruct. When a variable is lexically bound, the local value |
| 310 | is empty and the variable is technically void. @xref{Variable | 307 | is determined by the lexical environment; the variable may have a |
| 311 | Scoping}. | 308 | local value if its symbol's value cell is unassigned. |
| 312 | 309 | ||
| 313 | @defun makunbound symbol | 310 | @defun makunbound symbol |
| 314 | This function empties out the value cell of @var{symbol}, making the | 311 | This function empties out the value cell of @var{symbol}, making the |
| 315 | variable void. It returns @var{symbol}. | 312 | variable void. It returns @var{symbol}. |
| 316 | 313 | ||
| 317 | If @var{symbol} has a (dynamic) local binding, @code{makunbound} voids | 314 | If @var{symbol} has a dynamic local binding, @code{makunbound} voids |
| 318 | the current binding, and this voidness lasts only as long as the local | 315 | the current binding, and this voidness lasts only as long as the local |
| 319 | binding is in effect. Afterwards, the previously shadowed local or | 316 | binding is in effect. Afterwards, the previously shadowed local or |
| 320 | global binding is reexposed; then the variable will no longer be void, | 317 | global binding is reexposed; then the variable will no longer be void, |
| @@ -615,15 +612,15 @@ name in the text of the program. You can use the @code{symbol-value} | |||
| 615 | function to extract the value. | 612 | function to extract the value. |
| 616 | 613 | ||
| 617 | @defun symbol-value symbol | 614 | @defun symbol-value symbol |
| 618 | This function returns the value of @var{symbol}. This is the value in | 615 | This function returns the value stored in @var{symbol}'s value cell. |
| 619 | the symbol's value cell, which is where the variable's current | 616 | This is where the variable's current (dynamic) value is stored. If |
| 620 | (dynamic) value is stored. If the variable has no local binding, this | 617 | the variable has no local binding, this is simply its global value. |
| 621 | is simply its global value. | 618 | If the variable is void, a @code{void-variable} error is signaled. |
| 622 | 619 | ||
| 623 | If the variable is lexically bound, the value reported by | 620 | If the variable is lexically bound, the value reported by |
| 624 | @code{symbol-value} is the dynamic value, and not the local lexical | 621 | @code{symbol-value} is not necessarily the same as the variable's |
| 625 | value (which is determined by the lexical environment rather than the | 622 | lexical value, which is determined by the lexical environment rather |
| 626 | symbol's value cell). @xref{Variable Scoping}. | 623 | than the symbol's value cell. @xref{Variable Scoping}. |
| 627 | 624 | ||
| 628 | @example | 625 | @example |
| 629 | @group | 626 | @group |
| @@ -657,9 +654,6 @@ symbol's value cell). @xref{Variable Scoping}. | |||
| 657 | @result{} 5 | 654 | @result{} 5 |
| 658 | @end group | 655 | @end group |
| 659 | @end example | 656 | @end example |
| 660 | |||
| 661 | A @code{void-variable} error is signaled if @var{symbol} is void as a | ||
| 662 | variable. | ||
| 663 | @end defun | 657 | @end defun |
| 664 | 658 | ||
| 665 | @node Setting Variables | 659 | @node Setting Variables |
| @@ -945,13 +939,13 @@ construct. | |||
| 945 | 939 | ||
| 946 | @example | 940 | @example |
| 947 | @group | 941 | @group |
| 948 | (defun getx () | ||
| 949 | x) ; @r{@code{x} is used ``free'' in this function.} | ||
| 950 | |||
| 951 | (let ((x 1)) ; @r{@code{x} is lexically bound.} | 942 | (let ((x 1)) ; @r{@code{x} is lexically bound.} |
| 952 | (+ x 3)) | 943 | (+ x 3)) |
| 953 | @result{} 4 | 944 | @result{} 4 |
| 954 | 945 | ||
| 946 | (defun getx () | ||
| 947 | x) ; @r{@code{x} is used ``free'' in this function.} | ||
| 948 | |||
| 955 | (let ((x 1)) ; @r{@code{x} is lexically bound.} | 949 | (let ((x 1)) ; @r{@code{x} is lexically bound.} |
| 956 | (getx)) | 950 | (getx)) |
| 957 | @error{} Symbol's value as variable is void: x | 951 | @error{} Symbol's value as variable is void: x |
| @@ -972,20 +966,18 @@ itself. | |||
| 972 | within the construct and their local values. When the Lisp evaluator | 966 | within the construct and their local values. When the Lisp evaluator |
| 973 | wants the current value of a variable, it looks first in the lexical | 967 | wants the current value of a variable, it looks first in the lexical |
| 974 | environment; if the variable is not specified in there, it looks in | 968 | environment; if the variable is not specified in there, it looks in |
| 975 | the symbol's value cell, where the dynamical value is stored. | 969 | the symbol's value cell, where the dynamic value is stored. |
| 976 | 970 | ||
| 977 | @cindex closures | 971 | @cindex closures |
| 978 | Lexical bindings have indefinite extent. Even after a binding | 972 | Lexical bindings have indefinite extent. Even after a binding |
| 979 | construct has finished executing, its lexical environment can be | 973 | construct has finished executing, its lexical environment can be |
| 980 | ``kept around'' in Lisp objects called @dfn{closures}. A closure is | 974 | ``kept around'' in Lisp objects called @dfn{closures}. A closure is |
| 981 | created whenever you evaluate a lambda expression (@pxref{Lambda | 975 | created when you create a named or anonymous function with lexical |
| 982 | Expressions}) with lexical binding enabled. It is represented by a | 976 | binding enabled. @xref{Closures}, for details. |
| 983 | list whose @sc{car} is the symbol @code{closure}. It is a function, | ||
| 984 | in the sense that it can be passed as an argument to @code{funcall}; | ||
| 985 | when called as a function, any lexical variable references within its | ||
| 986 | definition will use the retained lexical environment. | ||
| 987 | 977 | ||
| 988 | Here is an example which illustrates the use of a closure: | 978 | When a closure is called as a function, any lexical variable |
| 979 | references within its definition use the retained lexical environment. | ||
| 980 | Here is an example: | ||
| 989 | 981 | ||
| 990 | @example | 982 | @example |
| 991 | (defvar my-ticker nil) ; @r{We will use this dynamically bound} | 983 | (defvar my-ticker nil) ; @r{We will use this dynamically bound} |
| @@ -1199,7 +1191,8 @@ foo @result{} 'a | |||
| 1199 | @end group | 1191 | @end group |
| 1200 | @end example | 1192 | @end example |
| 1201 | 1193 | ||
| 1202 | Note that references to @code{foo} in @var{body} access the | 1194 | @noindent |
| 1195 | Note that references to @code{foo} in @var{body} access the | ||
| 1203 | buffer-local binding of buffer @samp{b}. | 1196 | buffer-local binding of buffer @samp{b}. |
| 1204 | 1197 | ||
| 1205 | When a file specifies local variable values, these become buffer-local | 1198 | When a file specifies local variable values, these become buffer-local |
| @@ -1642,6 +1635,11 @@ For boolean-valued variables that are safe, use @code{booleanp} as the | |||
| 1642 | property value. Lambda expressions should be quoted so that | 1635 | property value. Lambda expressions should be quoted so that |
| 1643 | @code{describe-variable} can display the predicate. | 1636 | @code{describe-variable} can display the predicate. |
| 1644 | 1637 | ||
| 1638 | When defining a user option using @code{defcustom}, you can set its | ||
| 1639 | @code{safe-local-variable} property by adding the arguments | ||
| 1640 | @code{:safe @var{function}} to @code{defcustom} (@pxref{Variable | ||
| 1641 | Definitions}). | ||
| 1642 | |||
| 1645 | @defopt safe-local-variable-values | 1643 | @defopt safe-local-variable-values |
| 1646 | This variable provides another way to mark some variable values as | 1644 | This variable provides another way to mark some variable values as |
| 1647 | safe. It is a list of cons cells @code{(@var{var} . @var{val})}, | 1645 | safe. It is a list of cons cells @code{(@var{var} . @var{val})}, |
| @@ -1661,28 +1659,31 @@ the value @var{val}, based on the above criteria. | |||
| 1661 | @end defun | 1659 | @end defun |
| 1662 | 1660 | ||
| 1663 | @c @cindex risky local variable Duplicates risky-local-variable | 1661 | @c @cindex risky local variable Duplicates risky-local-variable |
| 1664 | Some variables are considered @dfn{risky}. A variable whose name | 1662 | Some variables are considered @dfn{risky}. If a variable is risky, |
| 1665 | ends in any of @samp{-command}, @samp{-frame-alist}, @samp{-function}, | 1663 | it is never entered automatically into |
| 1664 | @code{safe-local-variable-values}; Emacs always queries before setting | ||
| 1665 | a risky variable, unless the user explicitly allows a value by | ||
| 1666 | customizing @code{safe-local-variable-values} directly. | ||
| 1667 | |||
| 1668 | Any variable whose name has a non-@code{nil} | ||
| 1669 | @code{risky-local-variable} property is considered risky. When you | ||
| 1670 | define a user option using @code{defcustom}, you can set its | ||
| 1671 | @code{risky-local-variable} property by adding the arguments | ||
| 1672 | @code{:risky @var{value}} to @code{defcustom} (@pxref{Variable | ||
| 1673 | Definitions}). In addition, any variable whose name ends in any of | ||
| 1674 | @samp{-command}, @samp{-frame-alist}, @samp{-function}, | ||
| 1666 | @samp{-functions}, @samp{-hook}, @samp{-hooks}, @samp{-form}, | 1675 | @samp{-functions}, @samp{-hook}, @samp{-hooks}, @samp{-form}, |
| 1667 | @samp{-forms}, @samp{-map}, @samp{-map-alist}, @samp{-mode-alist}, | 1676 | @samp{-forms}, @samp{-map}, @samp{-map-alist}, @samp{-mode-alist}, |
| 1668 | @samp{-program}, or @samp{-predicate} is considered risky. The | 1677 | @samp{-program}, or @samp{-predicate} is automatically considered |
| 1669 | variables @samp{font-lock-keywords}, @samp{font-lock-keywords} | 1678 | risky. The variables @samp{font-lock-keywords}, |
| 1670 | followed by a digit, and @samp{font-lock-syntactic-keywords} are also | 1679 | @samp{font-lock-keywords} followed by a digit, and |
| 1671 | considered risky. Finally, any variable whose name has a | 1680 | @samp{font-lock-syntactic-keywords} are also considered risky. |
| 1672 | non-@code{nil} @code{risky-local-variable} property is considered | ||
| 1673 | risky. | ||
| 1674 | 1681 | ||
| 1675 | @defun risky-local-variable-p sym | 1682 | @defun risky-local-variable-p sym |
| 1676 | This function returns non-@code{nil} if @var{sym} is a risky variable, | 1683 | This function returns non-@code{nil} if @var{sym} is a risky variable, |
| 1677 | based on the above criteria. | 1684 | based on the above criteria. |
| 1678 | @end defun | 1685 | @end defun |
| 1679 | 1686 | ||
| 1680 | If a variable is risky, it will not be entered automatically into | ||
| 1681 | @code{safe-local-variable-values} as described above. Therefore, | ||
| 1682 | Emacs will always query before setting a risky variable, unless the | ||
| 1683 | user explicitly allows the setting by customizing | ||
| 1684 | @code{safe-local-variable-values} directly. | ||
| 1685 | |||
| 1686 | @defvar ignored-local-variables | 1687 | @defvar ignored-local-variables |
| 1687 | This variable holds a list of variables that should not be given local | 1688 | This variable holds a list of variables that should not be given local |
| 1688 | values by files. Any value specified for one of these variables is | 1689 | values by files. Any value specified for one of these variables is |
diff --git a/doc/lispref/vol1.texi b/doc/lispref/vol1.texi index 95f9f7f4d29..0f4a4447ed3 100644 --- a/doc/lispref/vol1.texi +++ b/doc/lispref/vol1.texi | |||
| @@ -390,6 +390,7 @@ Evaluation | |||
| 390 | * Forms:: How various sorts of objects are evaluated. | 390 | * Forms:: How various sorts of objects are evaluated. |
| 391 | * Quoting:: Avoiding evaluation (to put constants in | 391 | * Quoting:: Avoiding evaluation (to put constants in |
| 392 | the program). | 392 | the program). |
| 393 | * Backquote:: Easier construction of list structure. | ||
| 393 | * Eval:: How to invoke the Lisp interpreter explicitly. | 394 | * Eval:: How to invoke the Lisp interpreter explicitly. |
| 394 | 395 | ||
| 395 | Kinds of Forms | 396 | Kinds of Forms |
| @@ -478,6 +479,7 @@ Functions | |||
| 478 | * Anonymous Functions:: Lambda expressions are functions with no names. | 479 | * Anonymous Functions:: Lambda expressions are functions with no names. |
| 479 | * Function Cells:: Accessing or setting the function definition | 480 | * Function Cells:: Accessing or setting the function definition |
| 480 | of a symbol. | 481 | of a symbol. |
| 482 | * Closures:: Functions that enclose a lexical environment. | ||
| 481 | * Obsolete Functions:: Declaring functions obsolete. | 483 | * Obsolete Functions:: Declaring functions obsolete. |
| 482 | * Inline Functions:: Defining functions that the compiler | 484 | * Inline Functions:: Defining functions that the compiler |
| 483 | will open code. | 485 | will open code. |
| @@ -500,7 +502,6 @@ Macros | |||
| 500 | * Expansion:: How, when and why macros are expanded. | 502 | * Expansion:: How, when and why macros are expanded. |
| 501 | * Compiling Macros:: How macros are expanded by the compiler. | 503 | * Compiling Macros:: How macros are expanded by the compiler. |
| 502 | * Defining Macros:: How to write a macro definition. | 504 | * Defining Macros:: How to write a macro definition. |
| 503 | * Backquote:: Easier construction of list structure. | ||
| 504 | * Problems with Macros:: Don't evaluate the macro arguments too many times. | 505 | * Problems with Macros:: Don't evaluate the macro arguments too many times. |
| 505 | Don't hide the user's variables. | 506 | Don't hide the user's variables. |
| 506 | * Indenting Macros:: Specifying how to indent macro calls. | 507 | * Indenting Macros:: Specifying how to indent macro calls. |
| @@ -1372,6 +1373,7 @@ Images | |||
| 1372 | * Defining Images:: Convenient ways to define an image for later use. | 1373 | * Defining Images:: Convenient ways to define an image for later use. |
| 1373 | * Showing Images:: Convenient ways to display an image once | 1374 | * Showing Images:: Convenient ways to display an image once |
| 1374 | it is defined. | 1375 | it is defined. |
| 1376 | * Animated Images:: Some image formats can be animated. | ||
| 1375 | * Image Cache:: Internal mechanisms of image display. | 1377 | * Image Cache:: Internal mechanisms of image display. |
| 1376 | 1378 | ||
| 1377 | Buttons | 1379 | Buttons |
diff --git a/doc/lispref/vol2.texi b/doc/lispref/vol2.texi index 08ea022f6a7..241728fd1d2 100644 --- a/doc/lispref/vol2.texi +++ b/doc/lispref/vol2.texi | |||
| @@ -389,6 +389,7 @@ Evaluation | |||
| 389 | * Forms:: How various sorts of objects are evaluated. | 389 | * Forms:: How various sorts of objects are evaluated. |
| 390 | * Quoting:: Avoiding evaluation (to put constants in | 390 | * Quoting:: Avoiding evaluation (to put constants in |
| 391 | the program). | 391 | the program). |
| 392 | * Backquote:: Easier construction of list structure. | ||
| 392 | * Eval:: How to invoke the Lisp interpreter explicitly. | 393 | * Eval:: How to invoke the Lisp interpreter explicitly. |
| 393 | 394 | ||
| 394 | Kinds of Forms | 395 | Kinds of Forms |
| @@ -477,6 +478,7 @@ Functions | |||
| 477 | * Anonymous Functions:: Lambda expressions are functions with no names. | 478 | * Anonymous Functions:: Lambda expressions are functions with no names. |
| 478 | * Function Cells:: Accessing or setting the function definition | 479 | * Function Cells:: Accessing or setting the function definition |
| 479 | of a symbol. | 480 | of a symbol. |
| 481 | * Closures:: Functions that enclose a lexical environment. | ||
| 480 | * Obsolete Functions:: Declaring functions obsolete. | 482 | * Obsolete Functions:: Declaring functions obsolete. |
| 481 | * Inline Functions:: Defining functions that the compiler | 483 | * Inline Functions:: Defining functions that the compiler |
| 482 | will open code. | 484 | will open code. |
| @@ -499,7 +501,6 @@ Macros | |||
| 499 | * Expansion:: How, when and why macros are expanded. | 501 | * Expansion:: How, when and why macros are expanded. |
| 500 | * Compiling Macros:: How macros are expanded by the compiler. | 502 | * Compiling Macros:: How macros are expanded by the compiler. |
| 501 | * Defining Macros:: How to write a macro definition. | 503 | * Defining Macros:: How to write a macro definition. |
| 502 | * Backquote:: Easier construction of list structure. | ||
| 503 | * Problems with Macros:: Don't evaluate the macro arguments too many times. | 504 | * Problems with Macros:: Don't evaluate the macro arguments too many times. |
| 504 | Don't hide the user's variables. | 505 | Don't hide the user's variables. |
| 505 | * Indenting Macros:: Specifying how to indent macro calls. | 506 | * Indenting Macros:: Specifying how to indent macro calls. |
| @@ -1371,6 +1372,7 @@ Images | |||
| 1371 | * Defining Images:: Convenient ways to define an image for later use. | 1372 | * Defining Images:: Convenient ways to define an image for later use. |
| 1372 | * Showing Images:: Convenient ways to display an image once | 1373 | * Showing Images:: Convenient ways to display an image once |
| 1373 | it is defined. | 1374 | it is defined. |
| 1375 | * Animated Images:: Some image formats can be animated. | ||
| 1374 | * Image Cache:: Internal mechanisms of image display. | 1376 | * Image Cache:: Internal mechanisms of image display. |
| 1375 | 1377 | ||
| 1376 | Buttons | 1378 | Buttons |
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index d1a045a730a..6bb1e065d37 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-01-30 Philipp Haselwarter <philipp.haselwarter@gmx.de> (tiny change) | ||
| 2 | |||
| 3 | * gnus.texi (Agent Basics): Fix outdated description of | ||
| 4 | `gnus-agent-auto-agentize-methods'. | ||
| 5 | |||
| 1 | 2012-01-28 Andreas Schwab <schwab@linux-m68k.org> | 6 | 2012-01-28 Andreas Schwab <schwab@linux-m68k.org> |
| 2 | 7 | ||
| 3 | * cc-mode.texi: Always @defindex ss. | 8 | * cc-mode.texi: Always @defindex ss. |
diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index 7728041c83b..1883975b7f6 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi | |||
| @@ -18236,8 +18236,7 @@ Agent. Go to the server buffer (@kbd{^} in the group buffer) and press | |||
| 18236 | @kbd{J a} on the server (or servers) that you wish to have covered by the | 18236 | @kbd{J a} on the server (or servers) that you wish to have covered by the |
| 18237 | Agent (@pxref{Server Agent Commands}), or @kbd{J r} on automatically | 18237 | Agent (@pxref{Server Agent Commands}), or @kbd{J r} on automatically |
| 18238 | added servers you do not wish to have covered by the Agent. By default, | 18238 | added servers you do not wish to have covered by the Agent. By default, |
| 18239 | all @code{nntp} and @code{nnimap} servers in @code{gnus-select-method} and | 18239 | no servers are agentized. |
| 18240 | @code{gnus-secondary-select-methods} are agentized. | ||
| 18241 | 18240 | ||
| 18242 | @item | 18241 | @item |
| 18243 | Decide on download policy. It's fairly simple once you decide whether | 18242 | Decide on download policy. It's fairly simple once you decide whether |
| @@ -19263,7 +19262,7 @@ to agentize remote back ends. The auto-agentizing has the same effect | |||
| 19263 | as running @kbd{J a} on the servers (@pxref{Server Agent Commands}). | 19262 | as running @kbd{J a} on the servers (@pxref{Server Agent Commands}). |
| 19264 | If the file exist, you must manage the servers manually by adding or | 19263 | If the file exist, you must manage the servers manually by adding or |
| 19265 | removing them, this variable is only applicable the first time you | 19264 | removing them, this variable is only applicable the first time you |
| 19266 | start Gnus. The default is @samp{(nntp nnimap)}. | 19265 | start Gnus. The default is @samp{nil}. |
| 19267 | 19266 | ||
| 19268 | @end table | 19267 | @end table |
| 19269 | 19268 | ||