diff options
| author | Eli Zaretskii | 2012-11-13 16:17:18 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2012-11-13 16:17:18 +0200 |
| commit | 3c4ca7155293ffc2d04708007131bcbc882d8913 (patch) | |
| tree | 61787be8cd43b6fb3d5159852fbd186eea404de7 /doc/misc | |
| parent | 5ade42a5114255c43117065494b96d480c1e1588 (diff) | |
| parent | c708524567662c8911c5ab2695acc7bda0383705 (diff) | |
| download | emacs-3c4ca7155293ffc2d04708007131bcbc882d8913.tar.gz emacs-3c4ca7155293ffc2d04708007131bcbc882d8913.zip | |
Merge from trunk.
Diffstat (limited to 'doc/misc')
| -rw-r--r-- | doc/misc/ChangeLog | 65 | ||||
| -rw-r--r-- | doc/misc/cl.texi | 471 | ||||
| -rw-r--r-- | doc/misc/flymake.texi | 20 | ||||
| -rw-r--r-- | doc/misc/gnus.texi | 41 | ||||
| -rw-r--r-- | doc/misc/ses.texi | 123 | ||||
| -rw-r--r-- | doc/misc/texinfo.tex | 37 | ||||
| -rw-r--r-- | doc/misc/url.texi | 644 |
7 files changed, 846 insertions, 555 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index d719a02e32e..7322613e0db 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog | |||
| @@ -1,3 +1,68 @@ | |||
| 1 | 2012-11-13 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * flymake.texi (Customizable variables) | ||
| 4 | (Highlighting erroneous lines): Mention flymake-error-bitmap, | ||
| 5 | flymake-warning-bitmap, and flymake-fringe-indicator-position. | ||
| 6 | |||
| 7 | 2012-11-12 Vincent Belaïche <vincentb1@users.sourceforge.net> | ||
| 8 | |||
| 9 | * ses.texi: Doc for ses-rename-cell, ses-repair-cell-reference-all & ses-range. | ||
| 10 | In all file place SES into @acronym{...}. | ||
| 11 | (Advanced Features): Add key index and function index for | ||
| 12 | ses-set-header-row. Add description for function | ||
| 13 | ses-rename-cell. Add description for function | ||
| 14 | ses-repair-cell-reference-all. | ||
| 15 | (Ranges in formulas): Add description for ses-range flags. | ||
| 16 | |||
| 17 | 2012-11-12 Paul Eggert <eggert@cs.ucla.edu> | ||
| 18 | |||
| 19 | * texinfo.tex: Merge from gnulib. | ||
| 20 | |||
| 21 | 2012-11-10 Chong Yidong <cyd@gnu.org> | ||
| 22 | |||
| 23 | * url.texi (Introduction): Move url-configuration-directory to | ||
| 24 | Customization node. | ||
| 25 | (Parsed URIs): Split into its own node. | ||
| 26 | (URI Encoding): New node. | ||
| 27 | (Defining New URLs): Remove empty chapter. | ||
| 28 | (Retrieving URLs): Add an introduction. Doc fix for url-retrieve. | ||
| 29 | Improve docs for url-queue-*. | ||
| 30 | (Supported URL Types): Copyedits. Delete empty subnodes. | ||
| 31 | |||
| 32 | * url.texi (Introduction): Rename from Getting Started. Rewrite | ||
| 33 | the introduction. | ||
| 34 | (URI Parsing): Rewrite. Omit the obsolete attributes slot. | ||
| 35 | |||
| 36 | 2012-11-10 Glenn Morris <rgm@gnu.org> | ||
| 37 | |||
| 38 | * cl.texi (Obsolete Setf Customization): | ||
| 39 | Revert defsetf example to the more correct let rather than prog1. | ||
| 40 | Give define-modify-macro, defsetf, and define-setf-method | ||
| 41 | gv.el replacements. | ||
| 42 | |||
| 43 | * cl.texi (Overview): Mention EIEIO here, as well as the appendix. | ||
| 44 | (Setf Extensions): Remove obsolete reference. | ||
| 45 | (Obsolete Setf Customization): | ||
| 46 | Move note on lack of setf functions to lispref/variables.texi. | ||
| 47 | Undocument get-setf-method, since it no longer exists. | ||
| 48 | Mention simple defsetf replaced by gv-define-simple-setter. | ||
| 49 | |||
| 50 | 2012-11-03 Glenn Morris <rgm@gnu.org> | ||
| 51 | |||
| 52 | * cl.texi: Further general copyedits. | ||
| 53 | (List Functions): Remove copy-tree, standard elisp for some time. | ||
| 54 | (Efficiency Concerns): Comment out examples that no longer apply. | ||
| 55 | (Compiler Optimizations): Rename from "Optimizing Compiler"; reword. | ||
| 56 | (Creating Symbols, Random Numbers): De-emphasize internal | ||
| 57 | variables cl--gensym-counter and cl--random-state. (Bug#12788) | ||
| 58 | (Naming Conventions, Type Predicates, Macros) | ||
| 59 | (Predicates on Numbers): No longer mention cl-floatp-safe. | ||
| 60 | |||
| 61 | 2012-11-02 Katsumi Yamaoka <yamaoka@jpl.org> | ||
| 62 | |||
| 63 | * gnus.texi (Mail Source Specifiers): | ||
| 64 | Document :leave keyword used for pop mail source. | ||
| 65 | |||
| 1 | 2012-11-01 Glenn Morris <rgm@gnu.org> | 66 | 2012-11-01 Glenn Morris <rgm@gnu.org> |
| 2 | 67 | ||
| 3 | * cl.texi: General copyedits for style, line-breaks, etc. | 68 | * cl.texi: General copyedits for style, line-breaks, etc. |
diff --git a/doc/misc/cl.texi b/doc/misc/cl.texi index 4a728049ce8..a50be1027f3 100644 --- a/doc/misc/cl.texi +++ b/doc/misc/cl.texi | |||
| @@ -107,7 +107,8 @@ for various reasons: | |||
| 107 | @item | 107 | @item |
| 108 | Some features are too complex or bulky relative to their benefit | 108 | Some features are too complex or bulky relative to their benefit |
| 109 | to Emacs Lisp programmers. CLOS and Common Lisp streams are fine | 109 | to Emacs Lisp programmers. CLOS and Common Lisp streams are fine |
| 110 | examples of this group. | 110 | examples of this group. (The separate package EIEIO implements |
| 111 | a subset of CLOS functionality. @xref{Top, , Introduction, eieio, EIEIO}.) | ||
| 111 | 112 | ||
| 112 | @item | 113 | @item |
| 113 | Other features cannot be implemented without modification to the | 114 | Other features cannot be implemented without modification to the |
| @@ -229,7 +230,7 @@ by @code{cl--}. Here is a complete list of functions prefixed by | |||
| 229 | 230 | ||
| 230 | @example | 231 | @example |
| 231 | cl-callf cl-callf2 cl-defsubst | 232 | cl-callf cl-callf2 cl-defsubst |
| 232 | cl-floatp-safe cl-letf cl-letf* | 233 | cl-letf cl-letf* |
| 233 | @end example | 234 | @end example |
| 234 | 235 | ||
| 235 | @c This is not uninteresting I suppose, but is of zero practical relevance | 236 | @c This is not uninteresting I suppose, but is of zero practical relevance |
| @@ -239,13 +240,13 @@ they do not cause other components like @file{cl-extra} to be loaded. | |||
| 239 | 240 | ||
| 240 | @example | 241 | @example |
| 241 | cl-evenp cl-oddp cl-minusp | 242 | cl-evenp cl-oddp cl-minusp |
| 242 | cl-plusp cl-floatp-safe cl-endp | 243 | cl-plusp cl-endp cl-subst |
| 243 | cl-copy-list cl-list* cl-ldiff | 244 | cl-copy-list cl-list* cl-ldiff |
| 244 | cl-rest cl-decf [1] cl-incf [1] | 245 | cl-rest cl-decf [1] cl-incf [1] |
| 245 | cl-acons cl-adjoin [2] cl-pairlis | 246 | cl-acons cl-adjoin [2] cl-pairlis |
| 246 | cl-pushnew [1,2] cl-declaim cl-proclaim | 247 | cl-pushnew [1,2] cl-declaim cl-proclaim |
| 247 | cl-caaar@dots{}cl-cddddr cl-first@dots{}cl-tenth | 248 | cl-caaar@dots{}cl-cddddr cl-first@dots{}cl-tenth |
| 248 | cl-subst cl-mapcar [3] | 249 | cl-mapcar [3] |
| 249 | @end example | 250 | @end example |
| 250 | 251 | ||
| 251 | @noindent | 252 | @noindent |
| @@ -300,7 +301,8 @@ calls to it may be expanded into in-line code by the byte compiler. | |||
| 300 | This is analogous to the @code{defsubst} form; | 301 | This is analogous to the @code{defsubst} form; |
| 301 | @code{cl-defsubst} uses a different method (compiler macros) which | 302 | @code{cl-defsubst} uses a different method (compiler macros) which |
| 302 | works in all versions of Emacs, and also generates somewhat more | 303 | works in all versions of Emacs, and also generates somewhat more |
| 303 | @c Really? | 304 | @c For some examples, |
| 305 | @c see http://lists.gnu.org/archive/html/emacs-devel/2012-11/msg00009.html | ||
| 304 | efficient inline expansions. In particular, @code{cl-defsubst} | 306 | efficient inline expansions. In particular, @code{cl-defsubst} |
| 305 | arranges for the processing of keyword arguments, default values, | 307 | arranges for the processing of keyword arguments, default values, |
| 306 | etc., to be done at compile-time whenever possible. | 308 | etc., to be done at compile-time whenever possible. |
| @@ -702,11 +704,13 @@ The type symbol @code{real} is a synonym for @code{number}, and | |||
| 702 | The type symbols @code{character} and @code{string-char} match | 704 | The type symbols @code{character} and @code{string-char} match |
| 703 | integers in the range from 0 to 255. | 705 | integers in the range from 0 to 255. |
| 704 | 706 | ||
| 707 | @c No longer relevant, so covered by first item above (float -> floatp). | ||
| 708 | @ignore | ||
| 705 | @item | 709 | @item |
| 706 | The type symbol @code{float} uses the @code{cl-floatp-safe} predicate | 710 | The type symbol @code{float} uses the @code{cl-floatp-safe} predicate |
| 707 | defined by this package rather than @code{floatp}, so it will work | 711 | defined by this package rather than @code{floatp}, so it will work |
| 708 | @c FIXME are any such platforms still relevant? | ||
| 709 | correctly even in Emacs versions without floating-point support. | 712 | correctly even in Emacs versions without floating-point support. |
| 713 | @end ignore | ||
| 710 | 714 | ||
| 711 | @item | 715 | @item |
| 712 | The type list @code{(integer @var{low} @var{high})} represents all | 716 | The type list @code{(integer @var{low} @var{high})} represents all |
| @@ -833,7 +837,7 @@ constructs. | |||
| 833 | * Conditionals:: @code{cl-case}, @code{cl-typecase}. | 837 | * Conditionals:: @code{cl-case}, @code{cl-typecase}. |
| 834 | * Blocks and Exits:: @code{cl-block}, @code{cl-return}, @code{cl-return-from}. | 838 | * Blocks and Exits:: @code{cl-block}, @code{cl-return}, @code{cl-return-from}. |
| 835 | * Iteration:: @code{cl-do}, @code{cl-dotimes}, @code{cl-dolist}, @code{cl-do-symbols}. | 839 | * Iteration:: @code{cl-do}, @code{cl-dotimes}, @code{cl-dolist}, @code{cl-do-symbols}. |
| 836 | * Loop Facility:: The Common Lisp @code{cl-loop} macro. | 840 | * Loop Facility:: The Common Lisp @code{loop} macro. |
| 837 | * Multiple Values:: @code{cl-values}, @code{cl-multiple-value-bind}, etc. | 841 | * Multiple Values:: @code{cl-values}, @code{cl-multiple-value-bind}, etc. |
| 838 | @end menu | 842 | @end menu |
| 839 | 843 | ||
| @@ -971,7 +975,7 @@ a | |||
| 971 | The generalized variable @code{buffer-substring}, listed above, | 975 | The generalized variable @code{buffer-substring}, listed above, |
| 972 | also works in this way by replacing a portion of the current buffer. | 976 | also works in this way by replacing a portion of the current buffer. |
| 973 | 977 | ||
| 974 | @c FIXME? Also `eq'? (see cl-lib.el) | 978 | @c FIXME? Also `eq'? (see cl-lib.el) |
| 975 | 979 | ||
| 976 | @c Currently commented out in cl.el. | 980 | @c Currently commented out in cl.el. |
| 977 | @ignore | 981 | @ignore |
| @@ -986,13 +990,10 @@ only interesting when used with places you define yourself with | |||
| 986 | @xref{Obsolete Setf Customization}. | 990 | @xref{Obsolete Setf Customization}. |
| 987 | @end ignore | 991 | @end ignore |
| 988 | 992 | ||
| 993 | @c FIXME? Is this still true? | ||
| 989 | @item | 994 | @item |
| 990 | A macro call, in which case the macro is expanded and @code{setf} | 995 | A macro call, in which case the macro is expanded and @code{setf} |
| 991 | is applied to the resulting form. | 996 | is applied to the resulting form. |
| 992 | |||
| 993 | @item | ||
| 994 | Any form for which a @code{defsetf} or @code{define-setf-method} | ||
| 995 | has been made. @xref{Obsolete Setf Customization}. | ||
| 996 | @end itemize | 997 | @end itemize |
| 997 | 998 | ||
| 998 | @c FIXME should this be in lispref? It seems self-evident. | 999 | @c FIXME should this be in lispref? It seems self-evident. |
| @@ -1521,7 +1522,7 @@ Common Lisp @dfn{blocks} provide a non-local exit mechanism very | |||
| 1521 | similar to @code{catch} and @code{throw}, with lexical scoping. | 1522 | similar to @code{catch} and @code{throw}, with lexical scoping. |
| 1522 | This package actually implements @code{cl-block} | 1523 | This package actually implements @code{cl-block} |
| 1523 | in terms of @code{catch}; however, the lexical scoping allows the | 1524 | in terms of @code{catch}; however, the lexical scoping allows the |
| 1524 | optimizing byte-compiler to omit the costly @code{catch} step if the | 1525 | byte-compiler to omit the costly @code{catch} step if the |
| 1525 | body of the block does not actually @code{cl-return-from} the block. | 1526 | body of the block does not actually @code{cl-return-from} the block. |
| 1526 | 1527 | ||
| 1527 | @defmac cl-block name forms@dots{} | 1528 | @defmac cl-block name forms@dots{} |
| @@ -1558,7 +1559,7 @@ just as in Common Lisp. | |||
| 1558 | Because they are implemented in terms of Emacs Lisp's @code{catch} | 1559 | Because they are implemented in terms of Emacs Lisp's @code{catch} |
| 1559 | and @code{throw}, blocks have the same overhead as actual | 1560 | and @code{throw}, blocks have the same overhead as actual |
| 1560 | @code{catch} constructs (roughly two function calls). However, | 1561 | @code{catch} constructs (roughly two function calls). However, |
| 1561 | the optimizing byte compiler will optimize away the @code{catch} | 1562 | the byte compiler will optimize away the @code{catch} |
| 1562 | if the block does | 1563 | if the block does |
| 1563 | not in fact contain any @code{cl-return} or @code{cl-return-from} calls | 1564 | not in fact contain any @code{cl-return} or @code{cl-return-from} calls |
| 1564 | that jump to it. This means that @code{cl-do} loops and @code{cl-defun} | 1565 | that jump to it. This means that @code{cl-do} loops and @code{cl-defun} |
| @@ -1723,18 +1724,18 @@ iterating over vectors or lists. | |||
| 1723 | @section Loop Facility | 1724 | @section Loop Facility |
| 1724 | 1725 | ||
| 1725 | @noindent | 1726 | @noindent |
| 1726 | A common complaint with Lisp's traditional looping constructs is | 1727 | A common complaint with Lisp's traditional looping constructs was |
| 1727 | that they are either too simple and limited, such as Common Lisp's | 1728 | that they were either too simple and limited, such as @code{dotimes} |
| 1728 | @code{dotimes} or Emacs Lisp's @code{while}, or too unreadable and | 1729 | or @code{while}, or too unreadable and obscure, like Common Lisp's |
| 1729 | obscure, like Common Lisp's @code{do} loop. | 1730 | @code{do} loop. |
| 1730 | 1731 | ||
| 1731 | To remedy this, recent versions of Common Lisp have added a new | 1732 | To remedy this, Common Lisp added a construct called the ``Loop |
| 1732 | construct called the ``Loop Facility'' or ``@code{loop} macro'', | 1733 | Facility'' or ``@code{loop} macro'', with an easy-to-use but very |
| 1733 | with an easy-to-use but very powerful and expressive syntax. | 1734 | powerful and expressive syntax. |
| 1734 | 1735 | ||
| 1735 | @menu | 1736 | @menu |
| 1736 | * Loop Basics:: @code{cl-loop} macro, basic clause structure. | 1737 | * Loop Basics:: The @code{cl-loop} macro, basic clause structure. |
| 1737 | * Loop Examples:: Working examples of @code{cl-loop} macro. | 1738 | * Loop Examples:: Working examples of the @code{cl-loop} macro. |
| 1738 | * For Clauses:: Clauses introduced by @code{for} or @code{as}. | 1739 | * For Clauses:: Clauses introduced by @code{for} or @code{as}. |
| 1739 | * Iteration Clauses:: @code{repeat}, @code{while}, @code{thereis}, etc. | 1740 | * Iteration Clauses:: @code{repeat}, @code{while}, @code{thereis}, etc. |
| 1740 | * Accumulation Clauses:: @code{collect}, @code{sum}, @code{maximize}, etc. | 1741 | * Accumulation Clauses:: @code{collect}, @code{sum}, @code{maximize}, etc. |
| @@ -1767,9 +1768,9 @@ Common Lisp specifies a certain general order of clauses in a | |||
| 1767 | loop: | 1768 | loop: |
| 1768 | 1769 | ||
| 1769 | @example | 1770 | @example |
| 1770 | (cl-loop @var{name-clause} | 1771 | (loop @var{name-clause} |
| 1771 | @var{var-clauses}@dots{} | 1772 | @var{var-clauses}@dots{} |
| 1772 | @var{action-clauses}@dots{}) | 1773 | @var{action-clauses}@dots{}) |
| 1773 | @end example | 1774 | @end example |
| 1774 | 1775 | ||
| 1775 | The @var{name-clause} optionally gives a name to the implicit | 1776 | The @var{name-clause} optionally gives a name to the implicit |
| @@ -1795,10 +1796,10 @@ also use regular Lisp @code{cl-return} or @code{cl-return-from} to | |||
| 1795 | break out of the loop.) | 1796 | break out of the loop.) |
| 1796 | @end defmac | 1797 | @end defmac |
| 1797 | 1798 | ||
| 1798 | The following sections give some examples of the Loop Macro in | 1799 | The following sections give some examples of the loop macro in |
| 1799 | action, and describe the particular loop clauses in great detail. | 1800 | action, and describe the particular loop clauses in great detail. |
| 1800 | Consult the second edition of Steele for additional discussion | 1801 | Consult the second edition of Steele for additional discussion |
| 1801 | and examples of the @code{loop} macro. | 1802 | and examples. |
| 1802 | 1803 | ||
| 1803 | @node Loop Examples | 1804 | @node Loop Examples |
| 1804 | @subsection Loop Examples | 1805 | @subsection Loop Examples |
| @@ -2162,8 +2163,9 @@ that was just set by the previous clause; in the second loop, | |||
| 2162 | based on the value of @code{x} left over from the previous time | 2163 | based on the value of @code{x} left over from the previous time |
| 2163 | through the loop. | 2164 | through the loop. |
| 2164 | 2165 | ||
| 2165 | Another feature of the @code{cl-loop} macro is @dfn{destructuring}, | 2166 | Another feature of the @code{cl-loop} macro is @emph{destructuring}, |
| 2166 | similar in concept to the destructuring provided by @code{defmacro}. | 2167 | similar in concept to the destructuring provided by @code{defmacro} |
| 2168 | (@pxref{Argument Lists}). | ||
| 2167 | The @var{var} part of any @code{for} clause can be given as a list | 2169 | The @var{var} part of any @code{for} clause can be given as a list |
| 2168 | of variables instead of a single variable. The values produced | 2170 | of variables instead of a single variable. The values produced |
| 2169 | during loop execution must be lists; the values in the lists are | 2171 | during loop execution must be lists; the values in the lists are |
| @@ -2375,7 +2377,7 @@ by the name @code{it} in the ``then'' part. For example: | |||
| 2375 | (setq funny-numbers '(6 13 -1)) | 2377 | (setq funny-numbers '(6 13 -1)) |
| 2376 | @result{} (6 13 -1) | 2378 | @result{} (6 13 -1) |
| 2377 | (cl-loop for x below 10 | 2379 | (cl-loop for x below 10 |
| 2378 | if (oddp x) | 2380 | if (cl-oddp x) |
| 2379 | collect x into odds | 2381 | collect x into odds |
| 2380 | and if (memq x funny-numbers) return (cdr it) end | 2382 | and if (memq x funny-numbers) return (cdr it) end |
| 2381 | else | 2383 | else |
| @@ -2441,15 +2443,14 @@ loop. Many of the examples in this section illustrate the use of | |||
| 2441 | 2443 | ||
| 2442 | @item return @var{form} | 2444 | @item return @var{form} |
| 2443 | This clause causes the loop to return immediately. The following | 2445 | This clause causes the loop to return immediately. The following |
| 2444 | Lisp form is evaluated to give the return value of the @code{loop} | 2446 | Lisp form is evaluated to give the return value of the loop |
| 2445 | form. The @code{finally} clauses, if any, are not executed. | 2447 | form. The @code{finally} clauses, if any, are not executed. |
| 2446 | Of course, @code{return} is generally used inside an @code{if} or | 2448 | Of course, @code{return} is generally used inside an @code{if} or |
| 2447 | @code{unless}, as its use in a top-level loop clause would mean | 2449 | @code{unless}, as its use in a top-level loop clause would mean |
| 2448 | the loop would never get to ``loop'' more than once. | 2450 | the loop would never get to ``loop'' more than once. |
| 2449 | 2451 | ||
| 2450 | The clause @samp{return @var{form}} is equivalent to | 2452 | The clause @samp{return @var{form}} is equivalent to |
| 2451 | @c FIXME cl-do, cl-return? | 2453 | @samp{do (cl-return @var{form})} (or @code{cl-return-from} if the loop |
| 2452 | @samp{do (return @var{form})} (or @code{return-from} if the loop | ||
| 2453 | was named). The @code{return} clause is implemented a bit more | 2454 | was named). The @code{return} clause is implemented a bit more |
| 2454 | efficiently, though. | 2455 | efficiently, though. |
| 2455 | @end table | 2456 | @end table |
| @@ -2463,7 +2464,7 @@ clause, respectively. Consult the source code in file | |||
| 2463 | 2464 | ||
| 2464 | This package's @code{cl-loop} macro is compatible with that of Common | 2465 | This package's @code{cl-loop} macro is compatible with that of Common |
| 2465 | Lisp, except that a few features are not implemented: @code{loop-finish} | 2466 | Lisp, except that a few features are not implemented: @code{loop-finish} |
| 2466 | and data-type specifiers. Naturally, the @code{for} clauses which | 2467 | and data-type specifiers. Naturally, the @code{for} clauses that |
| 2467 | iterate over keymaps, overlays, intervals, frames, windows, and | 2468 | iterate over keymaps, overlays, intervals, frames, windows, and |
| 2468 | buffers are Emacs-specific extensions. | 2469 | buffers are Emacs-specific extensions. |
| 2469 | 2470 | ||
| @@ -2516,17 +2517,17 @@ Destructuring is made available to the user by way of the | |||
| 2516 | following macro: | 2517 | following macro: |
| 2517 | 2518 | ||
| 2518 | @defmac cl-destructuring-bind arglist expr forms@dots{} | 2519 | @defmac cl-destructuring-bind arglist expr forms@dots{} |
| 2519 | This macro expands to code which executes @var{forms}, with | 2520 | This macro expands to code that executes @var{forms}, with |
| 2520 | the variables in @var{arglist} bound to the list of values | 2521 | the variables in @var{arglist} bound to the list of values |
| 2521 | returned by @var{expr}. The @var{arglist} can include all | 2522 | returned by @var{expr}. The @var{arglist} can include all |
| 2522 | the features allowed for @code{defmacro} argument lists, | 2523 | the features allowed for @code{cl-defmacro} argument lists, |
| 2523 | including destructuring. (The @code{&environment} keyword | 2524 | including destructuring. (The @code{&environment} keyword |
| 2524 | is not allowed.) The macro expansion will signal an error | 2525 | is not allowed.) The macro expansion will signal an error |
| 2525 | if @var{expr} returns a list of the wrong number of arguments | 2526 | if @var{expr} returns a list of the wrong number of arguments |
| 2526 | or with incorrect keyword arguments. | 2527 | or with incorrect keyword arguments. |
| 2527 | @end defmac | 2528 | @end defmac |
| 2528 | 2529 | ||
| 2529 | This package also includes the Common Lisp @code{cl-define-compiler-macro} | 2530 | This package also includes the Common Lisp @code{define-compiler-macro} |
| 2530 | facility, which allows you to define compile-time expansions and | 2531 | facility, which allows you to define compile-time expansions and |
| 2531 | optimizations for your functions. | 2532 | optimizations for your functions. |
| 2532 | 2533 | ||
| @@ -2551,7 +2552,7 @@ appears as a standard part of this package: | |||
| 2551 | (cl-define-compiler-macro cl-member (&whole form a list &rest keys) | 2552 | (cl-define-compiler-macro cl-member (&whole form a list &rest keys) |
| 2552 | (if (and (null keys) | 2553 | (if (and (null keys) |
| 2553 | (eq (car-safe a) 'quote) | 2554 | (eq (car-safe a) 'quote) |
| 2554 | (not (floatp-safe (cadr a)))) | 2555 | (not (floatp (cadr a)))) |
| 2555 | (list 'memq a list) | 2556 | (list 'memq a list) |
| 2556 | form)) | 2557 | form)) |
| 2557 | @end example | 2558 | @end example |
| @@ -2589,16 +2590,19 @@ mechanism that allows you to give the compiler special hints | |||
| 2589 | about the types of data that will be stored in particular variables, | 2590 | about the types of data that will be stored in particular variables, |
| 2590 | and about the ways those variables and functions will be used. This | 2591 | and about the ways those variables and functions will be used. This |
| 2591 | package defines versions of all the Common Lisp declaration forms: | 2592 | package defines versions of all the Common Lisp declaration forms: |
| 2592 | @code{cl-declare}, @code{cl-locally}, @code{cl-proclaim}, @code{cl-declaim}, | 2593 | @code{declare}, @code{locally}, @code{proclaim}, @code{declaim}, |
| 2593 | and @code{cl-the}. | 2594 | and @code{the}. |
| 2594 | 2595 | ||
| 2595 | Most of the Common Lisp declarations are not currently useful in | 2596 | Most of the Common Lisp declarations are not currently useful in Emacs |
| 2596 | Emacs Lisp, as the byte-code system provides little opportunity | 2597 | Lisp. For example, the byte-code system provides little |
| 2597 | to benefit from type information, and @code{special} declarations | 2598 | opportunity to benefit from type information. |
| 2598 | are redundant in a fully dynamically-scoped Lisp. A few | 2599 | @ignore |
| 2599 | declarations are meaningful when the optimizing byte | 2600 | and @code{special} declarations are redundant in a fully |
| 2600 | compiler is being used, however. Under the earlier non-optimizing | 2601 | dynamically-scoped Lisp. |
| 2601 | compiler, these declarations will effectively be ignored. | 2602 | @end ignore |
| 2603 | A few declarations are meaningful when byte compiler optimizations | ||
| 2604 | are enabled, as they are by the default. Otherwise these | ||
| 2605 | declarations will effectively be ignored. | ||
| 2602 | 2606 | ||
| 2603 | @defun cl-proclaim decl-spec | 2607 | @defun cl-proclaim decl-spec |
| 2604 | This function records a ``global'' declaration specified by | 2608 | This function records a ``global'' declaration specified by |
| @@ -2609,7 +2613,7 @@ is evaluated and thus should normally be quoted. | |||
| 2609 | @defmac cl-declaim decl-specs@dots{} | 2613 | @defmac cl-declaim decl-specs@dots{} |
| 2610 | This macro is like @code{cl-proclaim}, except that it takes any number | 2614 | This macro is like @code{cl-proclaim}, except that it takes any number |
| 2611 | of @var{decl-spec} arguments, and the arguments are unevaluated and | 2615 | of @var{decl-spec} arguments, and the arguments are unevaluated and |
| 2612 | unquoted. The @code{cl-declaim} macro also puts an @code{(cl-eval-when | 2616 | unquoted. The @code{cl-declaim} macro also puts @code{(cl-eval-when |
| 2613 | (compile load eval) @dots{})} around the declarations so that they will | 2617 | (compile load eval) @dots{})} around the declarations so that they will |
| 2614 | be registered at compile-time as well as at run-time. (This is vital, | 2618 | be registered at compile-time as well as at run-time. (This is vital, |
| 2615 | since normally the declarations are meant to influence the way the | 2619 | since normally the declarations are meant to influence the way the |
| @@ -2632,9 +2636,9 @@ In this package, @code{cl-locally} is no different from @code{progn}. | |||
| 2632 | 2636 | ||
| 2633 | @defmac cl-the type form | 2637 | @defmac cl-the type form |
| 2634 | Type information provided by @code{cl-the} is ignored in this package; | 2638 | Type information provided by @code{cl-the} is ignored in this package; |
| 2635 | in other words, @code{(cl-the @var{type} @var{form})} is equivalent | 2639 | in other words, @code{(cl-the @var{type} @var{form})} is equivalent to |
| 2636 | to @var{form}. Future versions of the optimizing byte-compiler may | 2640 | @var{form}. Future byte-compiler optimizations may make use of this |
| 2637 | make use of this information. | 2641 | information. |
| 2638 | 2642 | ||
| 2639 | For example, @code{mapcar} can map over both lists and arrays. It is | 2643 | For example, @code{mapcar} can map over both lists and arrays. It is |
| 2640 | hard for the compiler to expand @code{mapcar} into an in-line loop | 2644 | hard for the compiler to expand @code{mapcar} into an in-line loop |
| @@ -2655,35 +2659,31 @@ such as @code{type} and @code{ftype}, are silently ignored. | |||
| 2655 | 2659 | ||
| 2656 | @table @code | 2660 | @table @code |
| 2657 | @item special | 2661 | @item special |
| 2662 | @c FIXME ? | ||
| 2658 | Since all variables in Emacs Lisp are ``special'' (in the Common | 2663 | Since all variables in Emacs Lisp are ``special'' (in the Common |
| 2659 | Lisp sense), @code{special} declarations are only advisory. They | 2664 | Lisp sense), @code{special} declarations are only advisory. They |
| 2660 | simply tell the optimizing byte compiler that the specified | 2665 | simply tell the byte compiler that the specified |
| 2661 | variables are intentionally being referred to without being | 2666 | variables are intentionally being referred to without being |
| 2662 | bound in the body of the function. The compiler normally emits | 2667 | bound in the body of the function. The compiler normally emits |
| 2663 | warnings for such references, since they could be typographical | 2668 | warnings for such references, since they could be typographical |
| 2664 | errors for references to local variables. | 2669 | errors for references to local variables. |
| 2665 | 2670 | ||
| 2666 | The declaration @code{(cl-declare (special @var{var1} @var{var2}))} is | 2671 | The declaration @code{(cl-declare (special @var{var1} @var{var2}))} is |
| 2667 | equivalent to @code{(defvar @var{var1}) (defvar @var{var2})} in the | 2672 | equivalent to @code{(defvar @var{var1}) (defvar @var{var2})}. |
| 2668 | optimizing compiler, or to nothing at all in older compilers (which | ||
| 2669 | do not warn for non-local references). | ||
| 2670 | 2673 | ||
| 2671 | In top-level contexts, it is generally better to write | 2674 | In top-level contexts, it is generally better to write |
| 2672 | @code{(defvar @var{var})} than @code{(cl-declaim (special @var{var}))}, | 2675 | @code{(defvar @var{var})} than @code{(cl-declaim (special @var{var}))}, |
| 2673 | since @code{defvar} makes your intentions clearer. But the older | 2676 | since @code{defvar} makes your intentions clearer. |
| 2674 | byte compilers can not handle @code{defvar}s appearing inside of | ||
| 2675 | functions, while @code{(cl-declare (special @var{var}))} takes care | ||
| 2676 | to work correctly with all compilers. | ||
| 2677 | 2677 | ||
| 2678 | @item inline | 2678 | @item inline |
| 2679 | The @code{inline} @var{decl-spec} lists one or more functions | 2679 | The @code{inline} @var{decl-spec} lists one or more functions |
| 2680 | whose bodies should be expanded ``in-line'' into calling functions | 2680 | whose bodies should be expanded ``in-line'' into calling functions |
| 2681 | whenever the compiler is able to arrange for it. For example, | 2681 | whenever the compiler is able to arrange for it. For example, |
| 2682 | the Common Lisp function @code{cadr} is declared @code{inline} | 2682 | the function @code{cl-acons} is declared @code{inline} |
| 2683 | by this package so that the form @code{(cadr @var{x})} will | 2683 | by this package so that the form @code{(cl-acons @var{key} @var{value} |
| 2684 | expand directly into @code{(car (cdr @var{x}))} when it is called | 2684 | @var{alist})} will |
| 2685 | in user functions, for a savings of one (relatively expensive) | 2685 | expand directly into @code{(cons (cons @var{key} @var{value}) @var{alist})} |
| 2686 | function call. | 2686 | when it is called in user functions, so as to save function calls. |
| 2687 | 2687 | ||
| 2688 | The following declarations are all equivalent. Note that the | 2688 | The following declarations are all equivalent. Note that the |
| 2689 | @code{defsubst} form is a convenient way to define a function | 2689 | @code{defsubst} form is a convenient way to define a function |
| @@ -2702,7 +2702,7 @@ request that a function you have defined should be inlined, | |||
| 2702 | but it is impolite to use it to request inlining of an external | 2702 | but it is impolite to use it to request inlining of an external |
| 2703 | function. | 2703 | function. |
| 2704 | 2704 | ||
| 2705 | In Common Lisp, it is possible to use @code{(cl-declare (inline @dots{}))} | 2705 | In Common Lisp, it is possible to use @code{(declare (inline @dots{}))} |
| 2706 | before a particular call to a function to cause just that call to | 2706 | before a particular call to a function to cause just that call to |
| 2707 | be inlined; the current byte compilers provide no way to implement | 2707 | be inlined; the current byte compilers provide no way to implement |
| 2708 | this, so @code{(cl-declare (inline @dots{}))} is currently ignored by | 2708 | this, so @code{(cl-declare (inline @dots{}))} is currently ignored by |
| @@ -2715,8 +2715,7 @@ declaration. | |||
| 2715 | 2715 | ||
| 2716 | @item optimize | 2716 | @item optimize |
| 2717 | This declaration controls how much optimization is performed by | 2717 | This declaration controls how much optimization is performed by |
| 2718 | the compiler. Naturally, it is ignored by the earlier non-optimizing | 2718 | the compiler. |
| 2719 | compilers. | ||
| 2720 | 2719 | ||
| 2721 | The word @code{optimize} is followed by any number of lists like | 2720 | The word @code{optimize} is followed by any number of lists like |
| 2722 | @code{(speed 3)} or @code{(safety 2)}. Common Lisp defines several | 2721 | @code{(speed 3)} or @code{(safety 2)}. Common Lisp defines several |
| @@ -2725,8 +2724,7 @@ and @code{safety}. The value of a quality should be an integer from | |||
| 2725 | 0 to 3, with 0 meaning ``unimportant'' and 3 meaning ``very important''. | 2724 | 0 to 3, with 0 meaning ``unimportant'' and 3 meaning ``very important''. |
| 2726 | The default level for both qualities is 1. | 2725 | The default level for both qualities is 1. |
| 2727 | 2726 | ||
| 2728 | In this package, with the optimizing compiler, the | 2727 | In this package, the @code{speed} quality is tied to the @code{byte-optimize} |
| 2729 | @code{speed} quality is tied to the @code{byte-optimize} | ||
| 2730 | flag, which is set to @code{nil} for @code{(speed 0)} and to | 2728 | flag, which is set to @code{nil} for @code{(speed 0)} and to |
| 2731 | @code{t} for higher settings; and the @code{safety} quality is | 2729 | @code{t} for higher settings; and the @code{safety} quality is |
| 2732 | tied to the @code{byte-compile-delete-errors} flag, which is | 2730 | tied to the @code{byte-compile-delete-errors} flag, which is |
| @@ -2745,22 +2743,22 @@ just because of an error in a fully-optimized Lisp program. | |||
| 2745 | 2743 | ||
| 2746 | The @code{optimize} declaration is normally used in a top-level | 2744 | The @code{optimize} declaration is normally used in a top-level |
| 2747 | @code{cl-proclaim} or @code{cl-declaim} in a file; Common Lisp allows | 2745 | @code{cl-proclaim} or @code{cl-declaim} in a file; Common Lisp allows |
| 2748 | it to be used with @code{cl-declare} to set the level of optimization | 2746 | it to be used with @code{declare} to set the level of optimization |
| 2749 | locally for a given form, but this will not work correctly with the | 2747 | locally for a given form, but this will not work correctly with the |
| 2750 | current version of the optimizing compiler. (The @code{cl-declare} | 2748 | current byte-compiler. (The @code{cl-declare} |
| 2751 | will set the new optimization level, but that level will not | 2749 | will set the new optimization level, but that level will not |
| 2752 | automatically be unset after the enclosing form is done.) | 2750 | automatically be unset after the enclosing form is done.) |
| 2753 | 2751 | ||
| 2754 | @item warn | 2752 | @item warn |
| 2755 | This declaration controls what sorts of warnings are generated | 2753 | This declaration controls what sorts of warnings are generated |
| 2756 | by the byte compiler. Again, only the optimizing compiler | 2754 | by the byte compiler. The word @code{warn} is followed by any |
| 2757 | generates warnings. The word @code{warn} is followed by any | ||
| 2758 | number of ``warning qualities'', similar in form to optimization | 2755 | number of ``warning qualities'', similar in form to optimization |
| 2759 | qualities. The currently supported warning types are | 2756 | qualities. The currently supported warning types are |
| 2760 | @code{redefine}, @code{callargs}, @code{unresolved}, and | 2757 | @code{redefine}, @code{callargs}, @code{unresolved}, and |
| 2761 | @code{free-vars}; in the current system, a value of 0 will | 2758 | @code{free-vars}; in the current system, a value of 0 will |
| 2762 | disable these warnings and any higher value will enable them. | 2759 | disable these warnings and any higher value will enable them. |
| 2763 | See the documentation for the optimizing byte compiler for details. | 2760 | See the documentation of the variable @code{byte-compile-warnings} |
| 2761 | for more details. | ||
| 2764 | @end table | 2762 | @end table |
| 2765 | 2763 | ||
| 2766 | @node Symbols | 2764 | @node Symbols |
| @@ -2873,19 +2871,17 @@ string is used as a prefix instead of @samp{G}. Uninterned symbols | |||
| 2873 | are used in macro expansions for temporary variables, to ensure that | 2871 | are used in macro expansions for temporary variables, to ensure that |
| 2874 | their names will not conflict with ``real'' variables in the user's | 2872 | their names will not conflict with ``real'' variables in the user's |
| 2875 | code. | 2873 | code. |
| 2876 | @end defun | ||
| 2877 | 2874 | ||
| 2878 | @defvar cl--gensym-counter | 2875 | (Internally, the variable @code{cl--gensym-counter} holds the counter |
| 2879 | This variable holds the counter used to generate @code{cl-gensym} names. | 2876 | used to generate names. It is incremented after each use. In Common |
| 2880 | It is incremented after each use by @code{cl-gensym}. In Common Lisp | 2877 | Lisp this is initialized with 0, but this package initializes it with |
| 2881 | this is initialized with 0, but this package initializes it with a | 2878 | a random time-dependent value to avoid trouble when two files that |
| 2882 | random (time-dependent) value to avoid trouble when two files that | ||
| 2883 | each used @code{cl-gensym} in their compilation are loaded together. | 2879 | each used @code{cl-gensym} in their compilation are loaded together. |
| 2884 | (Uninterned symbols become interned when the compiler writes them | 2880 | Uninterned symbols become interned when the compiler writes them out |
| 2885 | out to a file and the Emacs loader loads them, so their names have to | 2881 | to a file and the Emacs loader loads them, so their names have to be |
| 2886 | be treated a bit more carefully than in Common Lisp where uninterned | 2882 | treated a bit more carefully than in Common Lisp where uninterned |
| 2887 | symbols remain uninterned after loading.) | 2883 | symbols remain uninterned after loading.) |
| 2888 | @end defvar | 2884 | @end defun |
| 2889 | 2885 | ||
| 2890 | @defun cl-gentemp &optional x | 2886 | @defun cl-gentemp &optional x |
| 2891 | This function is like @code{cl-gensym}, except that it produces a new | 2887 | This function is like @code{cl-gensym}, except that it produces a new |
| @@ -2905,13 +2901,13 @@ provided. | |||
| 2905 | 2901 | ||
| 2906 | @noindent | 2902 | @noindent |
| 2907 | This section defines a few simple Common Lisp operations on numbers | 2903 | This section defines a few simple Common Lisp operations on numbers |
| 2908 | which were left out of Emacs Lisp. | 2904 | that were left out of Emacs Lisp. |
| 2909 | 2905 | ||
| 2910 | @menu | 2906 | @menu |
| 2911 | * Predicates on Numbers:: @code{cl-plusp}, @code{cl-oddp}, @code{cl-floatp-safe}, etc. | 2907 | * Predicates on Numbers:: @code{cl-plusp}, @code{cl-oddp}, etc. |
| 2912 | * Numerical Functions:: @code{abs}, @code{cl-floor}, etc. | 2908 | * Numerical Functions:: @code{cl-floor}, @code{cl-ceiling}, etc. |
| 2913 | * Random Numbers:: @code{cl-random}, @code{cl-make-random-state}. | 2909 | * Random Numbers:: @code{cl-random}, @code{cl-make-random-state}. |
| 2914 | * Implementation Parameters:: @code{cl-most-positive-float}. | 2910 | * Implementation Parameters:: @code{cl-most-positive-float}, etc. |
| 2915 | @end menu | 2911 | @end menu |
| 2916 | 2912 | ||
| 2917 | @node Predicates on Numbers | 2913 | @node Predicates on Numbers |
| @@ -2941,11 +2937,13 @@ This predicate tests whether @var{integer} is even. It is an | |||
| 2941 | error if the argument is not an integer. | 2937 | error if the argument is not an integer. |
| 2942 | @end defun | 2938 | @end defun |
| 2943 | 2939 | ||
| 2940 | @ignore | ||
| 2944 | @defun cl-floatp-safe object | 2941 | @defun cl-floatp-safe object |
| 2945 | This predicate tests whether @var{object} is a floating-point | 2942 | This predicate tests whether @var{object} is a floating-point |
| 2946 | number. On systems that support floating-point, this is equivalent | 2943 | number. On systems that support floating-point, this is equivalent |
| 2947 | to @code{floatp}. On other systems, this always returns @code{nil}. | 2944 | to @code{floatp}. On other systems, this always returns @code{nil}. |
| 2948 | @end defun | 2945 | @end defun |
| 2946 | @end ignore | ||
| 2949 | 2947 | ||
| 2950 | @node Numerical Functions | 2948 | @node Numerical Functions |
| 2951 | @section Numerical Functions | 2949 | @section Numerical Functions |
| @@ -3036,6 +3034,7 @@ of @code{cl-truncate}. | |||
| 3036 | This package also provides an implementation of the Common Lisp | 3034 | This package also provides an implementation of the Common Lisp |
| 3037 | random number generator. It uses its own additive-congruential | 3035 | random number generator. It uses its own additive-congruential |
| 3038 | algorithm, which is much more likely to give statistically clean | 3036 | algorithm, which is much more likely to give statistically clean |
| 3037 | @c FIXME? Still true? | ||
| 3039 | random numbers than the simple generators supplied by many | 3038 | random numbers than the simple generators supplied by many |
| 3040 | operating systems. | 3039 | operating systems. |
| 3041 | 3040 | ||
| @@ -3043,22 +3042,16 @@ operating systems. | |||
| 3043 | This function returns a random nonnegative number less than | 3042 | This function returns a random nonnegative number less than |
| 3044 | @var{number}, and of the same type (either integer or floating-point). | 3043 | @var{number}, and of the same type (either integer or floating-point). |
| 3045 | The @var{state} argument should be a @code{random-state} object | 3044 | The @var{state} argument should be a @code{random-state} object |
| 3046 | which holds the state of the random number generator. The | 3045 | that holds the state of the random number generator. The |
| 3047 | function modifies this state object as a side effect. If | 3046 | function modifies this state object as a side effect. If |
| 3048 | @var{state} is omitted, it defaults to the variable | 3047 | @var{state} is omitted, it defaults to the internal variable |
| 3049 | @code{cl--random-state}, which contains a pre-initialized | 3048 | @code{cl--random-state}, which contains a pre-initialized |
| 3050 | @code{random-state} object. | 3049 | default @code{random-state} object. (Since any number of programs in |
| 3050 | the Emacs process may be accessing @code{cl--random-state} in | ||
| 3051 | interleaved fashion, the sequence generated from this will be | ||
| 3052 | irreproducible for all intents and purposes.) | ||
| 3051 | @end defun | 3053 | @end defun |
| 3052 | 3054 | ||
| 3053 | @defvar cl--random-state | ||
| 3054 | This variable contains the system ``default'' @code{random-state} | ||
| 3055 | object, used for calls to @code{cl-random} that do not specify an | ||
| 3056 | alternative state object. Since any number of programs in the | ||
| 3057 | Emacs process may be accessing @code{cl--random-state} in interleaved | ||
| 3058 | fashion, the sequence generated from this variable will be | ||
| 3059 | irreproducible for all intents and purposes. | ||
| 3060 | @end defvar | ||
| 3061 | |||
| 3062 | @defun cl-make-random-state &optional state | 3055 | @defun cl-make-random-state &optional state |
| 3063 | This function creates or copies a @code{random-state} object. | 3056 | This function creates or copies a @code{random-state} object. |
| 3064 | If @var{state} is omitted or @code{nil}, it returns a new copy of | 3057 | If @var{state} is omitted or @code{nil}, it returns a new copy of |
| @@ -3094,10 +3087,10 @@ This predicate returns @code{t} if @var{object} is a | |||
| 3094 | @section Implementation Parameters | 3087 | @section Implementation Parameters |
| 3095 | 3088 | ||
| 3096 | @noindent | 3089 | @noindent |
| 3097 | This package defines several useful constants having to with numbers. | 3090 | This package defines several useful constants having to do with |
| 3091 | floating-point numbers. | ||
| 3098 | 3092 | ||
| 3099 | The following parameters have to do with floating-point numbers. | 3093 | It determines their values by exercising the computer's |
| 3100 | This package determines their values by exercising the computer's | ||
| 3101 | floating-point arithmetic in various ways. Because this operation | 3094 | floating-point arithmetic in various ways. Because this operation |
| 3102 | might be slow, the code for initializing them is kept in a separate | 3095 | might be slow, the code for initializing them is kept in a separate |
| 3103 | function that must be called before the parameters can be used. | 3096 | function that must be called before the parameters can be used. |
| @@ -3105,12 +3098,13 @@ function that must be called before the parameters can be used. | |||
| 3105 | @defun cl-float-limits | 3098 | @defun cl-float-limits |
| 3106 | This function makes sure that the Common Lisp floating-point parameters | 3099 | This function makes sure that the Common Lisp floating-point parameters |
| 3107 | like @code{cl-most-positive-float} have been initialized. Until it is | 3100 | like @code{cl-most-positive-float} have been initialized. Until it is |
| 3108 | called, these parameters will be @code{nil}. If this version of Emacs | 3101 | called, these parameters will be @code{nil}. |
| 3109 | does not support floats, the parameters will remain @code{nil}. If the | 3102 | @c If this version of Emacs does not support floats, the parameters will |
| 3110 | parameters have already been initialized, the function returns | 3103 | @c remain @code{nil}. |
| 3104 | If the parameters have already been initialized, the function returns | ||
| 3111 | immediately. | 3105 | immediately. |
| 3112 | 3106 | ||
| 3113 | The algorithm makes assumptions that will be valid for most modern | 3107 | The algorithm makes assumptions that will be valid for almost all |
| 3114 | machines, but will fail if the machine's arithmetic is extremely | 3108 | machines, but will fail if the machine's arithmetic is extremely |
| 3115 | unusual, e.g., decimal. | 3109 | unusual, e.g., decimal. |
| 3116 | @end defun | 3110 | @end defun |
| @@ -3130,7 +3124,7 @@ is approximately @code{1.79e+308}. | |||
| 3130 | @end defvar | 3124 | @end defvar |
| 3131 | 3125 | ||
| 3132 | @defvar cl-most-negative-float | 3126 | @defvar cl-most-negative-float |
| 3133 | This constant equals the most-negative value a Lisp float can hold. | 3127 | This constant equals the most negative value a Lisp float can hold. |
| 3134 | (It is assumed to be equal to @code{(- cl-most-positive-float)}.) | 3128 | (It is assumed to be equal to @code{(- cl-most-positive-float)}.) |
| 3135 | @end defvar | 3129 | @end defvar |
| 3136 | 3130 | ||
| @@ -3199,7 +3193,7 @@ may appear in any order. | |||
| 3199 | The @code{:key} argument should be passed either @code{nil}, or a | 3193 | The @code{:key} argument should be passed either @code{nil}, or a |
| 3200 | function of one argument. This key function is used as a filter | 3194 | function of one argument. This key function is used as a filter |
| 3201 | through which the elements of the sequence are seen; for example, | 3195 | through which the elements of the sequence are seen; for example, |
| 3202 | @code{(cl-find x y :key 'car)} is similar to @code{(cl-assoc x y)}: | 3196 | @code{(cl-find x y :key 'car)} is similar to @code{(cl-assoc x y)}. |
| 3203 | It searches for an element of the list whose @sc{car} equals | 3197 | It searches for an element of the list whose @sc{car} equals |
| 3204 | @code{x}, rather than for an element which equals @code{x} itself. | 3198 | @code{x}, rather than for an element which equals @code{x} itself. |
| 3205 | If @code{:key} is omitted or @code{nil}, the filter is effectively | 3199 | If @code{:key} is omitted or @code{nil}, the filter is effectively |
| @@ -3217,7 +3211,7 @@ true (non-@code{nil}) to indicate a match; instead, you may use | |||
| 3217 | @code{:test-not} to give a function which returns @emph{false} to | 3211 | @code{:test-not} to give a function which returns @emph{false} to |
| 3218 | indicate a match. The default test function is @code{eql}. | 3212 | indicate a match. The default test function is @code{eql}. |
| 3219 | 3213 | ||
| 3220 | Many functions which take @var{item} and @code{:test} or @code{:test-not} | 3214 | Many functions that take @var{item} and @code{:test} or @code{:test-not} |
| 3221 | arguments also come in @code{-if} and @code{-if-not} varieties, | 3215 | arguments also come in @code{-if} and @code{-if-not} varieties, |
| 3222 | where a @var{predicate} function is passed instead of @var{item}, | 3216 | where a @var{predicate} function is passed instead of @var{item}, |
| 3223 | and sequence elements match if the predicate returns true on them | 3217 | and sequence elements match if the predicate returns true on them |
| @@ -3231,7 +3225,7 @@ and sequence elements match if the predicate returns true on them | |||
| 3231 | to remove all zeros from sequence @code{seq}. | 3225 | to remove all zeros from sequence @code{seq}. |
| 3232 | 3226 | ||
| 3233 | Some operations can work on a subsequence of the argument sequence; | 3227 | Some operations can work on a subsequence of the argument sequence; |
| 3234 | these function take @code{:start} and @code{:end} arguments which | 3228 | these function take @code{:start} and @code{:end} arguments, which |
| 3235 | default to zero and the length of the sequence, respectively. | 3229 | default to zero and the length of the sequence, respectively. |
| 3236 | Only elements between @var{start} (inclusive) and @var{end} | 3230 | Only elements between @var{start} (inclusive) and @var{end} |
| 3237 | (exclusive) are affected by the operation. The @var{end} argument | 3231 | (exclusive) are affected by the operation. The @var{end} argument |
| @@ -3339,7 +3333,7 @@ the return values using @code{nconc}. | |||
| 3339 | @defun cl-some predicate seq &rest more-seqs | 3333 | @defun cl-some predicate seq &rest more-seqs |
| 3340 | This function calls @var{predicate} on each element of @var{seq} | 3334 | This function calls @var{predicate} on each element of @var{seq} |
| 3341 | in turn; if @var{predicate} returns a non-@code{nil} value, | 3335 | in turn; if @var{predicate} returns a non-@code{nil} value, |
| 3342 | @code{some} returns that value, otherwise it returns @code{nil}. | 3336 | @code{cl-some} returns that value, otherwise it returns @code{nil}. |
| 3343 | Given several sequence arguments, it steps through the sequences | 3337 | Given several sequence arguments, it steps through the sequences |
| 3344 | in parallel until the shortest one runs out, just as in | 3338 | in parallel until the shortest one runs out, just as in |
| 3345 | @code{cl-mapcar}. You can rely on the left-to-right order in which | 3339 | @code{cl-mapcar}. You can rely on the left-to-right order in which |
| @@ -3388,7 +3382,7 @@ of left-associative: | |||
| 3388 | @equiv{} (- 1 (- 2 (- 3 4))) @result{} -2 | 3382 | @equiv{} (- 1 (- 2 (- 3 4))) @result{} -2 |
| 3389 | @end example | 3383 | @end example |
| 3390 | 3384 | ||
| 3391 | If @code{:key} is specified, it is a function of one argument which | 3385 | If @code{:key} is specified, it is a function of one argument, which |
| 3392 | is called on each of the sequence elements in turn. | 3386 | is called on each of the sequence elements in turn. |
| 3393 | 3387 | ||
| 3394 | If @code{:initial-value} is specified, it is effectively added to the | 3388 | If @code{:initial-value} is specified, it is effectively added to the |
| @@ -3457,7 +3451,7 @@ of data copied is simply the shorter of the source and destination | |||
| 3457 | If @var{seq1} and @var{seq2} are @code{eq}, then the replacement | 3451 | If @var{seq1} and @var{seq2} are @code{eq}, then the replacement |
| 3458 | will work correctly even if the regions indicated by the start | 3452 | will work correctly even if the regions indicated by the start |
| 3459 | and end arguments overlap. However, if @var{seq1} and @var{seq2} | 3453 | and end arguments overlap. However, if @var{seq1} and @var{seq2} |
| 3460 | are lists which share storage but are not @code{eq}, and the | 3454 | are lists that share storage but are not @code{eq}, and the |
| 3461 | start and end arguments specify overlapping regions, the effect | 3455 | start and end arguments specify overlapping regions, the effect |
| 3462 | is undefined. | 3456 | is undefined. |
| 3463 | @end defun | 3457 | @end defun |
| @@ -3480,7 +3474,7 @@ if @var{count} was also specified). | |||
| 3480 | @end defun | 3474 | @end defun |
| 3481 | 3475 | ||
| 3482 | @defun cl-delete item seq @t{&key :test :test-not :key :count :start :end :from-end} | 3476 | @defun cl-delete item seq @t{&key :test :test-not :key :count :start :end :from-end} |
| 3483 | This deletes all elements of @var{seq} which match @var{item}. | 3477 | This deletes all elements of @var{seq} that match @var{item}. |
| 3484 | It is a destructive operation. Since Emacs Lisp does not support | 3478 | It is a destructive operation. Since Emacs Lisp does not support |
| 3485 | stretchable strings or vectors, this is the same as @code{cl-remove} | 3479 | stretchable strings or vectors, this is the same as @code{cl-remove} |
| 3486 | for those sequence types. On lists, @code{cl-remove} will copy the | 3480 | for those sequence types. On lists, @code{cl-remove} will copy the |
| @@ -3580,7 +3574,7 @@ elements match (according to @code{:test}, @code{:test-not}, | |||
| 3580 | and @code{:key}), the function returns @code{nil}. If there is | 3574 | and @code{:key}), the function returns @code{nil}. If there is |
| 3581 | a mismatch, the function returns the index (relative to @var{seq1}) | 3575 | a mismatch, the function returns the index (relative to @var{seq1}) |
| 3582 | of the first mismatching element. This will be the leftmost pair of | 3576 | of the first mismatching element. This will be the leftmost pair of |
| 3583 | elements which do not match, or the position at which the shorter of | 3577 | elements that do not match, or the position at which the shorter of |
| 3584 | the two otherwise-matching sequences runs out. | 3578 | the two otherwise-matching sequences runs out. |
| 3585 | 3579 | ||
| 3586 | If @code{:from-end} is true, then the elements are compared from right | 3580 | If @code{:from-end} is true, then the elements are compared from right |
| @@ -3595,7 +3589,7 @@ which compares two strings case-insensitively. | |||
| 3595 | @defun cl-search seq1 seq2 @t{&key :test :test-not :key :from-end :start1 :end1 :start2 :end2} | 3589 | @defun cl-search seq1 seq2 @t{&key :test :test-not :key :from-end :start1 :end1 :start2 :end2} |
| 3596 | This function searches @var{seq2} for a subsequence that matches | 3590 | This function searches @var{seq2} for a subsequence that matches |
| 3597 | @var{seq1} (or part of it specified by @code{:start1} and | 3591 | @var{seq1} (or part of it specified by @code{:start1} and |
| 3598 | @code{:end1}.) Only matches which fall entirely within the region | 3592 | @code{:end1}). Only matches that fall entirely within the region |
| 3599 | defined by @code{:start2} and @code{:end2} will be considered. | 3593 | defined by @code{:start2} and @code{:end2} will be considered. |
| 3600 | The return value is the index of the leftmost element of the | 3594 | The return value is the index of the leftmost element of the |
| 3601 | leftmost match, relative to the start of @var{seq2}, or @code{nil} | 3595 | leftmost match, relative to the start of @var{seq2}, or @code{nil} |
| @@ -3606,7 +3600,7 @@ function finds the @emph{rightmost} matching subsequence. | |||
| 3606 | @node Sorting Sequences | 3600 | @node Sorting Sequences |
| 3607 | @section Sorting Sequences | 3601 | @section Sorting Sequences |
| 3608 | 3602 | ||
| 3609 | @defun clsort seq predicate @t{&key :key} | 3603 | @defun cl-sort seq predicate @t{&key :key} |
| 3610 | This function sorts @var{seq} into increasing order as determined | 3604 | This function sorts @var{seq} into increasing order as determined |
| 3611 | by using @var{predicate} to compare pairs of elements. @var{predicate} | 3605 | by using @var{predicate} to compare pairs of elements. @var{predicate} |
| 3612 | should return true (non-@code{nil}) if and only if its first argument | 3606 | should return true (non-@code{nil}) if and only if its first argument |
| @@ -3617,7 +3611,7 @@ numbers into decreasing rather than increasing order. | |||
| 3617 | 3611 | ||
| 3618 | This function differs from Emacs's built-in @code{sort} in that it | 3612 | This function differs from Emacs's built-in @code{sort} in that it |
| 3619 | can operate on any type of sequence, not just lists. Also, it | 3613 | can operate on any type of sequence, not just lists. Also, it |
| 3620 | accepts a @code{:key} argument which is used to preprocess data | 3614 | accepts a @code{:key} argument, which is used to preprocess data |
| 3621 | fed to the @var{predicate} function. For example, | 3615 | fed to the @var{predicate} function. For example, |
| 3622 | 3616 | ||
| 3623 | @example | 3617 | @example |
| @@ -3628,7 +3622,7 @@ fed to the @var{predicate} function. For example, | |||
| 3628 | sorts @var{data}, a sequence of strings, into increasing alphabetical | 3622 | sorts @var{data}, a sequence of strings, into increasing alphabetical |
| 3629 | order without regard to case. A @code{:key} function of @code{car} | 3623 | order without regard to case. A @code{:key} function of @code{car} |
| 3630 | would be useful for sorting association lists. It should only be a | 3624 | would be useful for sorting association lists. It should only be a |
| 3631 | simple accessor though, it's used heavily in the current | 3625 | simple accessor though, since it's used heavily in the current |
| 3632 | implementation. | 3626 | implementation. |
| 3633 | 3627 | ||
| 3634 | The @code{cl-sort} function is destructive; it sorts lists by actually | 3628 | The @code{cl-sort} function is destructive; it sorts lists by actually |
| @@ -3684,7 +3678,7 @@ i.e., chains of cons cells. | |||
| 3684 | 3678 | ||
| 3685 | @defun cl-caddr x | 3679 | @defun cl-caddr x |
| 3686 | This function is equivalent to @code{(car (cdr (cdr @var{x})))}. | 3680 | This function is equivalent to @code{(car (cdr (cdr @var{x})))}. |
| 3687 | Likewise, this package defines all 28 @code{c@var{xxx}r} functions | 3681 | Likewise, this package defines all 24 @code{c@var{xxx}r} functions |
| 3688 | where @var{xxx} is up to four @samp{a}s and/or @samp{d}s. | 3682 | where @var{xxx} is up to four @samp{a}s and/or @samp{d}s. |
| 3689 | All of these functions are @code{setf}-able, and calls to them | 3683 | All of these functions are @code{setf}-able, and calls to them |
| 3690 | are expanded inline by the byte-compiler for maximum efficiency. | 3684 | are expanded inline by the byte-compiler for maximum efficiency. |
| @@ -3712,7 +3706,8 @@ This function returns the length of list @var{x}, exactly like | |||
| 3712 | @code{(length @var{x})}, except that if @var{x} is a circular | 3706 | @code{(length @var{x})}, except that if @var{x} is a circular |
| 3713 | list (where the @sc{cdr}-chain forms a loop rather than terminating | 3707 | list (where the @sc{cdr}-chain forms a loop rather than terminating |
| 3714 | with @code{nil}), this function returns @code{nil}. (The regular | 3708 | with @code{nil}), this function returns @code{nil}. (The regular |
| 3715 | @code{length} function would get stuck if given a circular list.) | 3709 | @code{length} function would get stuck if given a circular list. |
| 3710 | See also the @code{safe-length} function.) | ||
| 3716 | @end defun | 3711 | @end defun |
| 3717 | 3712 | ||
| 3718 | @defun cl-list* arg &rest others | 3713 | @defun cl-list* arg &rest others |
| @@ -3740,18 +3735,6 @@ This function returns a copy of the list @var{list}. It copies | |||
| 3740 | dotted lists like @code{(1 2 . 3)} correctly. | 3735 | dotted lists like @code{(1 2 . 3)} correctly. |
| 3741 | @end defun | 3736 | @end defun |
| 3742 | 3737 | ||
| 3743 | @defun copy-tree x &optional vecp | ||
| 3744 | This function returns a copy of the tree of cons cells @var{x}. | ||
| 3745 | @c FIXME? cl-copy-list is not an alias of copy-sequence. | ||
| 3746 | Unlike @code{copy-sequence} (and its alias @code{cl-copy-list}), | ||
| 3747 | which copies only along the @sc{cdr} direction, this function | ||
| 3748 | copies (recursively) along both the @sc{car} and the @sc{cdr} | ||
| 3749 | directions. If @var{x} is not a cons cell, the function simply | ||
| 3750 | returns @var{x} unchanged. If the optional @var{vecp} argument | ||
| 3751 | is true, this function copies vectors (recursively) as well as | ||
| 3752 | cons cells. | ||
| 3753 | @end defun | ||
| 3754 | |||
| 3755 | @defun cl-tree-equal x y @t{&key :test :test-not :key} | 3738 | @defun cl-tree-equal x y @t{&key :test :test-not :key} |
| 3756 | This function compares two trees of cons cells. If @var{x} and | 3739 | This function compares two trees of cons cells. If @var{x} and |
| 3757 | @var{y} are both cons cells, their @sc{car}s and @sc{cdr}s are | 3740 | @var{y} are both cons cells, their @sc{car}s and @sc{cdr}s are |
| @@ -3814,7 +3797,7 @@ This is a destructive version of @code{cl-sublis}. | |||
| 3814 | @section Lists as Sets | 3797 | @section Lists as Sets |
| 3815 | 3798 | ||
| 3816 | @noindent | 3799 | @noindent |
| 3817 | These functions perform operations on lists which represent sets | 3800 | These functions perform operations on lists that represent sets |
| 3818 | of elements. | 3801 | of elements. |
| 3819 | 3802 | ||
| 3820 | @defun cl-member item list @t{&key :test :test-not :key} | 3803 | @defun cl-member item list @t{&key :test :test-not :key} |
| @@ -3827,13 +3810,14 @@ are compared by @code{eql} by default; you can use the @code{:test}, | |||
| 3827 | 3810 | ||
| 3828 | The standard Emacs lisp function @code{member} uses @code{equal} for | 3811 | The standard Emacs lisp function @code{member} uses @code{equal} for |
| 3829 | comparisons; it is equivalent to @code{(cl-member @var{item} @var{list} | 3812 | comparisons; it is equivalent to @code{(cl-member @var{item} @var{list} |
| 3830 | :test 'equal)}. | 3813 | :test 'equal)}. With no keyword arguments, @code{cl-member} is |
| 3814 | equivalent to @code{memq}. | ||
| 3831 | @end defun | 3815 | @end defun |
| 3832 | 3816 | ||
| 3833 | @findex cl-member-if | 3817 | @findex cl-member-if |
| 3834 | @findex cl-member-if-not | 3818 | @findex cl-member-if-not |
| 3835 | The @code{cl-member-if} and @code{cl-member-if-not} functions | 3819 | The @code{cl-member-if} and @code{cl-member-if-not} functions |
| 3836 | analogously search for elements which satisfy a given predicate. | 3820 | analogously search for elements that satisfy a given predicate. |
| 3837 | 3821 | ||
| 3838 | @defun cl-tailp sublist list | 3822 | @defun cl-tailp sublist list |
| 3839 | This function returns @code{t} if @var{sublist} is a sublist of | 3823 | This function returns @code{t} if @var{sublist} is a sublist of |
| @@ -3852,11 +3836,11 @@ become part of the list. | |||
| 3852 | @end defun | 3836 | @end defun |
| 3853 | 3837 | ||
| 3854 | @defun cl-union list1 list2 @t{&key :test :test-not :key} | 3838 | @defun cl-union list1 list2 @t{&key :test :test-not :key} |
| 3855 | This function combines two lists which represent sets of items, | 3839 | This function combines two lists that represent sets of items, |
| 3856 | returning a list that represents the union of those two sets. | 3840 | returning a list that represents the union of those two sets. |
| 3857 | The result list will contain all items which appear in @var{list1} | 3841 | The resulting list contains all items that appear in @var{list1} |
| 3858 | or @var{list2}, and no others. If an item appears in both | 3842 | or @var{list2}, and no others. If an item appears in both |
| 3859 | @var{list1} and @var{list2} it will be copied only once. If | 3843 | @var{list1} and @var{list2} it is copied only once. If |
| 3860 | an item is duplicated in @var{list1} or @var{list2}, it is | 3844 | an item is duplicated in @var{list1} or @var{list2}, it is |
| 3861 | undefined whether or not that duplication will survive in the | 3845 | undefined whether or not that duplication will survive in the |
| 3862 | result list. The order of elements in the result list is also | 3846 | result list. The order of elements in the result list is also |
| @@ -3871,7 +3855,7 @@ it tries to reuse the storage of the argument lists if possible. | |||
| 3871 | @defun cl-intersection list1 list2 @t{&key :test :test-not :key} | 3855 | @defun cl-intersection list1 list2 @t{&key :test :test-not :key} |
| 3872 | This function computes the intersection of the sets represented | 3856 | This function computes the intersection of the sets represented |
| 3873 | by @var{list1} and @var{list2}. It returns the list of items | 3857 | by @var{list1} and @var{list2}. It returns the list of items |
| 3874 | which appear in both @var{list1} and @var{list2}. | 3858 | that appear in both @var{list1} and @var{list2}. |
| 3875 | @end defun | 3859 | @end defun |
| 3876 | 3860 | ||
| 3877 | @defun cl-nintersection list1 list2 @t{&key :test :test-not :key} | 3861 | @defun cl-nintersection list1 list2 @t{&key :test :test-not :key} |
| @@ -3921,7 +3905,7 @@ This function searches the association list @var{a-list} for an | |||
| 3921 | element whose @sc{car} matches (in the sense of @code{:test}, | 3905 | element whose @sc{car} matches (in the sense of @code{:test}, |
| 3922 | @code{:test-not}, and @code{:key}, or by comparison with @code{eql}) | 3906 | @code{:test-not}, and @code{:key}, or by comparison with @code{eql}) |
| 3923 | a given @var{item}. It returns the matching element, if any, | 3907 | a given @var{item}. It returns the matching element, if any, |
| 3924 | otherwise @code{nil}. It ignores elements of @var{a-list} which | 3908 | otherwise @code{nil}. It ignores elements of @var{a-list} that |
| 3925 | are not cons cells. (This corresponds to the behavior of | 3909 | are not cons cells. (This corresponds to the behavior of |
| 3926 | @code{assq} and @code{assoc} in Emacs Lisp; Common Lisp's | 3910 | @code{assq} and @code{assoc} in Emacs Lisp; Common Lisp's |
| 3927 | @code{assoc} ignores @code{nil}s but considers any other non-cons | 3911 | @code{assoc} ignores @code{nil}s but considers any other non-cons |
| @@ -3982,11 +3966,11 @@ are symbols. For example, | |||
| 3982 | @end example | 3966 | @end example |
| 3983 | 3967 | ||
| 3984 | @noindent | 3968 | @noindent |
| 3985 | defines a struct type called @code{person} which contains three | 3969 | defines a struct type called @code{person} that contains three |
| 3986 | slots. Given a @code{person} object @var{p}, you can access those | 3970 | slots. Given a @code{person} object @var{p}, you can access those |
| 3987 | slots by calling @code{(person-name @var{p})}, @code{(person-age @var{p})}, | 3971 | slots by calling @code{(person-name @var{p})}, @code{(person-age @var{p})}, |
| 3988 | and @code{(person-sex @var{p})}. You can also change these slots by | 3972 | and @code{(person-sex @var{p})}. You can also change these slots by |
| 3989 | using @code{setf} on any of these place forms: | 3973 | using @code{setf} on any of these place forms, for example: |
| 3990 | 3974 | ||
| 3991 | @example | 3975 | @example |
| 3992 | (cl-incf (person-age birthday-boy)) | 3976 | (cl-incf (person-age birthday-boy)) |
| @@ -4003,10 +3987,10 @@ Given a @code{person}, @code{(copy-person @var{p})} makes a new | |||
| 4003 | object of the same type whose slots are @code{eq} to those of @var{p}. | 3987 | object of the same type whose slots are @code{eq} to those of @var{p}. |
| 4004 | 3988 | ||
| 4005 | Given any Lisp object @var{x}, @code{(person-p @var{x})} returns | 3989 | Given any Lisp object @var{x}, @code{(person-p @var{x})} returns |
| 4006 | true if @var{x} looks like a @code{person}, false otherwise. (Again, | 3990 | true if @var{x} looks like a @code{person}, and false otherwise. (Again, |
| 4007 | in Common Lisp this predicate would be exact; in Emacs Lisp the | 3991 | in Common Lisp this predicate would be exact; in Emacs Lisp the |
| 4008 | best it can do is verify that @var{x} is a vector of the correct | 3992 | best it can do is verify that @var{x} is a vector of the correct |
| 4009 | length which starts with the correct tag symbol.) | 3993 | length that starts with the correct tag symbol.) |
| 4010 | 3994 | ||
| 4011 | Accessors like @code{person-name} normally check their arguments | 3995 | Accessors like @code{person-name} normally check their arguments |
| 4012 | (effectively using @code{person-p}) and signal an error if the | 3996 | (effectively using @code{person-p}) and signal an error if the |
| @@ -4043,7 +4027,7 @@ In general, @var{name} is either a name symbol or a list of a name | |||
| 4043 | symbol followed by any number of @dfn{struct options}; each @var{slot} | 4027 | symbol followed by any number of @dfn{struct options}; each @var{slot} |
| 4044 | is either a slot symbol or a list of the form @samp{(@var{slot-name} | 4028 | is either a slot symbol or a list of the form @samp{(@var{slot-name} |
| 4045 | @var{default-value} @var{slot-options}@dots{})}. The @var{default-value} | 4029 | @var{default-value} @var{slot-options}@dots{})}. The @var{default-value} |
| 4046 | is a Lisp form which is evaluated any time an instance of the | 4030 | is a Lisp form that is evaluated any time an instance of the |
| 4047 | structure type is created without specifying that slot's value. | 4031 | structure type is created without specifying that slot's value. |
| 4048 | 4032 | ||
| 4049 | Common Lisp defines several slot options, but the only one | 4033 | Common Lisp defines several slot options, but the only one |
| @@ -4101,11 +4085,11 @@ The argument names should match the slot names; each slot is | |||
| 4101 | initialized from the corresponding argument. Slots whose names | 4085 | initialized from the corresponding argument. Slots whose names |
| 4102 | do not appear in the argument list are initialized based on the | 4086 | do not appear in the argument list are initialized based on the |
| 4103 | @var{default-value} in their slot descriptor. Also, @code{&optional} | 4087 | @var{default-value} in their slot descriptor. Also, @code{&optional} |
| 4104 | and @code{&key} arguments which don't specify defaults take their | 4088 | and @code{&key} arguments that don't specify defaults take their |
| 4105 | defaults from the slot descriptor. It is valid to include arguments | 4089 | defaults from the slot descriptor. It is valid to include arguments |
| 4106 | which don't correspond to slot names; these are useful if they are | 4090 | that don't correspond to slot names; these are useful if they are |
| 4107 | referred to in the defaults for optional, keyword, or @code{&aux} | 4091 | referred to in the defaults for optional, keyword, or @code{&aux} |
| 4108 | arguments which @emph{do} correspond to slots. | 4092 | arguments that @emph{do} correspond to slots. |
| 4109 | 4093 | ||
| 4110 | You can specify any number of full-format @code{:constructor} | 4094 | You can specify any number of full-format @code{:constructor} |
| 4111 | options on a structure. The default constructor is still generated | 4095 | options on a structure. The default constructor is still generated |
| @@ -4146,7 +4130,7 @@ means not to generate a copier function. (In this implementation, | |||
| 4146 | all copier functions are simply synonyms for @code{copy-sequence}.) | 4130 | all copier functions are simply synonyms for @code{copy-sequence}.) |
| 4147 | 4131 | ||
| 4148 | @item :predicate | 4132 | @item :predicate |
| 4149 | The argument is an alternate name for the predicate which recognizes | 4133 | The argument is an alternate name for the predicate that recognizes |
| 4150 | objects of this type. The default is @code{@var{name}-p}. @code{nil} | 4134 | objects of this type. The default is @code{@var{name}-p}. @code{nil} |
| 4151 | means not to generate a predicate function. (If the @code{:type} | 4135 | means not to generate a predicate function. (If the @code{:type} |
| 4152 | option is used without the @code{:named} option, no predicate is | 4136 | option is used without the @code{:named} option, no predicate is |
| @@ -4206,7 +4190,7 @@ work on astronauts just like other people. | |||
| 4206 | 4190 | ||
| 4207 | @item :print-function | 4191 | @item :print-function |
| 4208 | In full Common Lisp, this option allows you to specify a function | 4192 | In full Common Lisp, this option allows you to specify a function |
| 4209 | which is called to print an instance of the structure type. The | 4193 | that is called to print an instance of the structure type. The |
| 4210 | Emacs Lisp system offers no hooks into the Lisp printer which would | 4194 | Emacs Lisp system offers no hooks into the Lisp printer which would |
| 4211 | allow for such a feature, so this package simply ignores | 4195 | allow for such a feature, so this package simply ignores |
| 4212 | @code{:print-function}. | 4196 | @code{:print-function}. |
| @@ -4383,7 +4367,7 @@ You can find out how a macro expands by using the | |||
| 4383 | This function takes a single Lisp form as an argument and inserts | 4367 | This function takes a single Lisp form as an argument and inserts |
| 4384 | a nicely formatted copy of it in the current buffer (which must be | 4368 | a nicely formatted copy of it in the current buffer (which must be |
| 4385 | in Lisp mode so that indentation works properly). It also expands | 4369 | in Lisp mode so that indentation works properly). It also expands |
| 4386 | all Lisp macros which appear in the form. The easiest way to use | 4370 | all Lisp macros that appear in the form. The easiest way to use |
| 4387 | this function is to go to the @file{*scratch*} buffer and type, say, | 4371 | this function is to go to the @file{*scratch*} buffer and type, say, |
| 4388 | 4372 | ||
| 4389 | @example | 4373 | @example |
| @@ -4392,7 +4376,7 @@ this function is to go to the @file{*scratch*} buffer and type, say, | |||
| 4392 | 4376 | ||
| 4393 | @noindent | 4377 | @noindent |
| 4394 | and type @kbd{C-x C-e} immediately after the closing parenthesis; | 4378 | and type @kbd{C-x C-e} immediately after the closing parenthesis; |
| 4395 | the expansion | 4379 | an expansion similar to: |
| 4396 | 4380 | ||
| 4397 | @example | 4381 | @example |
| 4398 | (cl-block nil | 4382 | (cl-block nil |
| @@ -4413,7 +4397,11 @@ variable @code{G1004} was created by @code{cl-gensym}.) | |||
| 4413 | If the optional argument @var{full} is true, then @emph{all} | 4397 | If the optional argument @var{full} is true, then @emph{all} |
| 4414 | macros are expanded, including @code{cl-block}, @code{cl-eval-when}, | 4398 | macros are expanded, including @code{cl-block}, @code{cl-eval-when}, |
| 4415 | and compiler macros. Expansion is done as if @var{form} were | 4399 | and compiler macros. Expansion is done as if @var{form} were |
| 4416 | a top-level form in a file being compiled. For example, | 4400 | a top-level form in a file being compiled. |
| 4401 | |||
| 4402 | @c FIXME none of these examples are still applicable. | ||
| 4403 | @ignore | ||
| 4404 | For example, | ||
| 4417 | 4405 | ||
| 4418 | @example | 4406 | @example |
| 4419 | (cl-prettyexpand '(cl-pushnew 'x list)) | 4407 | (cl-prettyexpand '(cl-pushnew 'x list)) |
| @@ -4423,16 +4411,12 @@ a top-level form in a file being compiled. For example, | |||
| 4423 | (cl-prettyexpand '(caddr (cl-member 'a list)) t) | 4411 | (cl-prettyexpand '(caddr (cl-member 'a list)) t) |
| 4424 | @print{} (car (cdr (cdr (memq 'a list)))) | 4412 | @print{} (car (cdr (cdr (memq 'a list)))) |
| 4425 | @end example | 4413 | @end example |
| 4414 | @end ignore | ||
| 4426 | 4415 | ||
| 4427 | Note that @code{cl-adjoin}, @code{cl-caddr}, and @code{cl-member} all | 4416 | Note that @code{cl-adjoin}, @code{cl-caddr}, and @code{cl-member} all |
| 4428 | have built-in compiler macros to optimize them in common cases. | 4417 | have built-in compiler macros to optimize them in common cases. |
| 4429 | @end defun | 4418 | @end defun |
| 4430 | 4419 | ||
| 4431 | @ifinfo | ||
| 4432 | @example | ||
| 4433 | |||
| 4434 | @end example | ||
| 4435 | @end ifinfo | ||
| 4436 | @appendixsec Error Checking | 4420 | @appendixsec Error Checking |
| 4437 | 4421 | ||
| 4438 | @noindent | 4422 | @noindent |
| @@ -4442,7 +4426,7 @@ where substantial gains were possible at the expense of marginal | |||
| 4442 | incompatibility. | 4426 | incompatibility. |
| 4443 | 4427 | ||
| 4444 | The Common Lisp standard (as embodied in Steele's book) uses the | 4428 | The Common Lisp standard (as embodied in Steele's book) uses the |
| 4445 | phrase ``it is an error if'' to indicate a situation which is not | 4429 | phrase ``it is an error if'' to indicate a situation that is not |
| 4446 | supposed to arise in complying programs; implementations are strongly | 4430 | supposed to arise in complying programs; implementations are strongly |
| 4447 | encouraged but not required to signal an error in these situations. | 4431 | encouraged but not required to signal an error in these situations. |
| 4448 | This package sometimes omits such error checking in the interest of | 4432 | This package sometimes omits such error checking in the interest of |
| @@ -4464,46 +4448,36 @@ you can use @code{&allow-other-keys} to omit this check. Functions | |||
| 4464 | defined in this package such as @code{cl-find} and @code{cl-member} | 4448 | defined in this package such as @code{cl-find} and @code{cl-member} |
| 4465 | do check their keyword arguments for validity. | 4449 | do check their keyword arguments for validity. |
| 4466 | 4450 | ||
| 4467 | @ifinfo | 4451 | @appendixsec Compiler Optimizations |
| 4468 | @example | ||
| 4469 | |||
| 4470 | @end example | ||
| 4471 | @end ifinfo | ||
| 4472 | @appendixsec Optimizing Compiler | ||
| 4473 | 4452 | ||
| 4474 | @noindent | 4453 | @noindent |
| 4475 | Use of the optimizing Emacs compiler is highly recommended; many of the Common | 4454 | Changing the value of @code{byte-optimize} from the default @code{t} |
| 4455 | is highly discouraged; many of the Common | ||
| 4476 | Lisp macros emit | 4456 | Lisp macros emit |
| 4477 | code which can be improved by optimization. In particular, | 4457 | code that can be improved by optimization. In particular, |
| 4478 | @code{cl-block}s (whether explicit or implicit in constructs like | 4458 | @code{cl-block}s (whether explicit or implicit in constructs like |
| 4479 | @code{cl-defun} and @code{cl-loop}) carry a fair run-time penalty; the | 4459 | @code{cl-defun} and @code{cl-loop}) carry a fair run-time penalty; the |
| 4480 | optimizing compiler removes @code{cl-block}s which are not actually | 4460 | byte-compiler removes @code{cl-block}s that are not actually |
| 4481 | referenced by @code{cl-return} or @code{cl-return-from} inside the block. | 4461 | referenced by @code{cl-return} or @code{cl-return-from} inside the block. |
| 4482 | 4462 | ||
| 4483 | @node Common Lisp Compatibility | 4463 | @node Common Lisp Compatibility |
| 4484 | @appendix Common Lisp Compatibility | 4464 | @appendix Common Lisp Compatibility |
| 4485 | 4465 | ||
| 4486 | @noindent | 4466 | @noindent |
| 4487 | Following is a list of all known incompatibilities between this | 4467 | The following is a list of all known incompatibilities between this |
| 4488 | package and Common Lisp as documented in Steele (2nd edition). | 4468 | package and Common Lisp as documented in Steele (2nd edition). |
| 4489 | 4469 | ||
| 4490 | The word @code{cl-defun} is required instead of @code{defun} in order | 4470 | The word @code{cl-defun} is required instead of @code{defun} in order |
| 4491 | to use extended Common Lisp argument lists in a function. Likewise, | 4471 | to use extended Common Lisp argument lists in a function. Likewise, |
| 4492 | @code{cl-defmacro} and @code{cl-function} are versions of those forms | 4472 | @code{cl-defmacro} and @code{cl-function} are versions of those forms |
| 4493 | which understand full-featured argument lists. The @code{&whole} | 4473 | which understand full-featured argument lists. The @code{&whole} |
| 4494 | keyword does not work in @code{defmacro} argument lists (except | 4474 | keyword does not work in @code{cl-defmacro} argument lists (except |
| 4495 | inside recursive argument lists). | 4475 | inside recursive argument lists). |
| 4496 | 4476 | ||
| 4497 | The @code{equal} predicate does not distinguish | 4477 | The @code{equal} predicate does not distinguish |
| 4498 | between IEEE floating-point plus and minus zero. The @code{cl-equalp} | 4478 | between IEEE floating-point plus and minus zero. The @code{cl-equalp} |
| 4499 | predicate has several differences with Common Lisp; @pxref{Predicates}. | 4479 | predicate has several differences with Common Lisp; @pxref{Predicates}. |
| 4500 | 4480 | ||
| 4501 | @c FIXME no longer provided by cl. | ||
| 4502 | The @code{setf} mechanism is entirely compatible, except that | ||
| 4503 | setf-methods return a list of five values rather than five | ||
| 4504 | values directly. Also, the new ``@code{setf} function'' concept | ||
| 4505 | (typified by @code{(defun (setf foo) @dots{})}) is not implemented. | ||
| 4506 | |||
| 4507 | The @code{cl-do-all-symbols} form is the same as @code{cl-do-symbols} | 4481 | The @code{cl-do-all-symbols} form is the same as @code{cl-do-symbols} |
| 4508 | with no @var{obarray} argument. In Common Lisp, this form would | 4482 | with no @var{obarray} argument. In Common Lisp, this form would |
| 4509 | iterate over all symbols in all packages. Since Emacs obarrays | 4483 | iterate over all symbols in all packages. Since Emacs obarrays |
| @@ -4635,7 +4609,7 @@ However, the Emacs parser does not understand colons and just | |||
| 4635 | treats them as part of the symbol name. Thus, while @code{mapcar} | 4609 | treats them as part of the symbol name. Thus, while @code{mapcar} |
| 4636 | and @code{lisp:mapcar} may refer to the same symbol in Common | 4610 | and @code{lisp:mapcar} may refer to the same symbol in Common |
| 4637 | Lisp, they are totally distinct in Emacs Lisp. Common Lisp | 4611 | Lisp, they are totally distinct in Emacs Lisp. Common Lisp |
| 4638 | programs which refer to a symbol by the full name sometimes | 4612 | programs that refer to a symbol by the full name sometimes |
| 4639 | and the short name other times will not port cleanly to Emacs. | 4613 | and the short name other times will not port cleanly to Emacs. |
| 4640 | 4614 | ||
| 4641 | Emacs Lisp does have a concept of ``obarrays'', which are | 4615 | Emacs Lisp does have a concept of ``obarrays'', which are |
| @@ -4923,13 +4897,16 @@ Common Lisp defines three macros, @code{define-modify-macro}, | |||
| 4923 | user to extend generalized variables in various ways. | 4897 | user to extend generalized variables in various ways. |
| 4924 | In Emacs, these are obsolete, replaced by various features of | 4898 | In Emacs, these are obsolete, replaced by various features of |
| 4925 | @file{gv.el} in Emacs 24.3. | 4899 | @file{gv.el} in Emacs 24.3. |
| 4926 | @c FIXME details. | 4900 | @xref{Adding Generalized Variables,,,elisp,GNU Emacs Lisp Reference Manual}. |
| 4901 | |||
| 4927 | 4902 | ||
| 4928 | @defmac define-modify-macro name arglist function [doc-string] | 4903 | @defmac define-modify-macro name arglist function [doc-string] |
| 4929 | This macro defines a ``read-modify-write'' macro similar to | 4904 | This macro defines a ``read-modify-write'' macro similar to |
| 4930 | @code{cl-incf} and @code{cl-decf}. The macro @var{name} is defined | 4905 | @code{cl-incf} and @code{cl-decf}. You can replace this macro |
| 4931 | to take a @var{place} argument followed by additional arguments | 4906 | with @code{gv-letplace}. |
| 4932 | described by @var{arglist}. The call | 4907 | |
| 4908 | The macro @var{name} is defined to take a @var{place} argument | ||
| 4909 | followed by additional arguments described by @var{arglist}. The call | ||
| 4933 | 4910 | ||
| 4934 | @example | 4911 | @example |
| 4935 | (@var{name} @var{place} @var{args}@dots{}) | 4912 | (@var{name} @var{place} @var{args}@dots{}) |
| @@ -4952,8 +4929,8 @@ which in turn is roughly equivalent to | |||
| 4952 | For example: | 4929 | For example: |
| 4953 | 4930 | ||
| 4954 | @example | 4931 | @example |
| 4955 | (define-modify-macro cl-incf (&optional (n 1)) +) | 4932 | (define-modify-macro incf (&optional (n 1)) +) |
| 4956 | (define-modify-macro cl-concatf (&rest args) concat) | 4933 | (define-modify-macro concatf (&rest args) concat) |
| 4957 | @end example | 4934 | @end example |
| 4958 | 4935 | ||
| 4959 | Note that @code{&key} is not allowed in @var{arglist}, but | 4936 | Note that @code{&key} is not allowed in @var{arglist}, but |
| @@ -4962,16 +4939,31 @@ Note that @code{&key} is not allowed in @var{arglist}, but | |||
| 4962 | Most of the modify macros defined by Common Lisp do not exactly | 4939 | Most of the modify macros defined by Common Lisp do not exactly |
| 4963 | follow the pattern of @code{define-modify-macro}. For example, | 4940 | follow the pattern of @code{define-modify-macro}. For example, |
| 4964 | @code{push} takes its arguments in the wrong order, and @code{pop} | 4941 | @code{push} takes its arguments in the wrong order, and @code{pop} |
| 4965 | is completely irregular. You can define these macros ``by hand'' | 4942 | is completely irregular. |
| 4966 | using @code{get-setf-method}, or consult the source | 4943 | |
| 4967 | to see how to use the internal @code{setf} building blocks. | 4944 | The above @code{incf} example could be written using |
| 4945 | @code{gv-letplace} as: | ||
| 4946 | @example | ||
| 4947 | (defmacro incf (place &optional n) | ||
| 4948 | (gv-letplace (getter setter) place | ||
| 4949 | (macroexp-let2 nil v (or n 1) | ||
| 4950 | (funcall setter `(+ ,v ,getter))))) | ||
| 4951 | @end example | ||
| 4952 | @ignore | ||
| 4953 | (defmacro concatf (place &rest args) | ||
| 4954 | (gv-letplace (getter setter) place | ||
| 4955 | (macroexp-let2 nil v (mapconcat 'identity args "") | ||
| 4956 | (funcall setter `(concat ,getter ,v))))) | ||
| 4957 | @end ignore | ||
| 4968 | @end defmac | 4958 | @end defmac |
| 4969 | 4959 | ||
| 4970 | @defmac defsetf access-fn update-fn | 4960 | @defmac defsetf access-fn update-fn |
| 4971 | This is the simpler of two @code{defsetf} forms. Where | 4961 | This is the simpler of two @code{defsetf} forms, and is |
| 4972 | @var{access-fn} is the name of a function which accesses a place, | 4962 | replaced by @code{gv-define-simple-setter}. |
| 4973 | this declares @var{update-fn} to be the corresponding store | 4963 | |
| 4974 | function. From now on, | 4964 | With @var{access-fn} the name of a function that accesses a place, |
| 4965 | this declares @var{update-fn} to be the corresponding store function. | ||
| 4966 | From now on, | ||
| 4975 | 4967 | ||
| 4976 | @example | 4968 | @example |
| 4977 | (setf (@var{access-fn} @var{arg1} @var{arg2} @var{arg3}) @var{value}) | 4969 | (setf (@var{access-fn} @var{arg1} @var{arg2} @var{arg3}) @var{value}) |
| @@ -4986,13 +4978,13 @@ will be expanded to | |||
| 4986 | 4978 | ||
| 4987 | @noindent | 4979 | @noindent |
| 4988 | The @var{update-fn} is required to be either a true function, or | 4980 | The @var{update-fn} is required to be either a true function, or |
| 4989 | a macro which evaluates its arguments in a function-like way. Also, | 4981 | a macro that evaluates its arguments in a function-like way. Also, |
| 4990 | the @var{update-fn} is expected to return @var{value} as its result. | 4982 | the @var{update-fn} is expected to return @var{value} as its result. |
| 4991 | Otherwise, the above expansion would not obey the rules for the way | 4983 | Otherwise, the above expansion would not obey the rules for the way |
| 4992 | @code{setf} is supposed to behave. | 4984 | @code{setf} is supposed to behave. |
| 4993 | 4985 | ||
| 4994 | As a special (non-Common-Lisp) extension, a third argument of @code{t} | 4986 | As a special (non-Common-Lisp) extension, a third argument of @code{t} |
| 4995 | to @code{defsetf} says that the @code{update-fn}'s return value is | 4987 | to @code{defsetf} says that the return value of @code{update-fn} is |
| 4996 | not suitable, so that the above @code{setf} should be expanded to | 4988 | not suitable, so that the above @code{setf} should be expanded to |
| 4997 | something more like | 4989 | something more like |
| 4998 | 4990 | ||
| @@ -5002,25 +4994,32 @@ something more like | |||
| 5002 | temp) | 4994 | temp) |
| 5003 | @end example | 4995 | @end example |
| 5004 | 4996 | ||
| 5005 | Some examples of the use of @code{defsetf}, drawn from the standard | 4997 | Some examples are: |
| 5006 | suite of setf methods, are: | ||
| 5007 | 4998 | ||
| 5008 | @example | 4999 | @example |
| 5009 | (defsetf car setcar) | 5000 | (defsetf car setcar) |
| 5010 | (defsetf symbol-value set) | ||
| 5011 | (defsetf buffer-name rename-buffer t) | 5001 | (defsetf buffer-name rename-buffer t) |
| 5012 | @end example | 5002 | @end example |
| 5003 | |||
| 5004 | These translate directly to @code{gv-define-simple-setter}: | ||
| 5005 | |||
| 5006 | @example | ||
| 5007 | (gv-define-simple-setter car setcar) | ||
| 5008 | (gv-define-simple-setter buffer-name rename-buffer t) | ||
| 5009 | @end example | ||
| 5013 | @end defmac | 5010 | @end defmac |
| 5014 | 5011 | ||
| 5015 | @defmac defsetf access-fn arglist (store-var) forms@dots{} | 5012 | @defmac defsetf access-fn arglist (store-var) forms@dots{} |
| 5016 | This is the second, more complex, form of @code{defsetf}. It is | 5013 | This is the second, more complex, form of @code{defsetf}. |
| 5017 | rather like @code{defmacro} except for the additional @var{store-var} | 5014 | It can be replaced by @code{gv-define-setter}. |
| 5018 | argument. The @var{forms} should return a Lisp form which stores | 5015 | |
| 5019 | the value of @var{store-var} into the generalized variable formed | 5016 | This form of @code{defsetf} is rather like @code{defmacro} except for |
| 5020 | by a call to @var{access-fn} with arguments described by @var{arglist}. | 5017 | the additional @var{store-var} argument. The @var{forms} should |
| 5021 | The @var{forms} may begin with a string which documents the @code{setf} | 5018 | return a Lisp form that stores the value of @var{store-var} into the |
| 5022 | method (analogous to the doc string that appears at the front of a | 5019 | generalized variable formed by a call to @var{access-fn} with |
| 5023 | function). | 5020 | arguments described by @var{arglist}. The @var{forms} may begin with |
| 5021 | a string which documents the @code{setf} method (analogous to the doc | ||
| 5022 | string that appears at the front of a function). | ||
| 5024 | 5023 | ||
| 5025 | For example, the simple form of @code{defsetf} is shorthand for | 5024 | For example, the simple form of @code{defsetf} is shorthand for |
| 5026 | 5025 | ||
| @@ -5031,23 +5030,32 @@ For example, the simple form of @code{defsetf} is shorthand for | |||
| 5031 | 5030 | ||
| 5032 | The Lisp form that is returned can access the arguments from | 5031 | The Lisp form that is returned can access the arguments from |
| 5033 | @var{arglist} and @var{store-var} in an unrestricted fashion; | 5032 | @var{arglist} and @var{store-var} in an unrestricted fashion; |
| 5034 | macros like @code{setf} and @code{cl-incf} which invoke this | 5033 | macros like @code{cl-incf} that invoke this |
| 5035 | setf-method will insert temporary variables as needed to make | 5034 | setf-method will insert temporary variables as needed to make |
| 5036 | sure the apparent order of evaluation is preserved. | 5035 | sure the apparent order of evaluation is preserved. |
| 5037 | 5036 | ||
| 5038 | Another example drawn from the standard package: | 5037 | Another standard example: |
| 5039 | 5038 | ||
| 5040 | @example | 5039 | @example |
| 5041 | (defsetf nth (n x) (store) | 5040 | (defsetf nth (n x) (store) |
| 5042 | (list 'setcar (list 'nthcdr n x) store)) | 5041 | `(setcar (nthcdr ,n ,x) ,store)) |
| 5042 | @end example | ||
| 5043 | |||
| 5044 | You could write this using @code{gv-define-setter} as: | ||
| 5045 | |||
| 5046 | @example | ||
| 5047 | (gv-define-setter nth (store n x) | ||
| 5048 | `(setcar (nthcdr ,n ,x) ,store)) | ||
| 5043 | @end example | 5049 | @end example |
| 5044 | @end defmac | 5050 | @end defmac |
| 5045 | 5051 | ||
| 5046 | @defmac define-setf-method access-fn arglist forms@dots{} | 5052 | @defmac define-setf-method access-fn arglist forms@dots{} |
| 5047 | This is the most general way to create new place forms. When | 5053 | This is the most general way to create new place forms. You can |
| 5048 | a @code{setf} to @var{access-fn} with arguments described by | 5054 | replace this by @code{gv-define-setter} or @code{gv-define-expander}. |
| 5049 | @var{arglist} is expanded, the @var{forms} are evaluated and | 5055 | |
| 5050 | must return a list of five items: | 5056 | When a @code{setf} to @var{access-fn} with arguments described by |
| 5057 | @var{arglist} is expanded, the @var{forms} are evaluated and must | ||
| 5058 | return a list of five items: | ||
| 5051 | 5059 | ||
| 5052 | @enumerate | 5060 | @enumerate |
| 5053 | @item | 5061 | @item |
| @@ -5063,12 +5071,12 @@ A list of exactly one @dfn{store variable} (generally obtained | |||
| 5063 | from a call to @code{gensym}). | 5071 | from a call to @code{gensym}). |
| 5064 | 5072 | ||
| 5065 | @item | 5073 | @item |
| 5066 | A Lisp form which stores the contents of the store variable into | 5074 | A Lisp form that stores the contents of the store variable into |
| 5067 | the generalized variable, assuming the temporaries have been | 5075 | the generalized variable, assuming the temporaries have been |
| 5068 | bound as described above. | 5076 | bound as described above. |
| 5069 | 5077 | ||
| 5070 | @item | 5078 | @item |
| 5071 | A Lisp form which accesses the contents of the generalized variable, | 5079 | A Lisp form that accesses the contents of the generalized variable, |
| 5072 | assuming the temporaries have been bound. | 5080 | assuming the temporaries have been bound. |
| 5073 | @end enumerate | 5081 | @end enumerate |
| 5074 | 5082 | ||
| @@ -5076,6 +5084,9 @@ This is exactly like the Common Lisp macro of the same name, | |||
| 5076 | except that the method returns a list of five values rather | 5084 | except that the method returns a list of five values rather |
| 5077 | than the five values themselves, since Emacs Lisp does not | 5085 | than the five values themselves, since Emacs Lisp does not |
| 5078 | support Common Lisp's notion of multiple return values. | 5086 | support Common Lisp's notion of multiple return values. |
| 5087 | (Note that the @code{setf} implementation provided by @file{gv.el} | ||
| 5088 | does not use this five item format. Its use here is only for | ||
| 5089 | backwards compatibility.) | ||
| 5079 | 5090 | ||
| 5080 | Once again, the @var{forms} may begin with a documentation string. | 5091 | Once again, the @var{forms} may begin with a documentation string. |
| 5081 | 5092 | ||
| @@ -5084,47 +5095,29 @@ temporary variables. In the setf-methods generated by | |||
| 5084 | @code{defsetf}, the second return value is simply the list of | 5095 | @code{defsetf}, the second return value is simply the list of |
| 5085 | arguments in the place form, and the first return value is a | 5096 | arguments in the place form, and the first return value is a |
| 5086 | list of a corresponding number of temporary variables generated | 5097 | list of a corresponding number of temporary variables generated |
| 5087 | by @code{cl-gensym}. Macros like @code{setf} and @code{cl-incf} which | 5098 | @c FIXME I don't think this is true anymore. |
| 5099 | by @code{cl-gensym}. Macros like @code{cl-incf} that | ||
| 5088 | use this setf-method will optimize away most temporaries that | 5100 | use this setf-method will optimize away most temporaries that |
| 5089 | turn out to be unnecessary, so there is little reason for the | 5101 | turn out to be unnecessary, so there is little reason for the |
| 5090 | setf-method itself to optimize. | 5102 | setf-method itself to optimize. |
| 5091 | @end defmac | 5103 | @end defmac |
| 5092 | 5104 | ||
| 5105 | @c Removed in Emacs 24.3, not possible to make a compatible replacement. | ||
| 5106 | @ignore | ||
| 5093 | @defun get-setf-method place &optional env | 5107 | @defun get-setf-method place &optional env |
| 5094 | This function returns the setf-method for @var{place}, by | 5108 | This function returns the setf-method for @var{place}, by |
| 5095 | invoking the definition previously recorded by @code{defsetf} | 5109 | invoking the definition previously recorded by @code{defsetf} |
| 5096 | or @code{define-setf-method}. The result is a list of five | 5110 | or @code{define-setf-method}. The result is a list of five |
| 5097 | values as described above. You can use this function to build | 5111 | values as described above. You can use this function to build |
| 5098 | your own @code{cl-incf}-like modify macros. (Actually, it is | 5112 | your own @code{cl-incf}-like modify macros. |
| 5099 | @c FIXME? | ||
| 5100 | better to use the internal functions @code{cl-setf-do-modify} | ||
| 5101 | and @code{cl-setf-do-store}, which are a bit easier to use and | ||
| 5102 | which also do a number of optimizations; consult the source | ||
| 5103 | code for the @code{cl-incf} function for a simple example.) | ||
| 5104 | 5113 | ||
| 5105 | The argument @var{env} specifies the ``environment'' to be | 5114 | The argument @var{env} specifies the ``environment'' to be |
| 5106 | passed on to @code{macroexpand} if @code{get-setf-method} should | 5115 | passed on to @code{macroexpand} if @code{get-setf-method} should |
| 5107 | need to expand a macro in @var{place}. It should come from | 5116 | need to expand a macro in @var{place}. It should come from |
| 5108 | an @code{&environment} argument to the macro or setf-method | 5117 | an @code{&environment} argument to the macro or setf-method |
| 5109 | that called @code{get-setf-method}. | 5118 | that called @code{get-setf-method}. |
| 5110 | |||
| 5111 | See also the source code for the setf-method for | ||
| 5112 | @c Also @code{apply}, but that is commented out. | ||
| 5113 | @code{substring}, which works by calling @code{get-setf-method} on a | ||
| 5114 | simpler case, then massaging the result. | ||
| 5115 | @end defun | 5119 | @end defun |
| 5116 | 5120 | @end ignore | |
| 5117 | Modern Common Lisp defines a second, independent way to specify | ||
| 5118 | the @code{setf} behavior of a function, namely ``@code{setf} | ||
| 5119 | functions'' whose names are lists @code{(setf @var{name})} | ||
| 5120 | rather than symbols. For example, @code{(defun (setf foo) @dots{})} | ||
| 5121 | defines the function that is used when @code{setf} is applied to | ||
| 5122 | @code{foo}. This package does not currently support @code{setf} | ||
| 5123 | functions. In particular, it is a compile-time error to use | ||
| 5124 | @code{setf} on a form which has not already been @code{defsetf}'d | ||
| 5125 | or otherwise declared; in newer Common Lisps, this would not be | ||
| 5126 | an error since the function @code{(setf @var{func})} might be | ||
| 5127 | defined later. | ||
| 5128 | 5121 | ||
| 5129 | 5122 | ||
| 5130 | @node GNU Free Documentation License | 5123 | @node GNU Free Documentation License |
diff --git a/doc/misc/flymake.texi b/doc/misc/flymake.texi index 28fb7864f06..4a873490e86 100644 --- a/doc/misc/flymake.texi +++ b/doc/misc/flymake.texi | |||
| @@ -337,6 +337,17 @@ been reported. | |||
| 337 | A custom face for highlighting lines for which at least one warning | 337 | A custom face for highlighting lines for which at least one warning |
| 338 | and no errors have been reported. | 338 | and no errors have been reported. |
| 339 | 339 | ||
| 340 | @item flymake-error-bitmap | ||
| 341 | A bitmap used in the fringe to mark lines for which an error has | ||
| 342 | been reported. | ||
| 343 | |||
| 344 | @item flymake-warning-bitmap | ||
| 345 | A bitmap used in the fringe to mark lines for which a warning has | ||
| 346 | been reported. | ||
| 347 | |||
| 348 | @item flymake-fringe-indicator-position | ||
| 349 | Which fringe (if any) should show the warning/error bitmaps. | ||
| 350 | |||
| 340 | @end table | 351 | @end table |
| 341 | 352 | ||
| 342 | @node Adding support for a new syntax check tool | 353 | @node Adding support for a new syntax check tool |
| @@ -718,6 +729,15 @@ are used: @code{flymake-errline} and | |||
| 718 | @code{flymake-warnline}. Errors belonging outside the current | 729 | @code{flymake-warnline}. Errors belonging outside the current |
| 719 | buffer are considered to belong to line 1 of the current buffer. | 730 | buffer are considered to belong to line 1 of the current buffer. |
| 720 | 731 | ||
| 732 | @c This manual does not use vindex. | ||
| 733 | @c @vindex flymake-fringe-indicator-position | ||
| 734 | @c @vindex flymake-error-bitmap | ||
| 735 | @c @vindex flymake-warning-bitmap | ||
| 736 | If the option @code{flymake-fringe-indicator-position} is non-@code{nil}, | ||
| 737 | errors and warnings are also highlighted in the left or right fringe, | ||
| 738 | using the bitmaps specified by @code{flymake-error-bitmap} | ||
| 739 | and @code{flymake-warning-bitmap}. | ||
| 740 | |||
| 721 | @node Interaction with other modes | 741 | @node Interaction with other modes |
| 722 | @section Interaction with other modes | 742 | @section Interaction with other modes |
| 723 | @cindex Interaction with other modes | 743 | @cindex Interaction with other modes |
diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index a9cd0d3567c..47ff355d946 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi | |||
| @@ -14759,20 +14759,37 @@ This can be either the symbol @code{password} or the symbol @code{apop} | |||
| 14759 | and says what authentication scheme to use. The default is | 14759 | and says what authentication scheme to use. The default is |
| 14760 | @code{password}. | 14760 | @code{password}. |
| 14761 | 14761 | ||
| 14762 | @item :leave | ||
| 14763 | Non-@code{nil} if the mail is to be left on the @acronym{POP} server | ||
| 14764 | after fetching. Mails once fetched will never be fetched again by the | ||
| 14765 | @acronym{UIDL} control. Only the built-in @code{pop3-movemail} program | ||
| 14766 | (the default) supports this keyword. | ||
| 14767 | |||
| 14768 | If this is neither @code{nil} nor a number, all mails will be left on | ||
| 14769 | the server. If this is a number, leave mails on the server for this | ||
| 14770 | many days since you first checked new mails. If this is @code{nil} | ||
| 14771 | (the default), mails will be deleted on the server right after fetching. | ||
| 14772 | |||
| 14773 | @vindex pop3-uidl-file | ||
| 14774 | The @code{pop3-uidl-file} variable specifies the file to which the | ||
| 14775 | @acronym{UIDL} data are locally stored. The default value is | ||
| 14776 | @file{~/.pop3-uidl}. | ||
| 14777 | |||
| 14778 | Note that @acronym{POP} servers maintain no state information between | ||
| 14779 | sessions, so what the client believes is there and what is actually | ||
| 14780 | there may not match up. If they do not, then you may get duplicate | ||
| 14781 | mails or the whole thing can fall apart and leave you with a corrupt | ||
| 14782 | mailbox. | ||
| 14783 | |||
| 14762 | @end table | 14784 | @end table |
| 14763 | 14785 | ||
| 14764 | @vindex pop3-movemail | 14786 | @findex pop3-movemail |
| 14765 | @vindex pop3-leave-mail-on-server | 14787 | @vindex pop3-leave-mail-on-server |
| 14766 | If the @code{:program} and @code{:function} keywords aren't specified, | 14788 | If the @code{:program} and @code{:function} keywords aren't specified, |
| 14767 | @code{pop3-movemail} will be used. If @code{pop3-leave-mail-on-server} | 14789 | @code{pop3-movemail} will be used. |
| 14768 | is non-@code{nil} the mail is to be left on the @acronym{POP} server | ||
| 14769 | after fetching when using @code{pop3-movemail}. Note that POP servers | ||
| 14770 | maintain no state information between sessions, so what the client | ||
| 14771 | believes is there and what is actually there may not match up. If they | ||
| 14772 | do not, then you may get duplicate mails or the whole thing can fall | ||
| 14773 | apart and leave you with a corrupt mailbox. | ||
| 14774 | 14790 | ||
| 14775 | Here are some examples for getting mail from a @acronym{POP} server. | 14791 | Here are some examples for getting mail from a @acronym{POP} server. |
| 14792 | |||
| 14776 | Fetch from the default @acronym{POP} server, using the default user | 14793 | Fetch from the default @acronym{POP} server, using the default user |
| 14777 | name, and default fetcher: | 14794 | name, and default fetcher: |
| 14778 | 14795 | ||
| @@ -14787,6 +14804,14 @@ Fetch from a named server with a named user and password: | |||
| 14787 | :user "user-name" :password "secret") | 14804 | :user "user-name" :password "secret") |
| 14788 | @end lisp | 14805 | @end lisp |
| 14789 | 14806 | ||
| 14807 | Leave mails on the server for 14 days: | ||
| 14808 | |||
| 14809 | @lisp | ||
| 14810 | (pop :server "my.pop.server" | ||
| 14811 | :user "user-name" :password "secret" | ||
| 14812 | :leave 14) | ||
| 14813 | @end lisp | ||
| 14814 | |||
| 14790 | Use @samp{movemail} to move the mail: | 14815 | Use @samp{movemail} to move the mail: |
| 14791 | 14816 | ||
| 14792 | @lisp | 14817 | @lisp |
diff --git a/doc/misc/ses.texi b/doc/misc/ses.texi index a70bb9c407e..5de87a2f1c7 100644 --- a/doc/misc/ses.texi +++ b/doc/misc/ses.texi | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | \input texinfo @c -*-texinfo-*- | 1 | \input texinfo @c -*-texinfo-*- |
| 2 | @c %**start of header | 2 | @c %**start of header |
| 3 | @setfilename ../../info/ses | 3 | @setfilename ../../info/ses |
| 4 | @settitle SES: Simple Emacs Spreadsheet | 4 | @settitle @acronym{SES}: Simple Emacs Spreadsheet |
| 5 | @setchapternewpage off | 5 | @setchapternewpage off |
| 6 | @syncodeindex fn cp | 6 | @syncodeindex fn cp |
| 7 | @syncodeindex vr cp | 7 | @syncodeindex vr cp |
| @@ -9,7 +9,7 @@ | |||
| 9 | @c %**end of header | 9 | @c %**end of header |
| 10 | 10 | ||
| 11 | @copying | 11 | @copying |
| 12 | This file documents SES: the Simple Emacs Spreadsheet. | 12 | This file documents @acronym{SES}: the Simple Emacs Spreadsheet. |
| 13 | 13 | ||
| 14 | Copyright @copyright{} 2002-2012 Free Software Foundation, Inc. | 14 | Copyright @copyright{} 2002-2012 Free Software Foundation, Inc. |
| 15 | 15 | ||
| @@ -29,13 +29,13 @@ developing GNU and promoting software freedom.'' | |||
| 29 | 29 | ||
| 30 | @dircategory Emacs misc features | 30 | @dircategory Emacs misc features |
| 31 | @direntry | 31 | @direntry |
| 32 | * SES: (ses). Simple Emacs Spreadsheet. | 32 | * @acronym{SES}: (ses). Simple Emacs Spreadsheet. |
| 33 | @end direntry | 33 | @end direntry |
| 34 | 34 | ||
| 35 | @finalout | 35 | @finalout |
| 36 | 36 | ||
| 37 | @titlepage | 37 | @titlepage |
| 38 | @title SES | 38 | @title @acronym{SES} |
| 39 | @subtitle Simple Emacs Spreadsheet | 39 | @subtitle Simple Emacs Spreadsheet |
| 40 | @author Jonathan A. Yavner | 40 | @author Jonathan A. Yavner |
| 41 | @author @email{jyavner@@member.fsf.org} | 41 | @author @email{jyavner@@member.fsf.org} |
| @@ -52,10 +52,10 @@ developing GNU and promoting software freedom.'' | |||
| 52 | @ifnottex | 52 | @ifnottex |
| 53 | @node Top, Sales Pitch, (dir), (dir) | 53 | @node Top, Sales Pitch, (dir), (dir) |
| 54 | @comment node-name, next, previous, up | 54 | @comment node-name, next, previous, up |
| 55 | @top SES: Simple Emacs Spreadsheet | 55 | @top @acronym{SES}: Simple Emacs Spreadsheet |
| 56 | 56 | ||
| 57 | @display | 57 | @display |
| 58 | SES is a major mode for GNU Emacs to edit spreadsheet files, which | 58 | @acronym{SES} is a major mode for GNU Emacs to edit spreadsheet files, which |
| 59 | contain a rectangular grid of cells. The cells' values are specified | 59 | contain a rectangular grid of cells. The cells' values are specified |
| 60 | by formulas that can refer to the values of other cells. | 60 | by formulas that can refer to the values of other cells. |
| 61 | @end display | 61 | @end display |
| @@ -66,7 +66,7 @@ To report bugs, send email to @email{jyavner@@member.fsf.org}. | |||
| 66 | @insertcopying | 66 | @insertcopying |
| 67 | 67 | ||
| 68 | @menu | 68 | @menu |
| 69 | * Sales Pitch:: Why use SES? | 69 | * Sales Pitch:: Why use @acronym{SES}? |
| 70 | * The Basics:: Basic spreadsheet commands | 70 | * The Basics:: Basic spreadsheet commands |
| 71 | * Advanced Features:: Want to know more? | 71 | * Advanced Features:: Want to know more? |
| 72 | * For Gurus:: Want to know @emph{even more}? | 72 | * For Gurus:: Want to know @emph{even more}? |
| @@ -126,9 +126,9 @@ Moves point to cell, specified by identifier (@code{ses-jump}). | |||
| 126 | 126 | ||
| 127 | Point is always at the left edge of a cell, or at the empty endline. | 127 | Point is always at the left edge of a cell, or at the empty endline. |
| 128 | When mark is inactive, the current cell is underlined. When mark is | 128 | When mark is inactive, the current cell is underlined. When mark is |
| 129 | active, the range is the highlighted rectangle of cells (SES always | 129 | active, the range is the highlighted rectangle of cells (@acronym{SES} always |
| 130 | uses transient mark mode). Drag the mouse from A1 to A3 to create the | 130 | uses transient mark mode). Drag the mouse from A1 to A3 to create the |
| 131 | range A1-A2. Many SES commands operate only on single cells, not | 131 | range A1-A2. Many @acronym{SES} commands operate only on single cells, not |
| 132 | ranges. | 132 | ranges. |
| 133 | 133 | ||
| 134 | @table @kbd | 134 | @table @kbd |
| @@ -155,7 +155,7 @@ Highlight all cells (@code{mark-whole-buffer}). | |||
| 155 | * Printer functions:: | 155 | * Printer functions:: |
| 156 | * Clearing cells:: | 156 | * Clearing cells:: |
| 157 | * Copy/cut/paste:: | 157 | * Copy/cut/paste:: |
| 158 | * Customizing SES:: | 158 | * Customizing @acronym{SES}:: |
| 159 | @end menu | 159 | @end menu |
| 160 | 160 | ||
| 161 | @node Formulas, Resizing, The Basics, The Basics | 161 | @node Formulas, Resizing, The Basics, The Basics |
| @@ -192,7 +192,7 @@ this cell's formula will be reevaluated. While typing in the | |||
| 192 | expression, you can use @kbd{M-@key{TAB}} to complete symbol names. | 192 | expression, you can use @kbd{M-@key{TAB}} to complete symbol names. |
| 193 | 193 | ||
| 194 | @item ' @r{(apostrophe)} | 194 | @item ' @r{(apostrophe)} |
| 195 | Enter a symbol (ses-read-symbol). SES remembers all symbols that have | 195 | Enter a symbol (ses-read-symbol). @acronym{SES} remembers all symbols that have |
| 196 | been used as formulas, so you can type just the beginning of a symbol | 196 | been used as formulas, so you can type just the beginning of a symbol |
| 197 | and use @kbd{@key{SPC}}, @kbd{@key{TAB}}, and @kbd{?} to complete it. | 197 | and use @kbd{@key{SPC}}, @kbd{@key{TAB}}, and @kbd{?} to complete it. |
| 198 | @end table | 198 | @end table |
| @@ -349,7 +349,7 @@ Clear cell and move right (@code{ses-clear-cell-forward}). | |||
| 349 | @end table | 349 | @end table |
| 350 | 350 | ||
| 351 | 351 | ||
| 352 | @node Copy/cut/paste, Customizing SES, Clearing cells, The Basics | 352 | @node Copy/cut/paste, Customizing @acronym{SES}, Clearing cells, The Basics |
| 353 | @section Copy, cut, and paste | 353 | @section Copy, cut, and paste |
| 354 | @cindex copy | 354 | @cindex copy |
| 355 | @cindex cut | 355 | @cindex cut |
| @@ -365,7 +365,7 @@ Clear cell and move right (@code{ses-clear-cell-forward}). | |||
| 365 | @findex ses-yank-pop | 365 | @findex ses-yank-pop |
| 366 | 366 | ||
| 367 | The copy functions work on rectangular regions of cells. You can paste the | 367 | The copy functions work on rectangular regions of cells. You can paste the |
| 368 | copies into non-SES buffers to export the print text. | 368 | copies into non-@acronym{SES} buffers to export the print text. |
| 369 | 369 | ||
| 370 | @table @kbd | 370 | @table @kbd |
| 371 | @item M-w | 371 | @item M-w |
| @@ -394,7 +394,7 @@ Paste from kill ring (@code{yank}). The paste functions behave | |||
| 394 | differently depending on the format of the text being inserted: | 394 | differently depending on the format of the text being inserted: |
| 395 | @itemize @bullet | 395 | @itemize @bullet |
| 396 | @item | 396 | @item |
| 397 | When pasting cells that were cut from a SES buffer, the print text is | 397 | When pasting cells that were cut from a @acronym{SES} buffer, the print text is |
| 398 | ignored and only the attached formula and printer are inserted; cell | 398 | ignored and only the attached formula and printer are inserted; cell |
| 399 | references in the formula are relocated unless you use @kbd{C-u}. | 399 | references in the formula are relocated unless you use @kbd{C-u}. |
| 400 | @item | 400 | @item |
| @@ -402,7 +402,7 @@ The pasted text overwrites a rectangle of cells whose top left corner | |||
| 402 | is the current cell. If part of the rectangle is beyond the edges of | 402 | is the current cell. If part of the rectangle is beyond the edges of |
| 403 | the spreadsheet, you must confirm the increase in spreadsheet size. | 403 | the spreadsheet, you must confirm the increase in spreadsheet size. |
| 404 | @item | 404 | @item |
| 405 | Non-SES text is usually inserted as a replacement formula for the | 405 | Non-@acronym{SES} text is usually inserted as a replacement formula for the |
| 406 | current cell. If the formula would be a symbol, it's treated as a | 406 | current cell. If the formula would be a symbol, it's treated as a |
| 407 | string unless you use @kbd{C-u}. Pasted formulas with syntax errors | 407 | string unless you use @kbd{C-u}. Pasted formulas with syntax errors |
| 408 | are always treated as strings. | 408 | are always treated as strings. |
| @@ -420,12 +420,12 @@ Set point and paste from secondary clipboard (@code{mouse-yank-secondary}). | |||
| 420 | @item M-y | 420 | @item M-y |
| 421 | Immediately after a paste, you can replace the text with a preceding | 421 | Immediately after a paste, you can replace the text with a preceding |
| 422 | element from the kill ring (@code{ses-yank-pop}). Unlike the standard | 422 | element from the kill ring (@code{ses-yank-pop}). Unlike the standard |
| 423 | Emacs yank-pop, the SES version uses @code{undo} to delete the old | 423 | Emacs yank-pop, the @acronym{SES} version uses @code{undo} to delete the old |
| 424 | yank. This doesn't make any difference? | 424 | yank. This doesn't make any difference? |
| 425 | @end table | 425 | @end table |
| 426 | 426 | ||
| 427 | @node Customizing SES, , Copy/cut/paste, The Basics | 427 | @node Customizing @acronym{SES}, , Copy/cut/paste, The Basics |
| 428 | @section Customizing SES | 428 | @section Customizing @acronym{SES} |
| 429 | @cindex customizing | 429 | @cindex customizing |
| 430 | @vindex enable-local-eval | 430 | @vindex enable-local-eval |
| 431 | @vindex ses-mode-hook | 431 | @vindex ses-mode-hook |
| @@ -443,7 +443,7 @@ up or down. For diagonal movement, select two functions from the | |||
| 443 | list. | 443 | list. |
| 444 | 444 | ||
| 445 | @code{ses-mode-hook} is a normal mode hook (list of functions to | 445 | @code{ses-mode-hook} is a normal mode hook (list of functions to |
| 446 | execute when starting SES mode for a buffer). | 446 | execute when starting @acronym{SES} mode for a buffer). |
| 447 | 447 | ||
| 448 | The variable @code{safe-functions} is a list of possibly-unsafe | 448 | The variable @code{safe-functions} is a list of possibly-unsafe |
| 449 | functions to be treated as safe when analyzing formulas and printers. | 449 | functions to be treated as safe when analyzing formulas and printers. |
| @@ -469,7 +469,10 @@ safety belts! | |||
| 469 | 469 | ||
| 470 | @table @kbd | 470 | @table @kbd |
| 471 | @item C-c M-C-h | 471 | @item C-c M-C-h |
| 472 | (@code{ses-set-header-row}). The header line at the top of the SES | 472 | (@code{ses-set-header-row}). |
| 473 | @findex ses-set-header-row | ||
| 474 | @kindex C-c M-C-h | ||
| 475 | The header line at the top of the @acronym{SES} | ||
| 473 | window normally shows the column letter for each column. You can set | 476 | window normally shows the column letter for each column. You can set |
| 474 | it to show a copy of some row, such as a row of column titles, so that | 477 | it to show a copy of some row, such as a row of column titles, so that |
| 475 | row will always be visible. Default is to set the current row as the | 478 | row will always be visible. Default is to set the current row as the |
| @@ -478,6 +481,16 @@ show column letters again. | |||
| 478 | @item [header-line mouse-3] | 481 | @item [header-line mouse-3] |
| 479 | Pops up a menu to set the current row as the header, or revert to | 482 | Pops up a menu to set the current row as the header, or revert to |
| 480 | column letters. | 483 | column letters. |
| 484 | @item M-x ses-rename-cell | ||
| 485 | @findex ses-rename-cell | ||
| 486 | Rename a cell from a standard A1-like name to any | ||
| 487 | string. | ||
| 488 | @item M-x ses-repair-cell-reference-all | ||
| 489 | @findex ses-repair-cell-reference-all | ||
| 490 | When you interrupt a cell formula update by clicking @kbd{C-g}, then | ||
| 491 | the cell reference link may be broken, which will jeopardize automatic | ||
| 492 | cell update when any other cell on which it depends is changed. To | ||
| 493 | repair that use function @code{ses-repair-cell-reference-all} | ||
| 481 | @end table | 494 | @end table |
| 482 | 495 | ||
| 483 | @menu | 496 | @menu |
| @@ -498,9 +511,9 @@ column letters. | |||
| 498 | @findex ses-renarrow-buffer | 511 | @findex ses-renarrow-buffer |
| 499 | @findex ses-reprint-all | 512 | @findex ses-reprint-all |
| 500 | 513 | ||
| 501 | A SES file consists of a print area and a data area. Normally the | 514 | A @acronym{SES} file consists of a print area and a data area. Normally the |
| 502 | buffer is narrowed to show only the print area. The print area is | 515 | buffer is narrowed to show only the print area. The print area is |
| 503 | read-only except for special SES commands; it contains cell values | 516 | read-only except for special @acronym{SES} commands; it contains cell values |
| 504 | formatted by printer functions. The data area records the formula and | 517 | formatted by printer functions. The data area records the formula and |
| 505 | printer functions, etc. | 518 | printer functions, etc. |
| 506 | 519 | ||
| @@ -576,6 +589,52 @@ If you insert a new row just beyond the end of a one-column range, or | |||
| 576 | a new column just beyond a one-row range, the new cell is included in | 589 | a new column just beyond a one-row range, the new cell is included in |
| 577 | the range. New cells inserted just before a range are not included. | 590 | the range. New cells inserted just before a range are not included. |
| 578 | 591 | ||
| 592 | Flags can be added to @code{ses-range} immediately after the @var{to} | ||
| 593 | cell. | ||
| 594 | @table @code | ||
| 595 | @item ! | ||
| 596 | Empty cells in range can be removed by adding the @code{!} flag. An | ||
| 597 | empty cell is a cell the value of which is one of symbols @code{nil} | ||
| 598 | or @code{*skip*}. For instance @code{(ses-range A1 A4 !)} will do the | ||
| 599 | same as @code{(list A1 A3)} when cells @code{A2} and @code{A4} are | ||
| 600 | empty. | ||
| 601 | @item _ | ||
| 602 | Empty cell values are replaced by the argument following flag | ||
| 603 | @code{_}, or @code{0} when flag @code{_} is last in argument list. For | ||
| 604 | instance @code{(ses-range A1 A4 _ "empty")} will do the same as | ||
| 605 | @code{(list A1 "empty" A3 "empty")} when cells @code{A2} and @code{A4} | ||
| 606 | are empty. Similarly, @code{(ses-range A1 A4 _ )} will do the same as | ||
| 607 | @code{(list A1 0 A3 0)}. | ||
| 608 | @item >v | ||
| 609 | When order matters, list cells by reading cells rowwise from top left | ||
| 610 | to bottom right. This flag is provided for completeness only as it is | ||
| 611 | the default reading order. | ||
| 612 | @item <v | ||
| 613 | List cells by reading cells rowwise from top right to bottom left. | ||
| 614 | @item v> | ||
| 615 | List cells by reading cells columnwise from top left to bottom right. | ||
| 616 | @item v< | ||
| 617 | List cells by reading cells columnwise from top right to bottom left. | ||
| 618 | @item v | ||
| 619 | A short hand for @code{v>}. | ||
| 620 | @item ^ | ||
| 621 | A short hand for @code{^>}. | ||
| 622 | @item > | ||
| 623 | A short hand for @code{>v}. | ||
| 624 | @item < | ||
| 625 | A short hand for @code{>^}. | ||
| 626 | @item * | ||
| 627 | Instead of listing cells, it makes a Calc vector or matrix of it | ||
| 628 | (@pxref{Top,,,calc,GNU Emacs Calc Manual}). If the range contains only | ||
| 629 | one row or one column a vector is made, otherwise a matrix is made. | ||
| 630 | @item *2 | ||
| 631 | Same as @code{*} except that a matrix is always made even when there | ||
| 632 | is only one row or column in the range. | ||
| 633 | @item *1 | ||
| 634 | Same as @code{*} except that a vector is always made even when there | ||
| 635 | is only one row or column in the range, that is to say the | ||
| 636 | corresponding matrix is flattened. | ||
| 637 | @end table | ||
| 579 | 638 | ||
| 580 | @node Sorting by column, Standard formula functions, Ranges in formulas, Advanced Features | 639 | @node Sorting by column, Standard formula functions, Ranges in formulas, Advanced Features |
| 581 | @section Sorting by column | 640 | @section Sorting by column |
| @@ -653,7 +712,7 @@ the result is too wide for the available space (up to the end of the | |||
| 653 | row or the next non-@code{nil} cell), the result is truncated if the cell's | 712 | row or the next non-@code{nil} cell), the result is truncated if the cell's |
| 654 | value is a string, or replaced with hash marks otherwise. | 713 | value is a string, or replaced with hash marks otherwise. |
| 655 | 714 | ||
| 656 | SES could get confused by printer results that contain newlines or | 715 | @acronym{SES} could get confused by printer results that contain newlines or |
| 657 | tabs, so these are replaced with question marks. | 716 | tabs, so these are replaced with question marks. |
| 658 | 717 | ||
| 659 | @table @kbd | 718 | @table @kbd |
| @@ -734,7 +793,7 @@ for more info on how Lisp forms are classified as safe or unsafe. | |||
| 734 | A common organization for spreadsheets is to have a bunch of ``detail'' | 793 | A common organization for spreadsheets is to have a bunch of ``detail'' |
| 735 | rows, each perhaps describing a transaction, and then a set of | 794 | rows, each perhaps describing a transaction, and then a set of |
| 736 | ``summary'' rows that each show reduced data for some subset of the | 795 | ``summary'' rows that each show reduced data for some subset of the |
| 737 | details. SES supports this organization via the @code{ses-select} | 796 | details. @acronym{SES} supports this organization via the @code{ses-select} |
| 738 | function. | 797 | function. |
| 739 | 798 | ||
| 740 | @table @code | 799 | @table @code |
| @@ -771,7 +830,7 @@ details-and-summary spreadsheet. | |||
| 771 | * Nonrelocatable references:: | 830 | * Nonrelocatable references:: |
| 772 | * The data area:: | 831 | * The data area:: |
| 773 | * Buffer-local variables in spreadsheets:: | 832 | * Buffer-local variables in spreadsheets:: |
| 774 | * Uses of defadvice in SES:: | 833 | * Uses of defadvice in @acronym{SES}:: |
| 775 | @end menu | 834 | @end menu |
| 776 | 835 | ||
| 777 | @node Deferred updates, Nonrelocatable references, For Gurus, For Gurus | 836 | @node Deferred updates, Nonrelocatable references, For Gurus, For Gurus |
| @@ -799,7 +858,7 @@ progress message of the form ``Writing... (@var{nnn} cells left)''. | |||
| 799 | These deferred cell-writes cannot be interrupted by @kbd{C-g}, so | 858 | These deferred cell-writes cannot be interrupted by @kbd{C-g}, so |
| 800 | you'll just have to wait. | 859 | you'll just have to wait. |
| 801 | 860 | ||
| 802 | SES uses @code{run-with-idle-timer} to move the cell underline when | 861 | @acronym{SES} uses @code{run-with-idle-timer} to move the cell underline when |
| 803 | Emacs will be scrolling the buffer after the end of a command, and | 862 | Emacs will be scrolling the buffer after the end of a command, and |
| 804 | also to narrow and underline after @kbd{C-x C-v}. This is visible as | 863 | also to narrow and underline after @kbd{C-x C-v}. This is visible as |
| 805 | a momentary glitch after C-x C-v and certain scrolling commands. You | 864 | a momentary glitch after C-x C-v and certain scrolling commands. You |
| @@ -843,14 +902,14 @@ Begins with an 014 character, followed by sets of cell-definition | |||
| 843 | macros for each row, followed by column-widths, column-printers, | 902 | macros for each row, followed by column-widths, column-printers, |
| 844 | default-printer, and header-row. Then there's the global parameters | 903 | default-printer, and header-row. Then there's the global parameters |
| 845 | (file-format ID, numrows, numcols) and the local variables (specifying | 904 | (file-format ID, numrows, numcols) and the local variables (specifying |
| 846 | SES mode for the buffer, etc.) | 905 | @acronym{SES} mode for the buffer, etc.) |
| 847 | 906 | ||
| 848 | When a SES file is loaded, first the numrows and numcols values are | 907 | When a @acronym{SES} file is loaded, first the numrows and numcols values are |
| 849 | loaded, then the entire data area is @code{eval}ed, and finally the local | 908 | loaded, then the entire data area is @code{eval}ed, and finally the local |
| 850 | variables are processed. | 909 | variables are processed. |
| 851 | 910 | ||
| 852 | You can edit the data area, but don't insert or delete any newlines | 911 | You can edit the data area, but don't insert or delete any newlines |
| 853 | except in the local-variables part, since SES locates things by | 912 | except in the local-variables part, since @acronym{SES} locates things by |
| 854 | counting newlines. Use @kbd{C-x C-e} at the end of a line to install | 913 | counting newlines. Use @kbd{C-x C-e} at the end of a line to install |
| 855 | your edits into the spreadsheet data structures (this does not update | 914 | your edits into the spreadsheet data structures (this does not update |
| 856 | the print area, use e.g. @kbd{C-c C-l} for that). | 915 | the print area, use e.g. @kbd{C-c C-l} for that). |
| @@ -866,7 +925,7 @@ data structures: | |||
| 866 | @end table | 925 | @end table |
| 867 | 926 | ||
| 868 | 927 | ||
| 869 | @node Buffer-local variables in spreadsheets, Uses of defadvice in SES, The data area, For Gurus | 928 | @node Buffer-local variables in spreadsheets, Uses of defadvice in @acronym{SES}, The data area, For Gurus |
| 870 | @section Buffer-local variables in spreadsheets | 929 | @section Buffer-local variables in spreadsheets |
| 871 | @cindex buffer-local variables | 930 | @cindex buffer-local variables |
| 872 | @cindex variables, buffer-local | 931 | @cindex variables, buffer-local |
| @@ -900,8 +959,8 @@ avoid virus warnings, each function used in a formula needs | |||
| 900 | (put 'your-function-name 'safe-function t) | 959 | (put 'your-function-name 'safe-function t) |
| 901 | @end lisp | 960 | @end lisp |
| 902 | 961 | ||
| 903 | @node Uses of defadvice in SES, , Buffer-local variables in spreadsheets, For Gurus | 962 | @node Uses of defadvice in @acronym{SES}, , Buffer-local variables in spreadsheets, For Gurus |
| 904 | @section Uses of defadvice in SES | 963 | @section Uses of defadvice in @acronym{SES} |
| 905 | @cindex defadvice | 964 | @cindex defadvice |
| 906 | @cindex undo-more | 965 | @cindex undo-more |
| 907 | @cindex copy-region-as-kill | 966 | @cindex copy-region-as-kill |
diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex index f3093d0853f..b5f31415771 100644 --- a/doc/misc/texinfo.tex +++ b/doc/misc/texinfo.tex | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | % Load plain if necessary, i.e., if running under initex. | 3 | % Load plain if necessary, i.e., if running under initex. |
| 4 | \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi | 4 | \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi |
| 5 | % | 5 | % |
| 6 | \def\texinfoversion{2012-09-12.16} | 6 | \def\texinfoversion{2012-11-08.11} |
| 7 | % | 7 | % |
| 8 | % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, | 8 | % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, |
| 9 | % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, | 9 | % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, |
| @@ -6559,16 +6559,9 @@ end | |||
| 6559 | \makedispenvdef{quotation}{\quotationstart} | 6559 | \makedispenvdef{quotation}{\quotationstart} |
| 6560 | % | 6560 | % |
| 6561 | \def\quotationstart{% | 6561 | \def\quotationstart{% |
| 6562 | {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip | 6562 | \indentedblockstart % same as \indentedblock, but increase right margin too. |
| 6563 | \parindent=0pt | ||
| 6564 | % | ||
| 6565 | % @cartouche defines \nonarrowing to inhibit narrowing at next level down. | ||
| 6566 | \ifx\nonarrowing\relax | 6563 | \ifx\nonarrowing\relax |
| 6567 | \advance\leftskip by \lispnarrowing | ||
| 6568 | \advance\rightskip by \lispnarrowing | 6564 | \advance\rightskip by \lispnarrowing |
| 6569 | \exdentamount = \lispnarrowing | ||
| 6570 | \else | ||
| 6571 | \let\nonarrowing = \relax | ||
| 6572 | \fi | 6565 | \fi |
| 6573 | \parsearg\quotationlabel | 6566 | \parsearg\quotationlabel |
| 6574 | } | 6567 | } |
| @@ -6594,6 +6587,32 @@ end | |||
| 6594 | \fi | 6587 | \fi |
| 6595 | } | 6588 | } |
| 6596 | 6589 | ||
| 6590 | % @indentedblock is like @quotation, but indents only on the left and | ||
| 6591 | % has no optional argument. | ||
| 6592 | % | ||
| 6593 | \makedispenvdef{indentedblock}{\indentedblockstart} | ||
| 6594 | % | ||
| 6595 | \def\indentedblockstart{% | ||
| 6596 | {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip | ||
| 6597 | \parindent=0pt | ||
| 6598 | % | ||
| 6599 | % @cartouche defines \nonarrowing to inhibit narrowing at next level down. | ||
| 6600 | \ifx\nonarrowing\relax | ||
| 6601 | \advance\leftskip by \lispnarrowing | ||
| 6602 | \exdentamount = \lispnarrowing | ||
| 6603 | \else | ||
| 6604 | \let\nonarrowing = \relax | ||
| 6605 | \fi | ||
| 6606 | } | ||
| 6607 | |||
| 6608 | % Keep a nonzero parskip for the environment, since we're doing normal filling. | ||
| 6609 | % | ||
| 6610 | \def\Eindentedblock{% | ||
| 6611 | \par | ||
| 6612 | {\parskip=0pt \afterenvbreak}% | ||
| 6613 | } | ||
| 6614 | \def\Esmallindentedblock{\Eindentedblock} | ||
| 6615 | |||
| 6597 | 6616 | ||
| 6598 | % LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>} | 6617 | % LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>} |
| 6599 | % If we want to allow any <char> as delimiter, | 6618 | % If we want to allow any <char> as delimiter, |
diff --git a/doc/misc/url.texi b/doc/misc/url.texi index 898a9994a86..fdb3ab452f2 100644 --- a/doc/misc/url.texi +++ b/doc/misc/url.texi | |||
| @@ -18,7 +18,7 @@ | |||
| 18 | @end direntry | 18 | @end direntry |
| 19 | 19 | ||
| 20 | @copying | 20 | @copying |
| 21 | This file documents the Emacs Lisp URL loading package. | 21 | This is the manual for the @code{url} Emacs Lisp library. |
| 22 | 22 | ||
| 23 | Copyright @copyright{} 1993-1999, 2002, 2004-2012 Free Software Foundation, Inc. | 23 | Copyright @copyright{} 1993-1999, 2002, 2004-2012 Free Software Foundation, Inc. |
| 24 | 24 | ||
| @@ -57,10 +57,10 @@ developing GNU and promoting software freedom.'' | |||
| 57 | @end ifnottex | 57 | @end ifnottex |
| 58 | 58 | ||
| 59 | @menu | 59 | @menu |
| 60 | * Getting Started:: Preparing your program to use URLs. | 60 | * Introduction:: About the @code{url} library. |
| 61 | * URI Parsing:: Parsing (and unparsing) URIs. | ||
| 61 | * Retrieving URLs:: How to use this package to retrieve a URL. | 62 | * Retrieving URLs:: How to use this package to retrieve a URL. |
| 62 | * Supported URL Types:: Descriptions of URL types currently supported. | 63 | * Supported URL Types:: Descriptions of URL types currently supported. |
| 63 | * Defining New URLs:: How to define a URL loader for a new protocol. | ||
| 64 | * General Facilities:: URLs can be cached, accessed via a gateway | 64 | * General Facilities:: URLs can be cached, accessed via a gateway |
| 65 | and tracked in a history list. | 65 | and tracked in a history list. |
| 66 | * Customization:: Variables you can alter. | 66 | * Customization:: Variables you can alter. |
| @@ -70,93 +70,129 @@ developing GNU and promoting software freedom.'' | |||
| 70 | * Concept Index:: | 70 | * Concept Index:: |
| 71 | @end menu | 71 | @end menu |
| 72 | 72 | ||
| 73 | @node Getting Started | 73 | @node Introduction |
| 74 | @chapter Getting Started | 74 | @chapter Introduction |
| 75 | @cindex URLs, definition | 75 | @cindex URL |
| 76 | @cindex URIs | 76 | @cindex URI |
| 77 | @cindex uniform resource identifier | ||
| 78 | @cindex uniform resource locator | ||
| 77 | 79 | ||
| 78 | @dfn{Uniform Resource Locators} (URLs) are a specific form of | 80 | A @dfn{Uniform Resource Identifier} (URI) is a specially-formatted |
| 79 | @dfn{Uniform Resource Identifiers} (URI) described in RFC 2396 which | 81 | name, such as an Internet address, that identifies some name or |
| 80 | updates RFC 1738 and RFC 1808. RFC 2016 defines uniform resource | 82 | resource. The format of URIs is described in RFC 3986, which updates |
| 81 | agents. | 83 | and replaces the earlier RFCs 2732, 2396, 1808, and 1738. A |
| 84 | @dfn{Uniform Resource Locator} (URL) is an older but still-common | ||
| 85 | term, which basically refers to a URI corresponding to a resource that | ||
| 86 | can be accessed (usually over a network) in a specific way. | ||
| 82 | 87 | ||
| 83 | URIs have the form @var{scheme}:@var{scheme-specific-part}, where the | 88 | Here are some examples of URIs (taken from RFC 3986): |
| 84 | @var{scheme}s supported by this library are described below. | ||
| 85 | @xref{Supported URL Types}. | ||
| 86 | 89 | ||
| 87 | FTP, NFS, HTTP, HTTPS, @code{rlogin}, @code{telnet}, tn3270, | 90 | @example |
| 88 | IRC and gopher URLs all have the form | 91 | ftp://ftp.is.co.za/rfc/rfc1808.txt |
| 92 | http://www.ietf.org/rfc/rfc2396.txt | ||
| 93 | ldap://[2001:db8::7]/c=GB?objectClass?one | ||
| 94 | mailto:John.Doe@@example.com | ||
| 95 | news:comp.infosystems.www.servers.unix | ||
| 96 | tel:+1-816-555-1212 | ||
| 97 | telnet://192.0.2.16:80/ | ||
| 98 | urn:oasis:names:specification:docbook:dtd:xml:4.1.2 | ||
| 99 | @end example | ||
| 100 | |||
| 101 | This manual describes the @code{url} library, an Emacs Lisp library | ||
| 102 | for parsing URIs and retrieving the resources to which they refer. | ||
| 103 | (The library is so-named for historical reasons; nowadays, the ``URI'' | ||
| 104 | terminology is regarded as the more general one, and ``URL'' is | ||
| 105 | technically obsolete despite its widespread vernacular usage.) | ||
| 106 | |||
| 107 | @node URI Parsing | ||
| 108 | @chapter URI Parsing | ||
| 109 | |||
| 110 | A URI consists of several @dfn{components}, each having a different | ||
| 111 | meaning. For example, the URI | ||
| 89 | 112 | ||
| 90 | @example | 113 | @example |
| 91 | @var{scheme}://@r{[}@var{userinfo}@@@r{]}@var{hostname}@r{[}:@var{port}@r{]}@r{[}/@var{path}@r{]} | 114 | http://www.gnu.org/software/emacs/ |
| 92 | @end example | 115 | @end example |
| 116 | |||
| 93 | @noindent | 117 | @noindent |
| 94 | where @samp{@r{[}} and @samp{@r{]}} delimit optional parts. | 118 | specifies the scheme component @samp{http}, the hostname component |
| 95 | @var{userinfo} sometimes takes the form @var{username}:@var{password} | 119 | @samp{www.gnu.org}, and the path component @samp{/software/emacs/}. |
| 96 | but you should beware of the security risks of sending cleartext | 120 | |
| 97 | passwords. @var{hostname} may be a domain name or a dotted decimal | 121 | @cindex parsed URIs |
| 98 | address. If the @samp{:@var{port}} is omitted then the library will | 122 | The format of URIs is specified by RFC 3986. The @code{url} library |
| 99 | use the ``well known'' port for that service when accessing URLs. With | 123 | provides the Lisp function @code{url-generic-parse-url}, a (mostly) |
| 100 | the possible exception of @code{telnet}, it is rare for ports to be | 124 | standard-compliant URI parser, as well as function |
| 101 | specified, and it is possible using a non-standard port may have | 125 | @code{url-recreate-url}, which converts a parsed URI back into a URI |
| 102 | undesired consequences if a different service is listening on that | 126 | string. |
| 103 | port (e.g., an HTTP URL specifying the SMTP port can cause mail to be | 127 | |
| 104 | sent). @c , but @xref{Other Variables, url-bad-port-list}. | 128 | @defun url-generic-parse-url uri-string |
| 105 | The meaning of the @var{path} component depends on the service. | 129 | This function returns a parsed version of the string @var{uri-string}. |
| 130 | @end defun | ||
| 106 | 131 | ||
| 107 | @menu | 132 | @defun url-recreate-url uri-obj |
| 108 | * Configuration:: | 133 | @cindex unparsing URLs |
| 109 | * Parsed URLs:: URLs are parsed into vector structures. | 134 | Given a parsed URI, this function returns the corresponding URI string. |
| 110 | @end menu | 135 | @end defun |
| 111 | 136 | ||
| 112 | @node Configuration | 137 | @cindex parsed URI |
| 113 | @section Configuration | 138 | The return value of @code{url-generic-parse-url}, and the argument |
| 139 | expected by @code{url-recreate-url}, is a @dfn{parsed URI}: a CL | ||
| 140 | structure whose slots hold the various components of the URI. | ||
| 141 | @xref{top,the CL Manual,,cl,GNU Emacs Common Lisp Emulation}, for | ||
| 142 | details about CL structures. Most of the other functions in the | ||
| 143 | @code{url} library act on parsed URIs. | ||
| 114 | 144 | ||
| 115 | @defvar url-configuration-directory | 145 | @menu |
| 116 | @cindex @file{~/.url} | 146 | * Parsed URIs:: Format of parsed URI structures. |
| 117 | @cindex configuration files | 147 | * URI Encoding:: Non-@acronym{ASCII} characters in URIs. |
| 118 | The directory in which URL configuration files, the cache etc., | 148 | @end menu |
| 119 | reside. The old default was @file{~/.url}, and this directory | ||
| 120 | is still used if it exists. The new default is a @file{url/} | ||
| 121 | directory in @code{user-emacs-directory}, which is normally | ||
| 122 | @file{~/.emacs.d}. | ||
| 123 | @end defvar | ||
| 124 | 149 | ||
| 125 | @node Parsed URLs | 150 | @node Parsed URIs |
| 126 | @section Parsed URLs | 151 | @section Parsed URI structures |
| 127 | @cindex parsed URLs | ||
| 128 | The library functions typically operate on @dfn{parsed} versions of | ||
| 129 | URLs. These are actually CL structures (vectors) of the form: | ||
| 130 | 152 | ||
| 131 | @example | 153 | Each parsed URI structure contains the following slots: |
| 132 | [cl-struct-url @var{type} @var{user} @var{password} @var{host} @var{port} @var{filename} @var{target} @var{attributes} @var{fullness} @var{use-cookies}] | ||
| 133 | @end example | ||
| 134 | 154 | ||
| 135 | @noindent where | 155 | @table @code |
| 136 | @table @var | ||
| 137 | @item type | 156 | @item type |
| 138 | is the type of the URL scheme, e.g., @code{http} | 157 | The URI scheme (a string, e.g.@: @code{http}). @xref{Supported URL |
| 158 | Types}, for a list of schemes that the @code{url} library knows how to | ||
| 159 | process. This slot can also be @code{nil}, if the URI is not fully | ||
| 160 | specified. | ||
| 161 | |||
| 139 | @item user | 162 | @item user |
| 140 | is the username associated with it, or @code{nil}; | 163 | The user name (a string), or @code{nil}. |
| 164 | |||
| 141 | @item password | 165 | @item password |
| 142 | is the user password associated with it, or @code{nil}; | 166 | The user password (a string), or @code{nil}. The use of this URI |
| 167 | component is strongly discouraged; nowadays, passwords are transmitted | ||
| 168 | by other means, not as part of a URI. | ||
| 169 | |||
| 143 | @item host | 170 | @item host |
| 144 | is the host name associated with it, or @code{nil}; | 171 | The host name (a string), or @code{nil}. If present, this is |
| 172 | typically a domain name or IP address. | ||
| 173 | |||
| 145 | @item port | 174 | @item port |
| 146 | is the port number associated with it, or @code{nil}; | 175 | The port number (an integer), or @code{nil}. Omitting this component |
| 176 | usually means to use the ``standard'' port associated with the URI | ||
| 177 | scheme. | ||
| 178 | |||
| 147 | @item filename | 179 | @item filename |
| 148 | is the ``file'' part of it, or @code{nil}. This doesn't necessarily | 180 | The combination of the ``path'' and ``query'' components of the URI (a |
| 149 | actually refer to a file; | 181 | string), or @code{nil}. If the query component is present, it is the |
| 182 | substring following the first @samp{?} character, and the path | ||
| 183 | component is the substring before the @samp{?}. The meaning of these | ||
| 184 | components is scheme-dependent; they do not necessarily refer to a | ||
| 185 | file on a disk. | ||
| 186 | |||
| 150 | @item target | 187 | @item target |
| 151 | is the target part, or @code{nil}; | 188 | The fragment component (a string), or @code{nil}. The fragment |
| 152 | @item attributes | 189 | component specifies a ``secondary resource'', such as a section of a |
| 153 | is the attributes associated with it, or @code{nil}; | 190 | webpage. |
| 191 | |||
| 154 | @item fullness | 192 | @item fullness |
| 155 | is @code{t} for a fully-specified URL, with a host part indicated by | 193 | This is @code{t} if the URI is fully specified, i.e.@: the |
| 156 | @samp{//} after the scheme part. | 194 | hierarchical components of the URI (the hostname and/or username |
| 157 | @item use-cookies | 195 | and/or password) are preceded by @samp{//}. |
| 158 | is @code{nil} to neither send or store cookies to the server, @code{t} | ||
| 159 | otherwise. | ||
| 160 | @end table | 196 | @end table |
| 161 | 197 | ||
| 162 | @findex url-type | 198 | @findex url-type |
| @@ -168,64 +204,165 @@ otherwise. | |||
| 168 | @findex url-target | 204 | @findex url-target |
| 169 | @findex url-attributes | 205 | @findex url-attributes |
| 170 | @findex url-fullness | 206 | @findex url-fullness |
| 171 | These attributes have accessors named @code{url-@var{part}}, where | 207 | These slots have accessors named @code{url-@var{part}}, where |
| 172 | @var{part} is the name of one of the elements above, e.g., | 208 | @var{part} is the slot name. For example, the accessor for the |
| 173 | @code{url-host}. These attributes can be set with the same accessors | 209 | @code{host} slot is the function @code{url-host}. The @code{url-port} |
| 174 | using @code{setf}: | 210 | accessor returns the default port for the URI scheme if the parsed |
| 211 | URI's @var{port} slot is @code{nil}. | ||
| 212 | |||
| 213 | The slots can be set using @code{setf}. For example: | ||
| 175 | 214 | ||
| 176 | @example | 215 | @example |
| 177 | (setf (url-port url) 80) | 216 | (setf (url-port url) 80) |
| 178 | @end example | 217 | @end example |
| 179 | 218 | ||
| 180 | If @var{port} is @var{nil}, @code{url-port} returns the default port | 219 | @node URI Encoding |
| 181 | of the protocol. | 220 | @section URI Encoding |
| 182 | 221 | ||
| 183 | There are functions for parsing and unparsing between the string and | 222 | @cindex percent encoding |
| 184 | vector forms. | 223 | The @code{url-generic-parse-url} parser does not obey RFC 3986 in |
| 224 | one respect: it allows non-@acronym{ASCII} characters in URI strings. | ||
| 225 | |||
| 226 | Strictly speaking, RFC 3986 compatible URIs may only consist of | ||
| 227 | @acronym{ASCII} characters; non-@acronym{ASCII} characters are | ||
| 228 | represented by converting them to UTF-8 byte sequences, and performing | ||
| 229 | @dfn{percent encoding} on the bytes. For example, the o-umlaut | ||
| 230 | character is converted to the UTF-8 byte sequence @samp{\xD3\xA7}, | ||
| 231 | then percent encoded to @samp{%D3%A7}. (Certain ``reserved'' | ||
| 232 | @acronym{ASCII} characters must also be percent encoded when they | ||
| 233 | appear in URI components.) | ||
| 234 | |||
| 235 | The function @code{url-encode-url} can be used to convert a URI | ||
| 236 | string containing arbitrary characters to one that is properly | ||
| 237 | percent-encoded in accordance with RFC 3986. | ||
| 238 | |||
| 239 | @defun url-encode-url url-string | ||
| 240 | This function return a properly URI-encoded version of | ||
| 241 | @var{url-string}. It also performs @dfn{URI normalization}, | ||
| 242 | e.g.@: converting the scheme component to lowercase if it was | ||
| 243 | previously uppercase. | ||
| 244 | @end defun | ||
| 185 | 245 | ||
| 186 | @defun url-generic-parse-url url | 246 | To convert between a string containing arbitrary characters and a |
| 187 | Return a parsed version of the string @var{url}. | 247 | percent-encoded all-@acronym{ASCII} string, use the functions |
| 248 | @code{url-hexify-string} and @code{url-unhex-string}: | ||
| 249 | |||
| 250 | @defun url-hexify-string string &optional allowed-chars | ||
| 251 | This function performs percent-encoding on @var{string}, and returns | ||
| 252 | the result. | ||
| 253 | |||
| 254 | If @var{string} is multibyte, it is first converted to a UTF-8 byte | ||
| 255 | string. Each byte corresponding to an allowed character is left | ||
| 256 | as-is, while all other bytes are converted to a three-character | ||
| 257 | sequence: @samp{%} followed by two upper-case hex digits. | ||
| 258 | |||
| 259 | @vindex url-unreserved-chars | ||
| 260 | @cindex unreserved characters | ||
| 261 | The allowed characters are specified by @var{allowed-chars}. If this | ||
| 262 | argument is @code{nil}, the allowed characters are those specified as | ||
| 263 | @dfn{unreserved characters} by RFC 3986 (see the variable | ||
| 264 | @code{url-unreserved-chars}). Otherwise, @var{allowed-chars} should | ||
| 265 | be a vector whose @var{n}-th element is non-@code{nil} if character | ||
| 266 | @var{n} is allowed. | ||
| 188 | @end defun | 267 | @end defun |
| 189 | 268 | ||
| 190 | @defun url-recreate-url url | 269 | @defun url-unhex-string string &optional allow-newlines |
| 191 | @cindex unparsing URLs | 270 | This function replaces percent-encoding sequences in @var{string} with |
| 192 | Recreates a URL string from the parsed @var{url}. | 271 | their character equivalents, and returns the resulting string. |
| 272 | |||
| 273 | If @var{allow-newlines} is non-@code{nil}, it allows the decoding of | ||
| 274 | carriage returns and line feeds, which are normally forbidden in URIs. | ||
| 193 | @end defun | 275 | @end defun |
| 194 | 276 | ||
| 195 | @node Retrieving URLs | 277 | @node Retrieving URLs |
| 196 | @chapter Retrieving URLs | 278 | @chapter Retrieving URLs |
| 197 | 279 | ||
| 280 | The @code{url} library defines the following three functions for | ||
| 281 | retrieving the data specified by a URL. The actual retrieval protocol | ||
| 282 | depends on the URL's URI scheme, and is performed by lower-level | ||
| 283 | scheme-specific functions. (Those lower-level functions are not | ||
| 284 | documented here, and generally should not be called directly.) | ||
| 285 | |||
| 286 | In each of these functions, the @var{url} argument can be either a | ||
| 287 | string or a parsed URL structure. If it is a string, that string is | ||
| 288 | passed through @code{url-encode-url} before using it, to ensure that | ||
| 289 | it is properly URI-encoded (@pxref{URI Encoding}). | ||
| 290 | |||
| 198 | @defun url-retrieve-synchronously url | 291 | @defun url-retrieve-synchronously url |
| 199 | Retrieve @var{url} synchronously and return a buffer containing the | 292 | This function synchronously retrieves the data specified by @var{url}, |
| 200 | data. @var{url} is either a string or a parsed URL structure. Return | 293 | and returns a buffer containing the data. The return value is |
| 201 | @code{nil} if there are no data associated with it (the case for dired, | 294 | @code{nil} if there is no data associated with the URL (as is the case |
| 202 | info, or mailto URLs that need no further processing). | 295 | for @code{dired}, @code{info}, and @code{mailto} URLs). |
| 203 | @end defun | 296 | @end defun |
| 204 | 297 | ||
| 205 | @defun url-retrieve url callback &optional cbargs silent no-cookies | 298 | @defun url-retrieve url callback &optional cbargs silent no-cookies |
| 206 | Retrieve @var{url} asynchronously and call @var{callback} with args | 299 | This function retrieves @var{url} asynchronously, calling the function |
| 207 | @var{cbargs} when finished. The callback is called when the object | 300 | @var{callback} when the object has been completely retrieved. The |
| 208 | has been completely retrieved, with the current buffer containing the | 301 | return value is the buffer into which the data will be inserted, or |
| 209 | object and any MIME headers associated with it. @var{url} is either a | 302 | @code{nil} if the process has already completed. |
| 210 | string or a parsed URL structure. Returns the buffer @var{url} will | 303 | |
| 211 | load into, or @code{nil} if the process has already completed. | 304 | The callback function is called this way: |
| 212 | If the optional argument @var{silent} is non-@code{nil}, suppress | 305 | |
| 213 | progress messages. If the optional argument @var{no-cookies} is | 306 | @example |
| 214 | non-@code{nil}, do not store or send cookies. | 307 | (apply @var{callback} @var{status} @var{cbargs}) |
| 308 | @end example | ||
| 309 | |||
| 310 | @noindent | ||
| 311 | where @var{status} is a plist representing what happened during the | ||
| 312 | retrieval, with most recent events first, or an empty list if no | ||
| 313 | events have occurred. Each pair in the plist is one of: | ||
| 314 | |||
| 315 | @table @code | ||
| 316 | @item (:redirect @var{redirected-to}) | ||
| 317 | This means that the request was redirected to the URL | ||
| 318 | @var{redirected-to}. | ||
| 319 | |||
| 320 | @item (:error (@var{error-symbol} . @var{data})) | ||
| 321 | This means that an error occurred. If so desired, the error can be | ||
| 322 | signaled with @code{(signal @var{error-symbol} @var{data})}. | ||
| 323 | @end table | ||
| 324 | |||
| 325 | When the callback function is called, the current buffer is the one | ||
| 326 | containing the retrieved data (if any). The buffer also contains any | ||
| 327 | MIME headers associated with the data retrieval. | ||
| 328 | |||
| 329 | If the optional argument @var{silent} is non-@code{nil}, progress | ||
| 330 | messages are suppressed. If the optional argument @var{no-cookies} is | ||
| 331 | non-@code{nil}, cookies are not stored or sent. | ||
| 215 | @end defun | 332 | @end defun |
| 216 | 333 | ||
| 217 | @vindex url-queue-parallel-processes | ||
| 218 | @vindex url-queue-timeout | ||
| 219 | @defun url-queue-retrieve url callback &optional cbargs silent no-cookies | 334 | @defun url-queue-retrieve url callback &optional cbargs silent no-cookies |
| 220 | This acts like the @code{url-retrieve} function, but with limits on | 335 | This function acts like @code{url-retrieve}, but with limits on the |
| 221 | the degree of parallelism. The option @code{url-queue-parallel-processes} | 336 | number of concurrently-running network processes. The option |
| 222 | controls the number of concurrent processes, and the option | 337 | @code{url-queue-parallel-processes} controls the number of concurrent |
| 223 | @code{url-queue-timeout} sets a timeout in seconds. | 338 | processes, and the option @code{url-queue-timeout} sets a timeout in |
| 339 | seconds. | ||
| 340 | |||
| 341 | To use this function, you must @code{(require 'url-queue)}. | ||
| 224 | @end defun | 342 | @end defun |
| 225 | 343 | ||
| 344 | @vindex url-queue-parallel-processes | ||
| 345 | @defopt url-queue-parallel-processes | ||
| 346 | The value of this option is an integer specifying the maximum number | ||
| 347 | of concurrent @code{url-queue-retrieve} network processes. If the | ||
| 348 | number of @code{url-queue-retrieve} calls is larger than this number, | ||
| 349 | later ones are queued until ealier ones are finished. | ||
| 350 | @end defopt | ||
| 351 | |||
| 352 | @vindex url-queue-timeout | ||
| 353 | @defopt url-queue-timeout | ||
| 354 | The value of this option is a number specifying the maximum lifetime | ||
| 355 | of a @code{url-queue-retrieve} network process, once it is started. | ||
| 356 | If a process is not finished by then, it is killed and removed from | ||
| 357 | the queue. | ||
| 358 | @end defopt | ||
| 359 | |||
| 226 | @node Supported URL Types | 360 | @node Supported URL Types |
| 227 | @chapter Supported URL Types | 361 | @chapter Supported URL Types |
| 228 | 362 | ||
| 363 | This chapter describes functions and variables affecting URL retrieval | ||
| 364 | for specific schemes. | ||
| 365 | |||
| 229 | @menu | 366 | @menu |
| 230 | * http/https:: Hypertext Transfer Protocol. | 367 | * http/https:: Hypertext Transfer Protocol. |
| 231 | * file/ftp:: Local files and FTP archives. | 368 | * file/ftp:: Local files and FTP archives. |
| @@ -236,48 +373,31 @@ controls the number of concurrent processes, and the option | |||
| 236 | * irc:: Internet Relay Chat. | 373 | * irc:: Internet Relay Chat. |
| 237 | * data:: Embedded data URLs. | 374 | * data:: Embedded data URLs. |
| 238 | * nfs:: Networked File System | 375 | * nfs:: Networked File System |
| 239 | @c * finger:: | ||
| 240 | @c * gopher:: | ||
| 241 | @c * netrek:: | ||
| 242 | @c * prospero:: | ||
| 243 | * cid:: Content-ID. | ||
| 244 | * about:: | ||
| 245 | * ldap:: Lightweight Directory Access Protocol | 376 | * ldap:: Lightweight Directory Access Protocol |
| 246 | * imap:: IMAP mailboxes. | ||
| 247 | * man:: Unix man pages. | 377 | * man:: Unix man pages. |
| 248 | @end menu | 378 | @end menu |
| 249 | 379 | ||
| 250 | @node http/https | 380 | @node http/https |
| 251 | @section @code{http} and @code{https} | 381 | @section @code{http} and @code{https} |
| 252 | 382 | ||
| 253 | The scheme @code{http} is Hypertext Transfer Protocol. The library | 383 | The @code{http} scheme refers to the Hypertext Transfer Protocol. The |
| 254 | supports version 1.1, specified in RFC 2616. (This supersedes 1.0, | 384 | @code{url} library supports HTTP version 1.1, specified in RFC 2616. |
| 255 | defined in RFC 1945) HTTP URLs have the following form, where most of | 385 | Its default port is 80. |
| 256 | the parts are optional: | 386 | |
| 257 | @example | 387 | The @code{https} scheme is a secure version of @code{http}, with |
| 258 | http://@var{user}:@var{password}@@@var{host}:@var{port}/@var{path}?@var{searchpart}#@var{fragment} | 388 | transmission via SSL. It is defined in RFC 2069, and its default port |
| 259 | @end example | 389 | is 443. When using @code{https}, the @code{url} library performs SSL |
| 260 | @c The @code{:@var{port}} part is optional, and @var{port} defaults to | 390 | encryption via the @code{ssl} library, by forcing the @code{ssl} |
| 261 | @c 80. The @code{/@var{path}} part, if present, is a slash-separated | 391 | gateway method to be used. @xref{Gateways in general}. |
| 262 | @c series elements. The @code{?@var{searchpart}}, if present, is the | ||
| 263 | @c query for a search or the content of a form submission. The | ||
| 264 | @c @code{#fragment} part, if present, is a location in the document. | ||
| 265 | |||
| 266 | The scheme @code{https} is a secure version of @code{http}, with | ||
| 267 | transmission via SSL. It is defined in RFC 2069. Its default port is | ||
| 268 | 443. This scheme depends on SSL support in Emacs via the | ||
| 269 | @file{ssl.el} library and is actually implemented by forcing the | ||
| 270 | @code{ssl} gateway method to be used. @xref{Gateways in general}. | ||
| 271 | 392 | ||
| 272 | @defopt url-honor-refresh-requests | 393 | @defopt url-honor-refresh-requests |
| 273 | This controls honoring of HTTP @samp{Refresh} headers by which | 394 | If this option is non-@code{nil} (the default), the @code{url} library |
| 274 | servers can direct clients to reload documents from the same URL or a | 395 | honors the HTTP @samp{Refresh} header, which is used by servers to |
| 275 | or different one. @code{nil} means they will not be honored, | 396 | direct clients to reload documents from the same URL or a or different |
| 276 | @code{t} (the default) means they will always be honored, and | 397 | one. If the value is @code{nil}, the @samp{Refresh} header is |
| 277 | otherwise the user will be asked on each request. | 398 | ignored; any other value means to ask the user on each request. |
| 278 | @end defopt | 399 | @end defopt |
| 279 | 400 | ||
| 280 | |||
| 281 | @menu | 401 | @menu |
| 282 | * Cookies:: | 402 | * Cookies:: |
| 283 | * HTTP language/coding:: | 403 | * HTTP language/coding:: |
| @@ -409,26 +529,32 @@ emacs-mime, The Emacs MIME Manual}. | |||
| 409 | @cindex compressed files | 529 | @cindex compressed files |
| 410 | @cindex dired | 530 | @cindex dired |
| 411 | 531 | ||
| 532 | The @code{ftp} and @code{file} schemes are defined in RFC 1808. The | ||
| 533 | @code{url} library treats @samp{ftp:} and @samp{file:} as synonymous. | ||
| 534 | Such URLs have the form | ||
| 535 | |||
| 412 | @example | 536 | @example |
| 413 | ftp://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file} | 537 | ftp://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file} |
| 414 | file://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file} | 538 | file://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file} |
| 415 | @end example | 539 | @end example |
| 416 | 540 | ||
| 417 | These schemes are defined in RFC 1808. | 541 | @noindent |
| 418 | @samp{ftp:} and @samp{file:} are synonymous in this library. They | 542 | If the URL specifies a local file, it is retrieved by reading the file |
| 419 | allow reading arbitrary files from hosts. Either @samp{ange-ftp} | 543 | contents in the usual way. If it specifies a remote file, it is |
| 420 | (Emacs) or @samp{efs} (XEmacs) is used to retrieve them from remote | 544 | retrieved using the Ange-FTP package. @xref{Remote Files,,, emacs, |
| 421 | hosts. Local files are accessed directly. | 545 | The GNU Emacs Manual}. |
| 422 | 546 | ||
| 423 | Compressed files are handled, but support is hard-coded so that | 547 | When retrieving a compressed file, it is automatically uncompressed |
| 424 | @code{jka-compr-compression-info-list} and so on have no affect. | 548 | if it has the file suffix @file{.z}, @file{.gz}, @file{.Z}, |
| 425 | Suffixes recognized are @samp{.z}, @samp{.gz}, @samp{.Z} and | 549 | @file{.bz2}, or @file{.xz}. (The list of supported suffixes is |
| 426 | @samp{.bz2}. | 550 | hard-coded, and cannot be altered by customizing |
| 551 | @code{jka-compr-compression-info-list}.) | ||
| 427 | 552 | ||
| 428 | @defopt url-directory-index-file | 553 | @defopt url-directory-index-file |
| 429 | The filename to look for when indexing a directory, default | 554 | This option specifies the filename to look for when a @code{file} or |
| 430 | @samp{"index.html"}. If this file exists, and is readable, then it | 555 | @code{ftp} URL specifies a directory. The default is |
| 431 | will be viewed instead of using @code{dired} to view the directory. | 556 | @file{index.html}. If this file exists and is readable, it is viewed. |
| 557 | Otherwise, Emacs visits the directory using Dired. | ||
| 432 | @end defopt | 558 | @end defopt |
| 433 | 559 | ||
| 434 | @node info | 560 | @node info |
| @@ -437,47 +563,53 @@ will be viewed instead of using @code{dired} to view the directory. | |||
| 437 | @cindex Texinfo | 563 | @cindex Texinfo |
| 438 | @findex Info-goto-node | 564 | @findex Info-goto-node |
| 439 | 565 | ||
| 566 | The @code{info} scheme is non-standard. Such URLs have the form | ||
| 567 | |||
| 440 | @example | 568 | @example |
| 441 | info:@var{file}#@var{node} | 569 | info:@var{file}#@var{node} |
| 442 | @end example | 570 | @end example |
| 443 | 571 | ||
| 444 | Info URLs are not officially defined. They invoke | 572 | @noindent |
| 445 | @code{Info-goto-node} with argument @samp{(@var{file})@var{node}}. | 573 | and are retrieved by invoking @code{Info-goto-node} with argument |
| 446 | @samp{#@var{node}} is optional, defaulting to @samp{Top}. | 574 | @samp{(@var{file})@var{node}}. If @samp{#@var{node}} is omitted, the |
| 575 | @samp{Top} node is opened. | ||
| 447 | 576 | ||
| 448 | @node mailto | 577 | @node mailto |
| 449 | @section mailto | 578 | @section mailto |
| 450 | 579 | ||
| 451 | @cindex mailto | 580 | @cindex mailto |
| 452 | @cindex email | 581 | @cindex email |
| 453 | A mailto URL will send an email message to the address in the | 582 | A @code{mailto} URL specifies an email message to be sent to a given |
| 454 | URL, for example @samp{mailto:foo@@bar.com} would compose a | 583 | email address. For example, @samp{mailto:foo@@bar.com} specifies |
| 455 | message to @samp{foo@@bar.com}. | 584 | sending a message to @samp{foo@@bar.com}. The ``retrieval method'' |
| 456 | 585 | for such URLs is to open a mail composition buffer in which the | |
| 457 | @defopt url-mail-command | 586 | appropriate content (e.g.@: the recipient address) has been filled in. |
| 458 | @vindex mail-user-agent | ||
| 459 | The function called whenever url needs to send mail. This should | ||
| 460 | normally be left to default from @var{mail-user-agent}. @xref{Mail | ||
| 461 | Methods, , Mail-Composition Methods, emacs, The GNU Emacs Manual}. | ||
| 462 | @end defopt | ||
| 463 | 587 | ||
| 464 | An @samp{X-Url-From} header field containing the URL of the document | 588 | As defined in RFC 2368, a @code{mailto} URL has the form |
| 465 | that contained the mailto URL is added if that URL is known. | ||
| 466 | 589 | ||
| 467 | RFC 2368 extends the definition of mailto URLs in RFC 1738. | ||
| 468 | The form of a mailto URL is | ||
| 469 | @example | 590 | @example |
| 470 | @samp{mailto:@var{mailbox}[?@var{header}=@var{contents}[&@var{header}=@var{contents}]]} | 591 | @samp{mailto:@var{mailbox}[?@var{header}=@var{contents}[&@var{header}=@var{contents}]]} |
| 471 | @end example | 592 | @end example |
| 472 | @noindent where an arbitrary number of @var{header}s can be added. If the | ||
| 473 | @var{header} is @samp{body}, then @var{contents} is put in the body | ||
| 474 | otherwise a @var{header} header field is created with @var{contents} | ||
| 475 | as its contents. Note that the URL library does not consider any | ||
| 476 | headers ``dangerous'' so you should check them before sending the | ||
| 477 | message. | ||
| 478 | 593 | ||
| 479 | @c Fixme: update | 594 | @noindent |
| 480 | Email messages are defined in @sc{rfc}822. | 595 | where an arbitrary number of @var{header}s can be added. If the |
| 596 | @var{header} is @samp{body}, then @var{contents} is put in the message | ||
| 597 | body; otherwise, a @var{header} header field is created with | ||
| 598 | @var{contents} as its contents. Note that the @code{url} library does | ||
| 599 | not perform any checking of @var{header} or @var{contents}, so you | ||
| 600 | should check them before sending the message. | ||
| 601 | |||
| 602 | @defopt url-mail-command | ||
| 603 | @vindex mail-user-agent | ||
| 604 | The value of this variable is the function called whenever url needs | ||
| 605 | to send mail. This should normally be left its default, which is the | ||
| 606 | standard mail-composition command @code{compose-mail}. @xref{Sending | ||
| 607 | Mail,,, emacs, The GNU Emacs Manual}. | ||
| 608 | @end defopt | ||
| 609 | |||
| 610 | If the document containing the @code{mailto} URL itself possessed a | ||
| 611 | known URL, Emacs automatically inserts an @samp{X-Url-From} header | ||
| 612 | field into the mail buffer, specifying that URL. | ||
| 481 | 613 | ||
| 482 | @node news/nntp/snews | 614 | @node news/nntp/snews |
| 483 | @section @code{news}, @code{nntp} and @code{snews} | 615 | @section @code{news}, @code{nntp} and @code{snews} |
| @@ -487,11 +619,13 @@ Email messages are defined in @sc{rfc}822. | |||
| 487 | @cindex NNTP | 619 | @cindex NNTP |
| 488 | @cindex snews | 620 | @cindex snews |
| 489 | 621 | ||
| 490 | @c draft-gilman-news-url-01 | 622 | The @code{news}, @code{nntp}, and @code{snews} schemes, defined in RFC |
| 491 | The network news URL scheme take the following forms following RFC | 623 | 1738, are used for reading Usenet newsgroups. For compatibility with |
| 492 | 1738 except that for compatibility with other clients, host and port | 624 | non-standard-compliant news clients, the @code{url} library allows |
| 493 | fields may be included in news URLs though they are properly only | 625 | host and port fields to be included in @code{news} URLs, even though |
| 494 | allowed for nntp an snews. | 626 | they are properly only allowed for @code{nntp} and @code{snews}. |
| 627 | |||
| 628 | @code{news} and @code{nntp} URLs have the following form: | ||
| 495 | 629 | ||
| 496 | @table @samp | 630 | @table @samp |
| 497 | @item news:@var{newsgroup} | 631 | @item news:@var{newsgroup} |
| @@ -506,24 +640,22 @@ Retrieves a list of all available newsgroups; | |||
| 506 | Similar to the @samp{news} versions. | 640 | Similar to the @samp{news} versions. |
| 507 | @end table | 641 | @end table |
| 508 | 642 | ||
| 509 | @samp{:@var{port}} is optional and defaults to :119. | 643 | The default port for @code{nntp} (and @code{news}) is 119. The |
| 510 | 644 | difference between an @code{nntp} URL and a @code{news} URL is that an | |
| 511 | @samp{snews} is the same as @samp{nntp} except that the default port | 645 | @code{nttp} URL may specify an article by its number. The |
| 512 | is :563. | 646 | @samp{snews} scheme is the same as @samp{nntp}, except that it is |
| 513 | @cindex SSL | 647 | tunneled through SSL and has default port 563. |
| 514 | (It is tunneled through SSL.) | ||
| 515 | 648 | ||
| 516 | An @samp{nntp} URL is the same as a news URL, except that the URL may | 649 | These URLs are retrieved via the Gnus package. |
| 517 | specify an article by its number. | ||
| 518 | 650 | ||
| 519 | @defopt url-news-server | ||
| 520 | This variable can be used to override the default news server. | ||
| 521 | Usually this will be set by the Gnus package, which is used to fetch | ||
| 522 | news. | ||
| 523 | @cindex environment variable | 651 | @cindex environment variable |
| 524 | @vindex NNTPSERVER | 652 | @vindex NNTPSERVER |
| 525 | It may be set from the conventional environment variable | 653 | @defopt url-news-server |
| 526 | @code{NNTPSERVER}. | 654 | This variable specifies the default news server from which to fetch |
| 655 | news, if no server was specified in the URL. The default value, | ||
| 656 | @code{nil}, means to use the server specified by the standard | ||
| 657 | environment variable @samp{NNTPSERVER}, or @samp{news} if that | ||
| 658 | environment variable is unset. | ||
| 527 | @end defopt | 659 | @end defopt |
| 528 | 660 | ||
| 529 | @node rlogin/telnet/tn3270 | 661 | @node rlogin/telnet/tn3270 |
| @@ -534,12 +666,15 @@ It may be set from the conventional environment variable | |||
| 534 | @cindex terminal emulation | 666 | @cindex terminal emulation |
| 535 | @findex terminal-emulator | 667 | @findex terminal-emulator |
| 536 | 668 | ||
| 537 | These URL schemes from RFC 1738 for logon via a terminal emulator have | 669 | These URL schemes are defined in RFC 1738, and are used for logging in |
| 538 | the form | 670 | via a terminal emulator. They have the form |
| 671 | |||
| 539 | @example | 672 | @example |
| 540 | telnet://@var{user}:@var{password}@@@var{host}:@var{port} | 673 | telnet://@var{user}:@var{password}@@@var{host}:@var{port} |
| 541 | @end example | 674 | @end example |
| 542 | but the @code{:@var{password}} component is ignored. | 675 | |
| 676 | @noindent | ||
| 677 | but the @var{password} component is ignored. | ||
| 543 | 678 | ||
| 544 | To handle rlogin, telnet and tn3270 URLs, a @code{rlogin}, | 679 | To handle rlogin, telnet and tn3270 URLs, a @code{rlogin}, |
| 545 | @code{telnet} or @code{tn3270} (the program names and arguments are | 680 | @code{telnet} or @code{tn3270} (the program names and arguments are |
| @@ -553,39 +688,43 @@ Well-known ports are used if the URL does not specify a port. | |||
| 553 | @cindex ZEN IRC | 688 | @cindex ZEN IRC |
| 554 | @cindex ERC | 689 | @cindex ERC |
| 555 | @cindex rcirc | 690 | @cindex rcirc |
| 556 | @c Fixme: reference (was http://www.w3.org/Addressing/draft-mirashi-url-irc-01.txt) | 691 | |
| 557 | @dfn{Internet Relay Chat} (IRC) is handled by handing off the @sc{irc} | 692 | The @code{irc} scheme is defined in the Internet Draft at |
| 558 | session to a function named in @code{url-irc-function}. | 693 | @url{http://www.w3.org/Addressing/draft-mirashi-url-irc-01.txt} (which |
| 694 | was never approved as an RFC). Such URLs have the form | ||
| 695 | |||
| 696 | @example | ||
| 697 | irc://@var{host}:@var{port}/@var{target},@var{needpass} | ||
| 698 | @end example | ||
| 699 | |||
| 700 | @noindent | ||
| 701 | and are retrieved by opening an @acronym{IRC} session using the | ||
| 702 | function specified by @code{url-irc-function}. | ||
| 559 | 703 | ||
| 560 | @defopt url-irc-function | 704 | @defopt url-irc-function |
| 561 | A function to actually open an IRC connection. | 705 | The value of this option is a function, which is called to open an IRC |
| 562 | This function | 706 | connection for @code{irc} URLs. This function must take five |
| 563 | must take five arguments, @var{host}, @var{port}, @var{channel}, | 707 | arguments, @var{host}, @var{port}, @var{channel}, @var{user} and |
| 564 | @var{user} and @var{password}. The @var{channel} argument specifies the | 708 | @var{password}. The @var{channel} argument specifies the channel to |
| 565 | channel to join immediately, this can be @code{nil}. By default this is | 709 | join immediately, and may be @code{nil}. |
| 566 | @code{url-irc-rcirc}. | 710 | |
| 711 | The default is @code{url-irc-rcirc}, which uses the Rcirc package. | ||
| 712 | Other options are @code{url-irc-erc} (which uses ERC) and | ||
| 713 | @code{url-irc-zenirc} (which uses ZenIRC). | ||
| 567 | @end defopt | 714 | @end defopt |
| 568 | @defun url-irc-rcirc host port channel user password | ||
| 569 | Processes the arguments and lets @code{rcirc} handle the session. | ||
| 570 | @end defun | ||
| 571 | @defun url-irc-erc host port channel user password | ||
| 572 | Processes the arguments and lets @code{ERC} handle the session. | ||
| 573 | @end defun | ||
| 574 | @defun url-irc-zenirc host port channel user password | ||
| 575 | Processes the arguments and lets @code{zenirc} handle the session. | ||
| 576 | @end defun | ||
| 577 | 715 | ||
| 578 | @node data | 716 | @node data |
| 579 | @section data | 717 | @section data |
| 580 | @cindex data URLs | 718 | @cindex data URLs |
| 581 | 719 | ||
| 720 | The @code{data} scheme, defined in RFC 2397, contains MIME data in | ||
| 721 | the URL itself. Such URLs have the form | ||
| 722 | |||
| 582 | @example | 723 | @example |
| 583 | data:@r{[}@var{media-type}@r{]}@r{[};@var{base64}@r{]},@var{data} | 724 | data:@r{[}@var{media-type}@r{]}@r{[};@var{base64}@r{]},@var{data} |
| 584 | @end example | 725 | @end example |
| 585 | 726 | ||
| 586 | Data URLs contain MIME data in the URL itself. They are defined in | 727 | @noindent |
| 587 | RFC 2397. | ||
| 588 | |||
| 589 | @var{media-type} is a MIME @samp{Content-Type} string, possibly | 728 | @var{media-type} is a MIME @samp{Content-Type} string, possibly |
| 590 | including parameters. It defaults to | 729 | including parameters. It defaults to |
| 591 | @samp{text/plain;charset=US-ASCII}. The @samp{text/plain} can be | 730 | @samp{text/plain;charset=US-ASCII}. The @samp{text/plain} can be |
| @@ -598,14 +737,14 @@ present, the @var{data} are base64-encoded. | |||
| 598 | @cindex Network File System | 737 | @cindex Network File System |
| 599 | @cindex automounter | 738 | @cindex automounter |
| 600 | 739 | ||
| 740 | The @code{nfs} scheme, defined in RFC 2224, is similar to @code{ftp} | ||
| 741 | except that it points to a file on a remote host that is handled by an | ||
| 742 | NFS automounter on the local host. Such URLs have the form | ||
| 743 | |||
| 601 | @example | 744 | @example |
| 602 | nfs://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file} | 745 | nfs://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file} |
| 603 | @end example | 746 | @end example |
| 604 | 747 | ||
| 605 | The @samp{nfs:} scheme is defined in RFC 2224. It is similar to | ||
| 606 | @samp{ftp:} except that it points to a file on a remote host that is | ||
| 607 | handled by the automounter on the local host. | ||
| 608 | |||
| 609 | @defvar url-nfs-automounter-directory-spec | 748 | @defvar url-nfs-automounter-directory-spec |
| 610 | @end defvar | 749 | @end defvar |
| 611 | A string saying how to invoke the NFS automounter. Certain @samp{%} | 750 | A string saying how to invoke the NFS automounter. Certain @samp{%} |
| @@ -628,15 +767,6 @@ A literal @samp{%}. | |||
| 628 | 767 | ||
| 629 | Each can be used any number of times. | 768 | Each can be used any number of times. |
| 630 | 769 | ||
| 631 | @node cid | ||
| 632 | @section cid | ||
| 633 | @cindex Content-ID | ||
| 634 | |||
| 635 | RFC 2111 | ||
| 636 | |||
| 637 | @node about | ||
| 638 | @section about | ||
| 639 | |||
| 640 | @node ldap | 770 | @node ldap |
| 641 | @section ldap | 771 | @section ldap |
| 642 | @cindex LDAP | 772 | @cindex LDAP |
| @@ -644,50 +774,21 @@ RFC 2111 | |||
| 644 | 774 | ||
| 645 | The LDAP scheme is defined in RFC 2255. | 775 | The LDAP scheme is defined in RFC 2255. |
| 646 | 776 | ||
| 647 | @node imap | ||
| 648 | @section imap | ||
| 649 | @cindex IMAP | ||
| 650 | |||
| 651 | RFC 2192 | ||
| 652 | |||
| 653 | @node man | 777 | @node man |
| 654 | @section man | 778 | @section man |
| 655 | @cindex @command{man} | 779 | @cindex @command{man} |
| 656 | @cindex Unix man pages | 780 | @cindex Unix man pages |
| 657 | @findex man | 781 | @findex man |
| 658 | 782 | ||
| 783 | The @code{man} scheme is a non-standard one. Such URLs have the form | ||
| 784 | |||
| 659 | @example | 785 | @example |
| 660 | @samp{man:@var{page-spec}} | 786 | @samp{man:@var{page-spec}} |
| 661 | @end example | 787 | @end example |
| 662 | 788 | ||
| 663 | This is a non-standard scheme. @var{page-spec} is passed directly to | 789 | @noindent |
| 664 | the Lisp @code{man} function. | 790 | and are retrieved by passing @var{page-spec} to the Lisp function |
| 665 | 791 | @code{man}. | |
| 666 | @node Defining New URLs | ||
| 667 | @chapter Defining New URLs | ||
| 668 | |||
| 669 | @menu | ||
| 670 | * Naming conventions:: | ||
| 671 | * Required functions:: | ||
| 672 | * Optional functions:: | ||
| 673 | * Asynchronous fetching:: | ||
| 674 | * Supporting file-name-handlers:: | ||
| 675 | @end menu | ||
| 676 | |||
| 677 | @node Naming conventions | ||
| 678 | @section Naming conventions | ||
| 679 | |||
| 680 | @node Required functions | ||
| 681 | @section Required functions | ||
| 682 | |||
| 683 | @node Optional functions | ||
| 684 | @section Optional functions | ||
| 685 | |||
| 686 | @node Asynchronous fetching | ||
| 687 | @section Asynchronous fetching | ||
| 688 | |||
| 689 | @node Supporting file-name-handlers | ||
| 690 | @section Supporting file-name-handlers | ||
| 691 | 792 | ||
| 692 | @node General Facilities | 793 | @node General Facilities |
| 693 | @chapter General Facilities | 794 | @chapter General Facilities |
| @@ -1108,11 +1209,9 @@ You can use this function to do completion of URLs from the history. | |||
| 1108 | @node Customization | 1209 | @node Customization |
| 1109 | @chapter Customization | 1210 | @chapter Customization |
| 1110 | 1211 | ||
| 1111 | @section Environment Variables | ||
| 1112 | |||
| 1113 | @cindex environment variables | 1212 | @cindex environment variables |
| 1114 | The following environment variables affect the library's operation at | 1213 | The following environment variables affect the @code{url} library's |
| 1115 | startup. | 1214 | operation at startup. |
| 1116 | 1215 | ||
| 1117 | @table @code | 1216 | @table @code |
| 1118 | @item TMPDIR | 1217 | @item TMPDIR |
| @@ -1122,10 +1221,21 @@ If this is defined, @var{url-temporary-directory} is initialized from | |||
| 1122 | it. | 1221 | it. |
| 1123 | @end table | 1222 | @end table |
| 1124 | 1223 | ||
| 1125 | @section General User Options | 1224 | The following user options affect the general operation of |
| 1225 | @code{url} library. | ||
| 1126 | 1226 | ||
| 1127 | The following user options, settable with Customize, affect the | 1227 | @defopt url-configuration-directory |
| 1128 | general operation of the package. | 1228 | @cindex configuration files |
| 1229 | The value of this variable specifies the name of the directory where | ||
| 1230 | the @code{url} library stores its various configuration files, cache | ||
| 1231 | files, etc. | ||
| 1232 | |||
| 1233 | The default value specifies a subdirectory named @file{url/} in the | ||
| 1234 | standard Emacs user data directory specified by the variable | ||
| 1235 | @code{user-emacs-directory} (normally @file{~/.emacs.d}). However, | ||
| 1236 | the old default was @file{~/.url}, and this directory is used instead | ||
| 1237 | if it exists. | ||
| 1238 | @end defopt | ||
| 1129 | 1239 | ||
| 1130 | @defopt url-debug | 1240 | @defopt url-debug |
| 1131 | @cindex debugging | 1241 | @cindex debugging |