aboutsummaryrefslogtreecommitdiffstats
path: root/doc/misc
diff options
context:
space:
mode:
authorEli Zaretskii2012-11-13 16:17:18 +0200
committerEli Zaretskii2012-11-13 16:17:18 +0200
commit3c4ca7155293ffc2d04708007131bcbc882d8913 (patch)
tree61787be8cd43b6fb3d5159852fbd186eea404de7 /doc/misc
parent5ade42a5114255c43117065494b96d480c1e1588 (diff)
parentc708524567662c8911c5ab2695acc7bda0383705 (diff)
downloademacs-3c4ca7155293ffc2d04708007131bcbc882d8913.tar.gz
emacs-3c4ca7155293ffc2d04708007131bcbc882d8913.zip
Merge from trunk.
Diffstat (limited to 'doc/misc')
-rw-r--r--doc/misc/ChangeLog65
-rw-r--r--doc/misc/cl.texi471
-rw-r--r--doc/misc/flymake.texi20
-rw-r--r--doc/misc/gnus.texi41
-rw-r--r--doc/misc/ses.texi123
-rw-r--r--doc/misc/texinfo.tex37
-rw-r--r--doc/misc/url.texi644
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 @@
12012-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
72012-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
172012-11-12 Paul Eggert <eggert@cs.ucla.edu>
18
19 * texinfo.tex: Merge from gnulib.
20
212012-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
362012-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
502012-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
612012-11-02 Katsumi Yamaoka <yamaoka@jpl.org>
62
63 * gnus.texi (Mail Source Specifiers):
64 Document :leave keyword used for pop mail source.
65
12012-11-01 Glenn Morris <rgm@gnu.org> 662012-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
108Some features are too complex or bulky relative to their benefit 108Some features are too complex or bulky relative to their benefit
109to Emacs Lisp programmers. CLOS and Common Lisp streams are fine 109to Emacs Lisp programmers. CLOS and Common Lisp streams are fine
110examples of this group. 110examples of this group. (The separate package EIEIO implements
111a subset of CLOS functionality. @xref{Top, , Introduction, eieio, EIEIO}.)
111 112
112@item 113@item
113Other features cannot be implemented without modification to the 114Other 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
231cl-callf cl-callf2 cl-defsubst 232cl-callf cl-callf2 cl-defsubst
232cl-floatp-safe cl-letf cl-letf* 233cl-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
241cl-evenp cl-oddp cl-minusp 242cl-evenp cl-oddp cl-minusp
242cl-plusp cl-floatp-safe cl-endp 243cl-plusp cl-endp cl-subst
243cl-copy-list cl-list* cl-ldiff 244cl-copy-list cl-list* cl-ldiff
244cl-rest cl-decf [1] cl-incf [1] 245cl-rest cl-decf [1] cl-incf [1]
245cl-acons cl-adjoin [2] cl-pairlis 246cl-acons cl-adjoin [2] cl-pairlis
246cl-pushnew [1,2] cl-declaim cl-proclaim 247cl-pushnew [1,2] cl-declaim cl-proclaim
247cl-caaar@dots{}cl-cddddr cl-first@dots{}cl-tenth 248cl-caaar@dots{}cl-cddddr cl-first@dots{}cl-tenth
248cl-subst cl-mapcar [3] 249cl-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.
300This is analogous to the @code{defsubst} form; 301This 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
302works in all versions of Emacs, and also generates somewhat more 303works 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
304efficient inline expansions. In particular, @code{cl-defsubst} 306efficient inline expansions. In particular, @code{cl-defsubst}
305arranges for the processing of keyword arguments, default values, 307arranges for the processing of keyword arguments, default values,
306etc., to be done at compile-time whenever possible. 308etc., to be done at compile-time whenever possible.
@@ -702,11 +704,13 @@ The type symbol @code{real} is a synonym for @code{number}, and
702The type symbols @code{character} and @code{string-char} match 704The type symbols @code{character} and @code{string-char} match
703integers in the range from 0 to 255. 705integers 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
706The type symbol @code{float} uses the @code{cl-floatp-safe} predicate 710The type symbol @code{float} uses the @code{cl-floatp-safe} predicate
707defined by this package rather than @code{floatp}, so it will work 711defined by this package rather than @code{floatp}, so it will work
708@c FIXME are any such platforms still relevant?
709correctly even in Emacs versions without floating-point support. 712correctly even in Emacs versions without floating-point support.
713@end ignore
710 714
711@item 715@item
712The type list @code{(integer @var{low} @var{high})} represents all 716The 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
971The generalized variable @code{buffer-substring}, listed above, 975The generalized variable @code{buffer-substring}, listed above,
972also works in this way by replacing a portion of the current buffer. 976also 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
990A macro call, in which case the macro is expanded and @code{setf} 995A macro call, in which case the macro is expanded and @code{setf}
991is applied to the resulting form. 996is applied to the resulting form.
992
993@item
994Any form for which a @code{defsetf} or @code{define-setf-method}
995has 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
1521similar to @code{catch} and @code{throw}, with lexical scoping. 1522similar to @code{catch} and @code{throw}, with lexical scoping.
1522This package actually implements @code{cl-block} 1523This package actually implements @code{cl-block}
1523in terms of @code{catch}; however, the lexical scoping allows the 1524in terms of @code{catch}; however, the lexical scoping allows the
1524optimizing byte-compiler to omit the costly @code{catch} step if the 1525byte-compiler to omit the costly @code{catch} step if the
1525body of the block does not actually @code{cl-return-from} the block. 1526body 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.
1558Because they are implemented in terms of Emacs Lisp's @code{catch} 1559Because they are implemented in terms of Emacs Lisp's @code{catch}
1559and @code{throw}, blocks have the same overhead as actual 1560and @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,
1561the optimizing byte compiler will optimize away the @code{catch} 1562the byte compiler will optimize away the @code{catch}
1562if the block does 1563if the block does
1563not in fact contain any @code{cl-return} or @code{cl-return-from} calls 1564not in fact contain any @code{cl-return} or @code{cl-return-from} calls
1564that jump to it. This means that @code{cl-do} loops and @code{cl-defun} 1565that 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
1726A common complaint with Lisp's traditional looping constructs is 1727A common complaint with Lisp's traditional looping constructs was
1727that they are either too simple and limited, such as Common Lisp's 1728that they were either too simple and limited, such as @code{dotimes}
1728@code{dotimes} or Emacs Lisp's @code{while}, or too unreadable and 1729or @code{while}, or too unreadable and obscure, like Common Lisp's
1729obscure, like Common Lisp's @code{do} loop. 1730@code{do} loop.
1730 1731
1731To remedy this, recent versions of Common Lisp have added a new 1732To remedy this, Common Lisp added a construct called the ``Loop
1732construct called the ``Loop Facility'' or ``@code{loop} macro'', 1733Facility'' or ``@code{loop} macro'', with an easy-to-use but very
1733with an easy-to-use but very powerful and expressive syntax. 1734powerful 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
1767loop: 1768loop:
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
1775The @var{name-clause} optionally gives a name to the implicit 1776The @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
1795break out of the loop.) 1796break out of the loop.)
1796@end defmac 1797@end defmac
1797 1798
1798The following sections give some examples of the Loop Macro in 1799The following sections give some examples of the loop macro in
1799action, and describe the particular loop clauses in great detail. 1800action, and describe the particular loop clauses in great detail.
1800Consult the second edition of Steele for additional discussion 1801Consult the second edition of Steele for additional discussion
1801and examples of the @code{loop} macro. 1802and 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,
2162based on the value of @code{x} left over from the previous time 2163based on the value of @code{x} left over from the previous time
2163through the loop. 2164through the loop.
2164 2165
2165Another feature of the @code{cl-loop} macro is @dfn{destructuring}, 2166Another feature of the @code{cl-loop} macro is @emph{destructuring},
2166similar in concept to the destructuring provided by @code{defmacro}. 2167similar in concept to the destructuring provided by @code{defmacro}
2168(@pxref{Argument Lists}).
2167The @var{var} part of any @code{for} clause can be given as a list 2169The @var{var} part of any @code{for} clause can be given as a list
2168of variables instead of a single variable. The values produced 2170of variables instead of a single variable. The values produced
2169during loop execution must be lists; the values in the lists are 2171during 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}
2443This clause causes the loop to return immediately. The following 2445This clause causes the loop to return immediately. The following
2444Lisp form is evaluated to give the return value of the @code{loop} 2446Lisp form is evaluated to give the return value of the loop
2445form. The @code{finally} clauses, if any, are not executed. 2447form. The @code{finally} clauses, if any, are not executed.
2446Of course, @code{return} is generally used inside an @code{if} or 2448Of 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
2448the loop would never get to ``loop'' more than once. 2450the loop would never get to ``loop'' more than once.
2449 2451
2450The clause @samp{return @var{form}} is equivalent to 2452The 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
2453was named). The @code{return} clause is implemented a bit more 2454was named). The @code{return} clause is implemented a bit more
2454efficiently, though. 2455efficiently, though.
2455@end table 2456@end table
@@ -2463,7 +2464,7 @@ clause, respectively. Consult the source code in file
2463 2464
2464This package's @code{cl-loop} macro is compatible with that of Common 2465This package's @code{cl-loop} macro is compatible with that of Common
2465Lisp, except that a few features are not implemented: @code{loop-finish} 2466Lisp, except that a few features are not implemented: @code{loop-finish}
2466and data-type specifiers. Naturally, the @code{for} clauses which 2467and data-type specifiers. Naturally, the @code{for} clauses that
2467iterate over keymaps, overlays, intervals, frames, windows, and 2468iterate over keymaps, overlays, intervals, frames, windows, and
2468buffers are Emacs-specific extensions. 2469buffers are Emacs-specific extensions.
2469 2470
@@ -2516,17 +2517,17 @@ Destructuring is made available to the user by way of the
2516following macro: 2517following macro:
2517 2518
2518@defmac cl-destructuring-bind arglist expr forms@dots{} 2519@defmac cl-destructuring-bind arglist expr forms@dots{}
2519This macro expands to code which executes @var{forms}, with 2520This macro expands to code that executes @var{forms}, with
2520the variables in @var{arglist} bound to the list of values 2521the variables in @var{arglist} bound to the list of values
2521returned by @var{expr}. The @var{arglist} can include all 2522returned by @var{expr}. The @var{arglist} can include all
2522the features allowed for @code{defmacro} argument lists, 2523the features allowed for @code{cl-defmacro} argument lists,
2523including destructuring. (The @code{&environment} keyword 2524including destructuring. (The @code{&environment} keyword
2524is not allowed.) The macro expansion will signal an error 2525is not allowed.) The macro expansion will signal an error
2525if @var{expr} returns a list of the wrong number of arguments 2526if @var{expr} returns a list of the wrong number of arguments
2526or with incorrect keyword arguments. 2527or with incorrect keyword arguments.
2527@end defmac 2528@end defmac
2528 2529
2529This package also includes the Common Lisp @code{cl-define-compiler-macro} 2530This package also includes the Common Lisp @code{define-compiler-macro}
2530facility, which allows you to define compile-time expansions and 2531facility, which allows you to define compile-time expansions and
2531optimizations for your functions. 2532optimizations 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
2589about the types of data that will be stored in particular variables, 2590about the types of data that will be stored in particular variables,
2590and about the ways those variables and functions will be used. This 2591and about the ways those variables and functions will be used. This
2591package defines versions of all the Common Lisp declaration forms: 2592package 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},
2593and @code{cl-the}. 2594and @code{the}.
2594 2595
2595Most of the Common Lisp declarations are not currently useful in 2596Most of the Common Lisp declarations are not currently useful in Emacs
2596Emacs Lisp, as the byte-code system provides little opportunity 2597Lisp. For example, the byte-code system provides little
2597to benefit from type information, and @code{special} declarations 2598opportunity to benefit from type information.
2598are redundant in a fully dynamically-scoped Lisp. A few 2599@ignore
2599declarations are meaningful when the optimizing byte 2600and @code{special} declarations are redundant in a fully
2600compiler is being used, however. Under the earlier non-optimizing 2601dynamically-scoped Lisp.
2601compiler, these declarations will effectively be ignored. 2602@end ignore
2603A few declarations are meaningful when byte compiler optimizations
2604are enabled, as they are by the default. Otherwise these
2605declarations will effectively be ignored.
2602 2606
2603@defun cl-proclaim decl-spec 2607@defun cl-proclaim decl-spec
2604This function records a ``global'' declaration specified by 2608This 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{}
2610This macro is like @code{cl-proclaim}, except that it takes any number 2614This macro is like @code{cl-proclaim}, except that it takes any number
2611of @var{decl-spec} arguments, and the arguments are unevaluated and 2615of @var{decl-spec} arguments, and the arguments are unevaluated and
2612unquoted. The @code{cl-declaim} macro also puts an @code{(cl-eval-when 2616unquoted. 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
2614be registered at compile-time as well as at run-time. (This is vital, 2618be registered at compile-time as well as at run-time. (This is vital,
2615since normally the declarations are meant to influence the way the 2619since 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
2634Type information provided by @code{cl-the} is ignored in this package; 2638Type information provided by @code{cl-the} is ignored in this package;
2635in other words, @code{(cl-the @var{type} @var{form})} is equivalent 2639in other words, @code{(cl-the @var{type} @var{form})} is equivalent to
2636to @var{form}. Future versions of the optimizing byte-compiler may 2640@var{form}. Future byte-compiler optimizations may make use of this
2637make use of this information. 2641information.
2638 2642
2639For example, @code{mapcar} can map over both lists and arrays. It is 2643For example, @code{mapcar} can map over both lists and arrays. It is
2640hard for the compiler to expand @code{mapcar} into an in-line loop 2644hard 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 ?
2658Since all variables in Emacs Lisp are ``special'' (in the Common 2663Since all variables in Emacs Lisp are ``special'' (in the Common
2659Lisp sense), @code{special} declarations are only advisory. They 2664Lisp sense), @code{special} declarations are only advisory. They
2660simply tell the optimizing byte compiler that the specified 2665simply tell the byte compiler that the specified
2661variables are intentionally being referred to without being 2666variables are intentionally being referred to without being
2662bound in the body of the function. The compiler normally emits 2667bound in the body of the function. The compiler normally emits
2663warnings for such references, since they could be typographical 2668warnings for such references, since they could be typographical
2664errors for references to local variables. 2669errors for references to local variables.
2665 2670
2666The declaration @code{(cl-declare (special @var{var1} @var{var2}))} is 2671The declaration @code{(cl-declare (special @var{var1} @var{var2}))} is
2667equivalent to @code{(defvar @var{var1}) (defvar @var{var2})} in the 2672equivalent to @code{(defvar @var{var1}) (defvar @var{var2})}.
2668optimizing compiler, or to nothing at all in older compilers (which
2669do not warn for non-local references).
2670 2673
2671In top-level contexts, it is generally better to write 2674In 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}))},
2673since @code{defvar} makes your intentions clearer. But the older 2676since @code{defvar} makes your intentions clearer.
2674byte compilers can not handle @code{defvar}s appearing inside of
2675functions, while @code{(cl-declare (special @var{var}))} takes care
2676to work correctly with all compilers.
2677 2677
2678@item inline 2678@item inline
2679The @code{inline} @var{decl-spec} lists one or more functions 2679The @code{inline} @var{decl-spec} lists one or more functions
2680whose bodies should be expanded ``in-line'' into calling functions 2680whose bodies should be expanded ``in-line'' into calling functions
2681whenever the compiler is able to arrange for it. For example, 2681whenever the compiler is able to arrange for it. For example,
2682the Common Lisp function @code{cadr} is declared @code{inline} 2682the function @code{cl-acons} is declared @code{inline}
2683by this package so that the form @code{(cadr @var{x})} will 2683by this package so that the form @code{(cl-acons @var{key} @var{value}
2684expand directly into @code{(car (cdr @var{x}))} when it is called 2684@var{alist})} will
2685in user functions, for a savings of one (relatively expensive) 2685expand directly into @code{(cons (cons @var{key} @var{value}) @var{alist})}
2686function call. 2686when it is called in user functions, so as to save function calls.
2687 2687
2688The following declarations are all equivalent. Note that the 2688The 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,
2702but it is impolite to use it to request inlining of an external 2702but it is impolite to use it to request inlining of an external
2703function. 2703function.
2704 2704
2705In Common Lisp, it is possible to use @code{(cl-declare (inline @dots{}))} 2705In Common Lisp, it is possible to use @code{(declare (inline @dots{}))}
2706before a particular call to a function to cause just that call to 2706before a particular call to a function to cause just that call to
2707be inlined; the current byte compilers provide no way to implement 2707be inlined; the current byte compilers provide no way to implement
2708this, so @code{(cl-declare (inline @dots{}))} is currently ignored by 2708this, so @code{(cl-declare (inline @dots{}))} is currently ignored by
@@ -2715,8 +2715,7 @@ declaration.
2715 2715
2716@item optimize 2716@item optimize
2717This declaration controls how much optimization is performed by 2717This declaration controls how much optimization is performed by
2718the compiler. Naturally, it is ignored by the earlier non-optimizing 2718the compiler.
2719compilers.
2720 2719
2721The word @code{optimize} is followed by any number of lists like 2720The 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
27250 to 3, with 0 meaning ``unimportant'' and 3 meaning ``very important''. 27240 to 3, with 0 meaning ``unimportant'' and 3 meaning ``very important''.
2726The default level for both qualities is 1. 2725The default level for both qualities is 1.
2727 2726
2728In this package, with the optimizing compiler, the 2727In this package, the @code{speed} quality is tied to the @code{byte-optimize}
2729@code{speed} quality is tied to the @code{byte-optimize}
2730flag, which is set to @code{nil} for @code{(speed 0)} and to 2728flag, 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
2732tied to the @code{byte-compile-delete-errors} flag, which is 2730tied 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
2746The @code{optimize} declaration is normally used in a top-level 2744The @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
2748it to be used with @code{cl-declare} to set the level of optimization 2746it to be used with @code{declare} to set the level of optimization
2749locally for a given form, but this will not work correctly with the 2747locally for a given form, but this will not work correctly with the
2750current version of the optimizing compiler. (The @code{cl-declare} 2748current byte-compiler. (The @code{cl-declare}
2751will set the new optimization level, but that level will not 2749will set the new optimization level, but that level will not
2752automatically be unset after the enclosing form is done.) 2750automatically be unset after the enclosing form is done.)
2753 2751
2754@item warn 2752@item warn
2755This declaration controls what sorts of warnings are generated 2753This declaration controls what sorts of warnings are generated
2756by the byte compiler. Again, only the optimizing compiler 2754by the byte compiler. The word @code{warn} is followed by any
2757generates warnings. The word @code{warn} is followed by any
2758number of ``warning qualities'', similar in form to optimization 2755number of ``warning qualities'', similar in form to optimization
2759qualities. The currently supported warning types are 2756qualities. 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
2762disable these warnings and any higher value will enable them. 2759disable these warnings and any higher value will enable them.
2763See the documentation for the optimizing byte compiler for details. 2760See the documentation of the variable @code{byte-compile-warnings}
2761for 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
2873are used in macro expansions for temporary variables, to ensure that 2871are used in macro expansions for temporary variables, to ensure that
2874their names will not conflict with ``real'' variables in the user's 2872their names will not conflict with ``real'' variables in the user's
2875code. 2873code.
2876@end defun
2877 2874
2878@defvar cl--gensym-counter 2875(Internally, the variable @code{cl--gensym-counter} holds the counter
2879This variable holds the counter used to generate @code{cl-gensym} names. 2876used to generate names. It is incremented after each use. In Common
2880It is incremented after each use by @code{cl-gensym}. In Common Lisp 2877Lisp this is initialized with 0, but this package initializes it with
2881this is initialized with 0, but this package initializes it with a 2878a random time-dependent value to avoid trouble when two files that
2882random (time-dependent) value to avoid trouble when two files that
2883each used @code{cl-gensym} in their compilation are loaded together. 2879each used @code{cl-gensym} in their compilation are loaded together.
2884(Uninterned symbols become interned when the compiler writes them 2880Uninterned symbols become interned when the compiler writes them out
2885out to a file and the Emacs loader loads them, so their names have to 2881to a file and the Emacs loader loads them, so their names have to be
2886be treated a bit more carefully than in Common Lisp where uninterned 2882treated a bit more carefully than in Common Lisp where uninterned
2887symbols remain uninterned after loading.) 2883symbols remain uninterned after loading.)
2888@end defvar 2884@end defun
2889 2885
2890@defun cl-gentemp &optional x 2886@defun cl-gentemp &optional x
2891This function is like @code{cl-gensym}, except that it produces a new 2887This function is like @code{cl-gensym}, except that it produces a new
@@ -2905,13 +2901,13 @@ provided.
2905 2901
2906@noindent 2902@noindent
2907This section defines a few simple Common Lisp operations on numbers 2903This section defines a few simple Common Lisp operations on numbers
2908which were left out of Emacs Lisp. 2904that 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
2941error if the argument is not an integer. 2937error 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
2945This predicate tests whether @var{object} is a floating-point 2942This predicate tests whether @var{object} is a floating-point
2946number. On systems that support floating-point, this is equivalent 2943number. On systems that support floating-point, this is equivalent
2947to @code{floatp}. On other systems, this always returns @code{nil}. 2944to @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}.
3036This package also provides an implementation of the Common Lisp 3034This package also provides an implementation of the Common Lisp
3037random number generator. It uses its own additive-congruential 3035random number generator. It uses its own additive-congruential
3038algorithm, which is much more likely to give statistically clean 3036algorithm, which is much more likely to give statistically clean
3037@c FIXME? Still true?
3039random numbers than the simple generators supplied by many 3038random numbers than the simple generators supplied by many
3040operating systems. 3039operating systems.
3041 3040
@@ -3043,22 +3042,16 @@ operating systems.
3043This function returns a random nonnegative number less than 3042This 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).
3045The @var{state} argument should be a @code{random-state} object 3044The @var{state} argument should be a @code{random-state} object
3046which holds the state of the random number generator. The 3045that holds the state of the random number generator. The
3047function modifies this state object as a side effect. If 3046function 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. 3049default @code{random-state} object. (Since any number of programs in
3050the Emacs process may be accessing @code{cl--random-state} in
3051interleaved fashion, the sequence generated from this will be
3052irreproducible for all intents and purposes.)
3051@end defun 3053@end defun
3052 3054
3053@defvar cl--random-state
3054This variable contains the system ``default'' @code{random-state}
3055object, used for calls to @code{cl-random} that do not specify an
3056alternative state object. Since any number of programs in the
3057Emacs process may be accessing @code{cl--random-state} in interleaved
3058fashion, the sequence generated from this variable will be
3059irreproducible 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
3063This function creates or copies a @code{random-state} object. 3056This function creates or copies a @code{random-state} object.
3064If @var{state} is omitted or @code{nil}, it returns a new copy of 3057If @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
3097This package defines several useful constants having to with numbers. 3090This package defines several useful constants having to do with
3091floating-point numbers.
3098 3092
3099The following parameters have to do with floating-point numbers. 3093It determines their values by exercising the computer's
3100This package determines their values by exercising the computer's
3101floating-point arithmetic in various ways. Because this operation 3094floating-point arithmetic in various ways. Because this operation
3102might be slow, the code for initializing them is kept in a separate 3095might be slow, the code for initializing them is kept in a separate
3103function that must be called before the parameters can be used. 3096function 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
3106This function makes sure that the Common Lisp floating-point parameters 3099This function makes sure that the Common Lisp floating-point parameters
3107like @code{cl-most-positive-float} have been initialized. Until it is 3100like @code{cl-most-positive-float} have been initialized. Until it is
3108called, these parameters will be @code{nil}. If this version of Emacs 3101called, these parameters will be @code{nil}.
3109does 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
3110parameters have already been initialized, the function returns 3103@c remain @code{nil}.
3104If the parameters have already been initialized, the function returns
3111immediately. 3105immediately.
3112 3106
3113The algorithm makes assumptions that will be valid for most modern 3107The algorithm makes assumptions that will be valid for almost all
3114machines, but will fail if the machine's arithmetic is extremely 3108machines, but will fail if the machine's arithmetic is extremely
3115unusual, e.g., decimal. 3109unusual, 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
3133This constant equals the most-negative value a Lisp float can hold. 3127This 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.
3199The @code{:key} argument should be passed either @code{nil}, or a 3193The @code{:key} argument should be passed either @code{nil}, or a
3200function of one argument. This key function is used as a filter 3194function of one argument. This key function is used as a filter
3201through which the elements of the sequence are seen; for example, 3195through 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)}.
3203It searches for an element of the list whose @sc{car} equals 3197It 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.
3205If @code{:key} is omitted or @code{nil}, the filter is effectively 3199If @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
3218indicate a match. The default test function is @code{eql}. 3212indicate a match. The default test function is @code{eql}.
3219 3213
3220Many functions which take @var{item} and @code{:test} or @code{:test-not} 3214Many functions that take @var{item} and @code{:test} or @code{:test-not}
3221arguments also come in @code{-if} and @code{-if-not} varieties, 3215arguments also come in @code{-if} and @code{-if-not} varieties,
3222where a @var{predicate} function is passed instead of @var{item}, 3216where a @var{predicate} function is passed instead of @var{item},
3223and sequence elements match if the predicate returns true on them 3217and 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
3231to remove all zeros from sequence @code{seq}. 3225to remove all zeros from sequence @code{seq}.
3232 3226
3233Some operations can work on a subsequence of the argument sequence; 3227Some operations can work on a subsequence of the argument sequence;
3234these function take @code{:start} and @code{:end} arguments which 3228these function take @code{:start} and @code{:end} arguments, which
3235default to zero and the length of the sequence, respectively. 3229default to zero and the length of the sequence, respectively.
3236Only elements between @var{start} (inclusive) and @var{end} 3230Only 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
3340This function calls @var{predicate} on each element of @var{seq} 3334This function calls @var{predicate} on each element of @var{seq}
3341in turn; if @var{predicate} returns a non-@code{nil} value, 3335in 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}.
3343Given several sequence arguments, it steps through the sequences 3337Given several sequence arguments, it steps through the sequences
3344in parallel until the shortest one runs out, just as in 3338in 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
3391If @code{:key} is specified, it is a function of one argument which 3385If @code{:key} is specified, it is a function of one argument, which
3392is called on each of the sequence elements in turn. 3386is called on each of the sequence elements in turn.
3393 3387
3394If @code{:initial-value} is specified, it is effectively added to the 3388If @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
3457If @var{seq1} and @var{seq2} are @code{eq}, then the replacement 3451If @var{seq1} and @var{seq2} are @code{eq}, then the replacement
3458will work correctly even if the regions indicated by the start 3452will work correctly even if the regions indicated by the start
3459and end arguments overlap. However, if @var{seq1} and @var{seq2} 3453and end arguments overlap. However, if @var{seq1} and @var{seq2}
3460are lists which share storage but are not @code{eq}, and the 3454are lists that share storage but are not @code{eq}, and the
3461start and end arguments specify overlapping regions, the effect 3455start and end arguments specify overlapping regions, the effect
3462is undefined. 3456is 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}
3483This deletes all elements of @var{seq} which match @var{item}. 3477This deletes all elements of @var{seq} that match @var{item}.
3484It is a destructive operation. Since Emacs Lisp does not support 3478It is a destructive operation. Since Emacs Lisp does not support
3485stretchable strings or vectors, this is the same as @code{cl-remove} 3479stretchable strings or vectors, this is the same as @code{cl-remove}
3486for those sequence types. On lists, @code{cl-remove} will copy the 3480for those sequence types. On lists, @code{cl-remove} will copy the
@@ -3580,7 +3574,7 @@ elements match (according to @code{:test}, @code{:test-not},
3580and @code{:key}), the function returns @code{nil}. If there is 3574and @code{:key}), the function returns @code{nil}. If there is
3581a mismatch, the function returns the index (relative to @var{seq1}) 3575a mismatch, the function returns the index (relative to @var{seq1})
3582of the first mismatching element. This will be the leftmost pair of 3576of the first mismatching element. This will be the leftmost pair of
3583elements which do not match, or the position at which the shorter of 3577elements that do not match, or the position at which the shorter of
3584the two otherwise-matching sequences runs out. 3578the two otherwise-matching sequences runs out.
3585 3579
3586If @code{:from-end} is true, then the elements are compared from right 3580If @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}
3596This function searches @var{seq2} for a subsequence that matches 3590This 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
3599defined by @code{:start2} and @code{:end2} will be considered. 3593defined by @code{:start2} and @code{:end2} will be considered.
3600The return value is the index of the leftmost element of the 3594The return value is the index of the leftmost element of the
3601leftmost match, relative to the start of @var{seq2}, or @code{nil} 3595leftmost 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}
3610This function sorts @var{seq} into increasing order as determined 3604This function sorts @var{seq} into increasing order as determined
3611by using @var{predicate} to compare pairs of elements. @var{predicate} 3605by using @var{predicate} to compare pairs of elements. @var{predicate}
3612should return true (non-@code{nil}) if and only if its first argument 3606should 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
3618This function differs from Emacs's built-in @code{sort} in that it 3612This function differs from Emacs's built-in @code{sort} in that it
3619can operate on any type of sequence, not just lists. Also, it 3613can operate on any type of sequence, not just lists. Also, it
3620accepts a @code{:key} argument which is used to preprocess data 3614accepts a @code{:key} argument, which is used to preprocess data
3621fed to the @var{predicate} function. For example, 3615fed 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,
3628sorts @var{data}, a sequence of strings, into increasing alphabetical 3622sorts @var{data}, a sequence of strings, into increasing alphabetical
3629order without regard to case. A @code{:key} function of @code{car} 3623order without regard to case. A @code{:key} function of @code{car}
3630would be useful for sorting association lists. It should only be a 3624would be useful for sorting association lists. It should only be a
3631simple accessor though, it's used heavily in the current 3625simple accessor though, since it's used heavily in the current
3632implementation. 3626implementation.
3633 3627
3634The @code{cl-sort} function is destructive; it sorts lists by actually 3628The @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
3686This function is equivalent to @code{(car (cdr (cdr @var{x})))}. 3680This function is equivalent to @code{(car (cdr (cdr @var{x})))}.
3687Likewise, this package defines all 28 @code{c@var{xxx}r} functions 3681Likewise, this package defines all 24 @code{c@var{xxx}r} functions
3688where @var{xxx} is up to four @samp{a}s and/or @samp{d}s. 3682where @var{xxx} is up to four @samp{a}s and/or @samp{d}s.
3689All of these functions are @code{setf}-able, and calls to them 3683All of these functions are @code{setf}-able, and calls to them
3690are expanded inline by the byte-compiler for maximum efficiency. 3684are 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
3713list (where the @sc{cdr}-chain forms a loop rather than terminating 3707list (where the @sc{cdr}-chain forms a loop rather than terminating
3714with @code{nil}), this function returns @code{nil}. (The regular 3708with @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.
3710See 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
3740dotted lists like @code{(1 2 . 3)} correctly. 3735dotted lists like @code{(1 2 . 3)} correctly.
3741@end defun 3736@end defun
3742 3737
3743@defun copy-tree x &optional vecp
3744This 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.
3746Unlike @code{copy-sequence} (and its alias @code{cl-copy-list}),
3747which copies only along the @sc{cdr} direction, this function
3748copies (recursively) along both the @sc{car} and the @sc{cdr}
3749directions. If @var{x} is not a cons cell, the function simply
3750returns @var{x} unchanged. If the optional @var{vecp} argument
3751is true, this function copies vectors (recursively) as well as
3752cons 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}
3756This function compares two trees of cons cells. If @var{x} and 3739This 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
3817These functions perform operations on lists which represent sets 3800These functions perform operations on lists that represent sets
3818of elements. 3801of 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
3828The standard Emacs lisp function @code{member} uses @code{equal} for 3811The standard Emacs lisp function @code{member} uses @code{equal} for
3829comparisons; it is equivalent to @code{(cl-member @var{item} @var{list} 3812comparisons; 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
3814equivalent 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
3835The @code{cl-member-if} and @code{cl-member-if-not} functions 3819The @code{cl-member-if} and @code{cl-member-if-not} functions
3836analogously search for elements which satisfy a given predicate. 3820analogously search for elements that satisfy a given predicate.
3837 3821
3838@defun cl-tailp sublist list 3822@defun cl-tailp sublist list
3839This function returns @code{t} if @var{sublist} is a sublist of 3823This 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}
3855This function combines two lists which represent sets of items, 3839This function combines two lists that represent sets of items,
3856returning a list that represents the union of those two sets. 3840returning a list that represents the union of those two sets.
3857The result list will contain all items which appear in @var{list1} 3841The resulting list contains all items that appear in @var{list1}
3858or @var{list2}, and no others. If an item appears in both 3842or @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
3860an item is duplicated in @var{list1} or @var{list2}, it is 3844an item is duplicated in @var{list1} or @var{list2}, it is
3861undefined whether or not that duplication will survive in the 3845undefined whether or not that duplication will survive in the
3862result list. The order of elements in the result list is also 3846result 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}
3872This function computes the intersection of the sets represented 3856This function computes the intersection of the sets represented
3873by @var{list1} and @var{list2}. It returns the list of items 3857by @var{list1} and @var{list2}. It returns the list of items
3874which appear in both @var{list1} and @var{list2}. 3858that 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
3921element whose @sc{car} matches (in the sense of @code{:test}, 3905element 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})
3923a given @var{item}. It returns the matching element, if any, 3907a given @var{item}. It returns the matching element, if any,
3924otherwise @code{nil}. It ignores elements of @var{a-list} which 3908otherwise @code{nil}. It ignores elements of @var{a-list} that
3925are not cons cells. (This corresponds to the behavior of 3909are 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
3985defines a struct type called @code{person} which contains three 3969defines a struct type called @code{person} that contains three
3986slots. Given a @code{person} object @var{p}, you can access those 3970slots. Given a @code{person} object @var{p}, you can access those
3987slots by calling @code{(person-name @var{p})}, @code{(person-age @var{p})}, 3971slots by calling @code{(person-name @var{p})}, @code{(person-age @var{p})},
3988and @code{(person-sex @var{p})}. You can also change these slots by 3972and @code{(person-sex @var{p})}. You can also change these slots by
3989using @code{setf} on any of these place forms: 3973using @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
4003object of the same type whose slots are @code{eq} to those of @var{p}. 3987object of the same type whose slots are @code{eq} to those of @var{p}.
4004 3988
4005Given any Lisp object @var{x}, @code{(person-p @var{x})} returns 3989Given any Lisp object @var{x}, @code{(person-p @var{x})} returns
4006true if @var{x} looks like a @code{person}, false otherwise. (Again, 3990true if @var{x} looks like a @code{person}, and false otherwise. (Again,
4007in Common Lisp this predicate would be exact; in Emacs Lisp the 3991in Common Lisp this predicate would be exact; in Emacs Lisp the
4008best it can do is verify that @var{x} is a vector of the correct 3992best it can do is verify that @var{x} is a vector of the correct
4009length which starts with the correct tag symbol.) 3993length that starts with the correct tag symbol.)
4010 3994
4011Accessors like @code{person-name} normally check their arguments 3995Accessors 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
4043symbol followed by any number of @dfn{struct options}; each @var{slot} 4027symbol followed by any number of @dfn{struct options}; each @var{slot}
4044is either a slot symbol or a list of the form @samp{(@var{slot-name} 4028is 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}
4046is a Lisp form which is evaluated any time an instance of the 4030is a Lisp form that is evaluated any time an instance of the
4047structure type is created without specifying that slot's value. 4031structure type is created without specifying that slot's value.
4048 4032
4049Common Lisp defines several slot options, but the only one 4033Common Lisp defines several slot options, but the only one
@@ -4101,11 +4085,11 @@ The argument names should match the slot names; each slot is
4101initialized from the corresponding argument. Slots whose names 4085initialized from the corresponding argument. Slots whose names
4102do not appear in the argument list are initialized based on the 4086do 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}
4104and @code{&key} arguments which don't specify defaults take their 4088and @code{&key} arguments that don't specify defaults take their
4105defaults from the slot descriptor. It is valid to include arguments 4089defaults from the slot descriptor. It is valid to include arguments
4106which don't correspond to slot names; these are useful if they are 4090that don't correspond to slot names; these are useful if they are
4107referred to in the defaults for optional, keyword, or @code{&aux} 4091referred to in the defaults for optional, keyword, or @code{&aux}
4108arguments which @emph{do} correspond to slots. 4092arguments that @emph{do} correspond to slots.
4109 4093
4110You can specify any number of full-format @code{:constructor} 4094You can specify any number of full-format @code{:constructor}
4111options on a structure. The default constructor is still generated 4095options on a structure. The default constructor is still generated
@@ -4146,7 +4130,7 @@ means not to generate a copier function. (In this implementation,
4146all copier functions are simply synonyms for @code{copy-sequence}.) 4130all copier functions are simply synonyms for @code{copy-sequence}.)
4147 4131
4148@item :predicate 4132@item :predicate
4149The argument is an alternate name for the predicate which recognizes 4133The argument is an alternate name for the predicate that recognizes
4150objects of this type. The default is @code{@var{name}-p}. @code{nil} 4134objects of this type. The default is @code{@var{name}-p}. @code{nil}
4151means not to generate a predicate function. (If the @code{:type} 4135means not to generate a predicate function. (If the @code{:type}
4152option is used without the @code{:named} option, no predicate is 4136option 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
4208In full Common Lisp, this option allows you to specify a function 4192In full Common Lisp, this option allows you to specify a function
4209which is called to print an instance of the structure type. The 4193that is called to print an instance of the structure type. The
4210Emacs Lisp system offers no hooks into the Lisp printer which would 4194Emacs Lisp system offers no hooks into the Lisp printer which would
4211allow for such a feature, so this package simply ignores 4195allow 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
4383This function takes a single Lisp form as an argument and inserts 4367This function takes a single Lisp form as an argument and inserts
4384a nicely formatted copy of it in the current buffer (which must be 4368a nicely formatted copy of it in the current buffer (which must be
4385in Lisp mode so that indentation works properly). It also expands 4369in Lisp mode so that indentation works properly). It also expands
4386all Lisp macros which appear in the form. The easiest way to use 4370all Lisp macros that appear in the form. The easiest way to use
4387this function is to go to the @file{*scratch*} buffer and type, say, 4371this 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
4394and type @kbd{C-x C-e} immediately after the closing parenthesis; 4378and type @kbd{C-x C-e} immediately after the closing parenthesis;
4395the expansion 4379an 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}.)
4413If the optional argument @var{full} is true, then @emph{all} 4397If the optional argument @var{full} is true, then @emph{all}
4414macros are expanded, including @code{cl-block}, @code{cl-eval-when}, 4398macros are expanded, including @code{cl-block}, @code{cl-eval-when},
4415and compiler macros. Expansion is done as if @var{form} were 4399and compiler macros. Expansion is done as if @var{form} were
4416a top-level form in a file being compiled. For example, 4400a top-level form in a file being compiled.
4401
4402@c FIXME none of these examples are still applicable.
4403@ignore
4404For 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
4427Note that @code{cl-adjoin}, @code{cl-caddr}, and @code{cl-member} all 4416Note that @code{cl-adjoin}, @code{cl-caddr}, and @code{cl-member} all
4428have built-in compiler macros to optimize them in common cases. 4417have 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
4442incompatibility. 4426incompatibility.
4443 4427
4444The Common Lisp standard (as embodied in Steele's book) uses the 4428The Common Lisp standard (as embodied in Steele's book) uses the
4445phrase ``it is an error if'' to indicate a situation which is not 4429phrase ``it is an error if'' to indicate a situation that is not
4446supposed to arise in complying programs; implementations are strongly 4430supposed to arise in complying programs; implementations are strongly
4447encouraged but not required to signal an error in these situations. 4431encouraged but not required to signal an error in these situations.
4448This package sometimes omits such error checking in the interest of 4432This 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
4464defined in this package such as @code{cl-find} and @code{cl-member} 4448defined in this package such as @code{cl-find} and @code{cl-member}
4465do check their keyword arguments for validity. 4449do 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
4475Use of the optimizing Emacs compiler is highly recommended; many of the Common 4454Changing the value of @code{byte-optimize} from the default @code{t}
4455is highly discouraged; many of the Common
4476Lisp macros emit 4456Lisp macros emit
4477code which can be improved by optimization. In particular, 4457code 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
4480optimizing compiler removes @code{cl-block}s which are not actually 4460byte-compiler removes @code{cl-block}s that are not actually
4481referenced by @code{cl-return} or @code{cl-return-from} inside the block. 4461referenced 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
4487Following is a list of all known incompatibilities between this 4467The following is a list of all known incompatibilities between this
4488package and Common Lisp as documented in Steele (2nd edition). 4468package and Common Lisp as documented in Steele (2nd edition).
4489 4469
4490The word @code{cl-defun} is required instead of @code{defun} in order 4470The word @code{cl-defun} is required instead of @code{defun} in order
4491to use extended Common Lisp argument lists in a function. Likewise, 4471to 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
4493which understand full-featured argument lists. The @code{&whole} 4473which understand full-featured argument lists. The @code{&whole}
4494keyword does not work in @code{defmacro} argument lists (except 4474keyword does not work in @code{cl-defmacro} argument lists (except
4495inside recursive argument lists). 4475inside recursive argument lists).
4496 4476
4497The @code{equal} predicate does not distinguish 4477The @code{equal} predicate does not distinguish
4498between IEEE floating-point plus and minus zero. The @code{cl-equalp} 4478between IEEE floating-point plus and minus zero. The @code{cl-equalp}
4499predicate has several differences with Common Lisp; @pxref{Predicates}. 4479predicate has several differences with Common Lisp; @pxref{Predicates}.
4500 4480
4501@c FIXME no longer provided by cl.
4502The @code{setf} mechanism is entirely compatible, except that
4503setf-methods return a list of five values rather than five
4504values directly. Also, the new ``@code{setf} function'' concept
4505(typified by @code{(defun (setf foo) @dots{})}) is not implemented.
4506
4507The @code{cl-do-all-symbols} form is the same as @code{cl-do-symbols} 4481The @code{cl-do-all-symbols} form is the same as @code{cl-do-symbols}
4508with no @var{obarray} argument. In Common Lisp, this form would 4482with no @var{obarray} argument. In Common Lisp, this form would
4509iterate over all symbols in all packages. Since Emacs obarrays 4483iterate over all symbols in all packages. Since Emacs obarrays
@@ -4635,7 +4609,7 @@ However, the Emacs parser does not understand colons and just
4635treats them as part of the symbol name. Thus, while @code{mapcar} 4609treats them as part of the symbol name. Thus, while @code{mapcar}
4636and @code{lisp:mapcar} may refer to the same symbol in Common 4610and @code{lisp:mapcar} may refer to the same symbol in Common
4637Lisp, they are totally distinct in Emacs Lisp. Common Lisp 4611Lisp, they are totally distinct in Emacs Lisp. Common Lisp
4638programs which refer to a symbol by the full name sometimes 4612programs that refer to a symbol by the full name sometimes
4639and the short name other times will not port cleanly to Emacs. 4613and the short name other times will not port cleanly to Emacs.
4640 4614
4641Emacs Lisp does have a concept of ``obarrays'', which are 4615Emacs Lisp does have a concept of ``obarrays'', which are
@@ -4923,13 +4897,16 @@ Common Lisp defines three macros, @code{define-modify-macro},
4923user to extend generalized variables in various ways. 4897user to extend generalized variables in various ways.
4924In Emacs, these are obsolete, replaced by various features of 4898In 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]
4929This macro defines a ``read-modify-write'' macro similar to 4904This 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
4931to take a @var{place} argument followed by additional arguments 4906with @code{gv-letplace}.
4932described by @var{arglist}. The call 4907
4908The macro @var{name} is defined to take a @var{place} argument
4909followed 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
4952For example: 4929For 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
4959Note that @code{&key} is not allowed in @var{arglist}, but 4936Note 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
4962Most of the modify macros defined by Common Lisp do not exactly 4939Most of the modify macros defined by Common Lisp do not exactly
4963follow the pattern of @code{define-modify-macro}. For example, 4940follow 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}
4965is completely irregular. You can define these macros ``by hand'' 4942is completely irregular.
4966using @code{get-setf-method}, or consult the source 4943
4967to see how to use the internal @code{setf} building blocks. 4944The 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
4971This is the simpler of two @code{defsetf} forms. Where 4961This is the simpler of two @code{defsetf} forms, and is
4972@var{access-fn} is the name of a function which accesses a place, 4962replaced by @code{gv-define-simple-setter}.
4973this declares @var{update-fn} to be the corresponding store 4963
4974function. From now on, 4964With @var{access-fn} the name of a function that accesses a place,
4965this declares @var{update-fn} to be the corresponding store function.
4966From 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
4988The @var{update-fn} is required to be either a true function, or 4980The @var{update-fn} is required to be either a true function, or
4989a macro which evaluates its arguments in a function-like way. Also, 4981a macro that evaluates its arguments in a function-like way. Also,
4990the @var{update-fn} is expected to return @var{value} as its result. 4982the @var{update-fn} is expected to return @var{value} as its result.
4991Otherwise, the above expansion would not obey the rules for the way 4983Otherwise, 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
4994As a special (non-Common-Lisp) extension, a third argument of @code{t} 4986As a special (non-Common-Lisp) extension, a third argument of @code{t}
4995to @code{defsetf} says that the @code{update-fn}'s return value is 4987to @code{defsetf} says that the return value of @code{update-fn} is
4996not suitable, so that the above @code{setf} should be expanded to 4988not suitable, so that the above @code{setf} should be expanded to
4997something more like 4989something more like
4998 4990
@@ -5002,25 +4994,32 @@ something more like
5002 temp) 4994 temp)
5003@end example 4995@end example
5004 4996
5005Some examples of the use of @code{defsetf}, drawn from the standard 4997Some examples are:
5006suite 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
5004These 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{}
5016This is the second, more complex, form of @code{defsetf}. It is 5013This is the second, more complex, form of @code{defsetf}.
5017rather like @code{defmacro} except for the additional @var{store-var} 5014It can be replaced by @code{gv-define-setter}.
5018argument. The @var{forms} should return a Lisp form which stores 5015
5019the value of @var{store-var} into the generalized variable formed 5016This form of @code{defsetf} is rather like @code{defmacro} except for
5020by a call to @var{access-fn} with arguments described by @var{arglist}. 5017the additional @var{store-var} argument. The @var{forms} should
5021The @var{forms} may begin with a string which documents the @code{setf} 5018return a Lisp form that stores the value of @var{store-var} into the
5022method (analogous to the doc string that appears at the front of a 5019generalized variable formed by a call to @var{access-fn} with
5023function). 5020arguments described by @var{arglist}. The @var{forms} may begin with
5021a string which documents the @code{setf} method (analogous to the doc
5022string that appears at the front of a function).
5024 5023
5025For example, the simple form of @code{defsetf} is shorthand for 5024For 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
5032The Lisp form that is returned can access the arguments from 5031The 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;
5034macros like @code{setf} and @code{cl-incf} which invoke this 5033macros like @code{cl-incf} that invoke this
5035setf-method will insert temporary variables as needed to make 5034setf-method will insert temporary variables as needed to make
5036sure the apparent order of evaluation is preserved. 5035sure the apparent order of evaluation is preserved.
5037 5036
5038Another example drawn from the standard package: 5037Another 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
5044You 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{}
5047This is the most general way to create new place forms. When 5053This is the most general way to create new place forms. You can
5048a @code{setf} to @var{access-fn} with arguments described by 5054replace this by @code{gv-define-setter} or @code{gv-define-expander}.
5049@var{arglist} is expanded, the @var{forms} are evaluated and 5055
5050must return a list of five items: 5056When a @code{setf} to @var{access-fn} with arguments described by
5057@var{arglist} is expanded, the @var{forms} are evaluated and must
5058return 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
5063from a call to @code{gensym}). 5071from a call to @code{gensym}).
5064 5072
5065@item 5073@item
5066A Lisp form which stores the contents of the store variable into 5074A Lisp form that stores the contents of the store variable into
5067the generalized variable, assuming the temporaries have been 5075the generalized variable, assuming the temporaries have been
5068bound as described above. 5076bound as described above.
5069 5077
5070@item 5078@item
5071A Lisp form which accesses the contents of the generalized variable, 5079A Lisp form that accesses the contents of the generalized variable,
5072assuming the temporaries have been bound. 5080assuming 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,
5076except that the method returns a list of five values rather 5084except that the method returns a list of five values rather
5077than the five values themselves, since Emacs Lisp does not 5085than the five values themselves, since Emacs Lisp does not
5078support Common Lisp's notion of multiple return values. 5086support Common Lisp's notion of multiple return values.
5087(Note that the @code{setf} implementation provided by @file{gv.el}
5088does not use this five item format. Its use here is only for
5089backwards compatibility.)
5079 5090
5080Once again, the @var{forms} may begin with a documentation string. 5091Once 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
5085arguments in the place form, and the first return value is a 5096arguments in the place form, and the first return value is a
5086list of a corresponding number of temporary variables generated 5097list of a corresponding number of temporary variables generated
5087by @code{cl-gensym}. Macros like @code{setf} and @code{cl-incf} which 5098@c FIXME I don't think this is true anymore.
5099by @code{cl-gensym}. Macros like @code{cl-incf} that
5088use this setf-method will optimize away most temporaries that 5100use this setf-method will optimize away most temporaries that
5089turn out to be unnecessary, so there is little reason for the 5101turn out to be unnecessary, so there is little reason for the
5090setf-method itself to optimize. 5102setf-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
5094This function returns the setf-method for @var{place}, by 5108This function returns the setf-method for @var{place}, by
5095invoking the definition previously recorded by @code{defsetf} 5109invoking the definition previously recorded by @code{defsetf}
5096or @code{define-setf-method}. The result is a list of five 5110or @code{define-setf-method}. The result is a list of five
5097values as described above. You can use this function to build 5111values as described above. You can use this function to build
5098your own @code{cl-incf}-like modify macros. (Actually, it is 5112your own @code{cl-incf}-like modify macros.
5099@c FIXME?
5100better to use the internal functions @code{cl-setf-do-modify}
5101and @code{cl-setf-do-store}, which are a bit easier to use and
5102which also do a number of optimizations; consult the source
5103code for the @code{cl-incf} function for a simple example.)
5104 5113
5105The argument @var{env} specifies the ``environment'' to be 5114The argument @var{env} specifies the ``environment'' to be
5106passed on to @code{macroexpand} if @code{get-setf-method} should 5115passed on to @code{macroexpand} if @code{get-setf-method} should
5107need to expand a macro in @var{place}. It should come from 5116need to expand a macro in @var{place}. It should come from
5108an @code{&environment} argument to the macro or setf-method 5117an @code{&environment} argument to the macro or setf-method
5109that called @code{get-setf-method}. 5118that called @code{get-setf-method}.
5110
5111See 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
5114simpler case, then massaging the result.
5115@end defun 5119@end defun
5116 5120@end ignore
5117Modern Common Lisp defines a second, independent way to specify
5118the @code{setf} behavior of a function, namely ``@code{setf}
5119functions'' whose names are lists @code{(setf @var{name})}
5120rather than symbols. For example, @code{(defun (setf foo) @dots{})}
5121defines the function that is used when @code{setf} is applied to
5122@code{foo}. This package does not currently support @code{setf}
5123functions. In particular, it is a compile-time error to use
5124@code{setf} on a form which has not already been @code{defsetf}'d
5125or otherwise declared; in newer Common Lisps, this would not be
5126an error since the function @code{(setf @var{func})} might be
5127defined 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.
337A custom face for highlighting lines for which at least one warning 337A custom face for highlighting lines for which at least one warning
338and no errors have been reported. 338and no errors have been reported.
339 339
340@item flymake-error-bitmap
341A bitmap used in the fringe to mark lines for which an error has
342been reported.
343
344@item flymake-warning-bitmap
345A bitmap used in the fringe to mark lines for which a warning has
346been reported.
347
348@item flymake-fringe-indicator-position
349Which 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
719buffer are considered to belong to line 1 of the current buffer. 730buffer 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
736If the option @code{flymake-fringe-indicator-position} is non-@code{nil},
737errors and warnings are also highlighted in the left or right fringe,
738using the bitmaps specified by @code{flymake-error-bitmap}
739and @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}
14759and says what authentication scheme to use. The default is 14759and says what authentication scheme to use. The default is
14760@code{password}. 14760@code{password}.
14761 14761
14762@item :leave
14763Non-@code{nil} if the mail is to be left on the @acronym{POP} server
14764after 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
14768If this is neither @code{nil} nor a number, all mails will be left on
14769the server. If this is a number, leave mails on the server for this
14770many 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
14774The @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
14778Note that @acronym{POP} servers maintain no state information between
14779sessions, so what the client believes is there and what is actually
14780there may not match up. If they do not, then you may get duplicate
14781mails or the whole thing can fall apart and leave you with a corrupt
14782mailbox.
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
14766If the @code{:program} and @code{:function} keywords aren't specified, 14788If 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.
14768is non-@code{nil} the mail is to be left on the @acronym{POP} server
14769after fetching when using @code{pop3-movemail}. Note that POP servers
14770maintain no state information between sessions, so what the client
14771believes is there and what is actually there may not match up. If they
14772do not, then you may get duplicate mails or the whole thing can fall
14773apart and leave you with a corrupt mailbox.
14774 14790
14775Here are some examples for getting mail from a @acronym{POP} server. 14791Here are some examples for getting mail from a @acronym{POP} server.
14792
14776Fetch from the default @acronym{POP} server, using the default user 14793Fetch from the default @acronym{POP} server, using the default user
14777name, and default fetcher: 14794name, 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
14807Leave 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
14790Use @samp{movemail} to move the mail: 14815Use @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
12This file documents SES: the Simple Emacs Spreadsheet. 12This file documents @acronym{SES}: the Simple Emacs Spreadsheet.
13 13
14Copyright @copyright{} 2002-2012 Free Software Foundation, Inc. 14Copyright @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
58SES 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
59contain a rectangular grid of cells. The cells' values are specified 59contain a rectangular grid of cells. The cells' values are specified
60by formulas that can refer to the values of other cells. 60by 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
127Point is always at the left edge of a cell, or at the empty endline. 127Point is always at the left edge of a cell, or at the empty endline.
128When mark is inactive, the current cell is underlined. When mark is 128When mark is inactive, the current cell is underlined. When mark is
129active, the range is the highlighted rectangle of cells (SES always 129active, the range is the highlighted rectangle of cells (@acronym{SES} always
130uses transient mark mode). Drag the mouse from A1 to A3 to create the 130uses transient mark mode). Drag the mouse from A1 to A3 to create the
131range A1-A2. Many SES commands operate only on single cells, not 131range A1-A2. Many @acronym{SES} commands operate only on single cells, not
132ranges. 132ranges.
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
192expression, you can use @kbd{M-@key{TAB}} to complete symbol names. 192expression, you can use @kbd{M-@key{TAB}} to complete symbol names.
193 193
194@item ' @r{(apostrophe)} 194@item ' @r{(apostrophe)}
195Enter a symbol (ses-read-symbol). SES remembers all symbols that have 195Enter a symbol (ses-read-symbol). @acronym{SES} remembers all symbols that have
196been used as formulas, so you can type just the beginning of a symbol 196been used as formulas, so you can type just the beginning of a symbol
197and use @kbd{@key{SPC}}, @kbd{@key{TAB}}, and @kbd{?} to complete it. 197and 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
367The copy functions work on rectangular regions of cells. You can paste the 367The copy functions work on rectangular regions of cells. You can paste the
368copies into non-SES buffers to export the print text. 368copies 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
394differently depending on the format of the text being inserted: 394differently depending on the format of the text being inserted:
395@itemize @bullet 395@itemize @bullet
396@item 396@item
397When pasting cells that were cut from a SES buffer, the print text is 397When pasting cells that were cut from a @acronym{SES} buffer, the print text is
398ignored and only the attached formula and printer are inserted; cell 398ignored and only the attached formula and printer are inserted; cell
399references in the formula are relocated unless you use @kbd{C-u}. 399references 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
402is the current cell. If part of the rectangle is beyond the edges of 402is the current cell. If part of the rectangle is beyond the edges of
403the spreadsheet, you must confirm the increase in spreadsheet size. 403the spreadsheet, you must confirm the increase in spreadsheet size.
404@item 404@item
405Non-SES text is usually inserted as a replacement formula for the 405Non-@acronym{SES} text is usually inserted as a replacement formula for the
406current cell. If the formula would be a symbol, it's treated as a 406current cell. If the formula would be a symbol, it's treated as a
407string unless you use @kbd{C-u}. Pasted formulas with syntax errors 407string unless you use @kbd{C-u}. Pasted formulas with syntax errors
408are always treated as strings. 408are 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
421Immediately after a paste, you can replace the text with a preceding 421Immediately after a paste, you can replace the text with a preceding
422element from the kill ring (@code{ses-yank-pop}). Unlike the standard 422element from the kill ring (@code{ses-yank-pop}). Unlike the standard
423Emacs yank-pop, the SES version uses @code{undo} to delete the old 423Emacs yank-pop, the @acronym{SES} version uses @code{undo} to delete the old
424yank. This doesn't make any difference? 424yank. 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
443list. 443list.
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
446execute when starting SES mode for a buffer). 446execute when starting @acronym{SES} mode for a buffer).
447 447
448The variable @code{safe-functions} is a list of possibly-unsafe 448The variable @code{safe-functions} is a list of possibly-unsafe
449functions to be treated as safe when analyzing formulas and printers. 449functions 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
475The header line at the top of the @acronym{SES}
473window normally shows the column letter for each column. You can set 476window normally shows the column letter for each column. You can set
474it to show a copy of some row, such as a row of column titles, so that 477it to show a copy of some row, such as a row of column titles, so that
475row will always be visible. Default is to set the current row as the 478row 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]
479Pops up a menu to set the current row as the header, or revert to 482Pops up a menu to set the current row as the header, or revert to
480column letters. 483column letters.
484@item M-x ses-rename-cell
485@findex ses-rename-cell
486Rename a cell from a standard A1-like name to any
487string.
488@item M-x ses-repair-cell-reference-all
489@findex ses-repair-cell-reference-all
490When you interrupt a cell formula update by clicking @kbd{C-g}, then
491the cell reference link may be broken, which will jeopardize automatic
492cell update when any other cell on which it depends is changed. To
493repair 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
501A SES file consists of a print area and a data area. Normally the 514A @acronym{SES} file consists of a print area and a data area. Normally the
502buffer is narrowed to show only the print area. The print area is 515buffer is narrowed to show only the print area. The print area is
503read-only except for special SES commands; it contains cell values 516read-only except for special @acronym{SES} commands; it contains cell values
504formatted by printer functions. The data area records the formula and 517formatted by printer functions. The data area records the formula and
505printer functions, etc. 518printer functions, etc.
506 519
@@ -576,6 +589,52 @@ If you insert a new row just beyond the end of a one-column range, or
576a new column just beyond a one-row range, the new cell is included in 589a new column just beyond a one-row range, the new cell is included in
577the range. New cells inserted just before a range are not included. 590the range. New cells inserted just before a range are not included.
578 591
592Flags can be added to @code{ses-range} immediately after the @var{to}
593cell.
594@table @code
595@item !
596Empty cells in range can be removed by adding the @code{!} flag. An
597empty cell is a cell the value of which is one of symbols @code{nil}
598or @code{*skip*}. For instance @code{(ses-range A1 A4 !)} will do the
599same as @code{(list A1 A3)} when cells @code{A2} and @code{A4} are
600empty.
601@item _
602Empty cell values are replaced by the argument following flag
603@code{_}, or @code{0} when flag @code{_} is last in argument list. For
604instance @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}
606are empty. Similarly, @code{(ses-range A1 A4 _ )} will do the same as
607@code{(list A1 0 A3 0)}.
608@item >v
609When order matters, list cells by reading cells rowwise from top left
610to bottom right. This flag is provided for completeness only as it is
611the default reading order.
612@item <v
613List cells by reading cells rowwise from top right to bottom left.
614@item v>
615List cells by reading cells columnwise from top left to bottom right.
616@item v<
617List cells by reading cells columnwise from top right to bottom left.
618@item v
619A short hand for @code{v>}.
620@item ^
621A short hand for @code{^>}.
622@item >
623A short hand for @code{>v}.
624@item <
625A short hand for @code{>^}.
626@item *
627Instead 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
629one row or one column a vector is made, otherwise a matrix is made.
630@item *2
631Same as @code{*} except that a matrix is always made even when there
632is only one row or column in the range.
633@item *1
634Same as @code{*} except that a vector is always made even when there
635is only one row or column in the range, that is to say the
636corresponding 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
653row or the next non-@code{nil} cell), the result is truncated if the cell's 712row or the next non-@code{nil} cell), the result is truncated if the cell's
654value is a string, or replaced with hash marks otherwise. 713value is a string, or replaced with hash marks otherwise.
655 714
656SES could get confused by printer results that contain newlines or 715@acronym{SES} could get confused by printer results that contain newlines or
657tabs, so these are replaced with question marks. 716tabs, 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.
734A common organization for spreadsheets is to have a bunch of ``detail'' 793A common organization for spreadsheets is to have a bunch of ``detail''
735rows, each perhaps describing a transaction, and then a set of 794rows, 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
737details. SES supports this organization via the @code{ses-select} 796details. @acronym{SES} supports this organization via the @code{ses-select}
738function. 797function.
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)''.
799These deferred cell-writes cannot be interrupted by @kbd{C-g}, so 858These deferred cell-writes cannot be interrupted by @kbd{C-g}, so
800you'll just have to wait. 859you'll just have to wait.
801 860
802SES 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
803Emacs will be scrolling the buffer after the end of a command, and 862Emacs will be scrolling the buffer after the end of a command, and
804also to narrow and underline after @kbd{C-x C-v}. This is visible as 863also to narrow and underline after @kbd{C-x C-v}. This is visible as
805a momentary glitch after C-x C-v and certain scrolling commands. You 864a 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
843macros for each row, followed by column-widths, column-printers, 902macros for each row, followed by column-widths, column-printers,
844default-printer, and header-row. Then there's the global parameters 903default-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
846SES mode for the buffer, etc.) 905@acronym{SES} mode for the buffer, etc.)
847 906
848When a SES file is loaded, first the numrows and numcols values are 907When a @acronym{SES} file is loaded, first the numrows and numcols values are
849loaded, then the entire data area is @code{eval}ed, and finally the local 908loaded, then the entire data area is @code{eval}ed, and finally the local
850variables are processed. 909variables are processed.
851 910
852You can edit the data area, but don't insert or delete any newlines 911You can edit the data area, but don't insert or delete any newlines
853except in the local-variables part, since SES locates things by 912except in the local-variables part, since @acronym{SES} locates things by
854counting newlines. Use @kbd{C-x C-e} at the end of a line to install 913counting newlines. Use @kbd{C-x C-e} at the end of a line to install
855your edits into the spreadsheet data structures (this does not update 914your edits into the spreadsheet data structures (this does not update
856the print area, use e.g. @kbd{C-c C-l} for that). 915the 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
21This file documents the Emacs Lisp URL loading package. 21This is the manual for the @code{url} Emacs Lisp library.
22 22
23Copyright @copyright{} 1993-1999, 2002, 2004-2012 Free Software Foundation, Inc. 23Copyright @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 80A @dfn{Uniform Resource Identifier} (URI) is a specially-formatted
79@dfn{Uniform Resource Identifiers} (URI) described in RFC 2396 which 81name, such as an Internet address, that identifies some name or
80updates RFC 1738 and RFC 1808. RFC 2016 defines uniform resource 82resource. The format of URIs is described in RFC 3986, which updates
81agents. 83and replaces the earlier RFCs 2732, 2396, 1808, and 1738. A
84@dfn{Uniform Resource Locator} (URL) is an older but still-common
85term, which basically refers to a URI corresponding to a resource that
86can be accessed (usually over a network) in a specific way.
82 87
83URIs 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
87FTP, NFS, HTTP, HTTPS, @code{rlogin}, @code{telnet}, tn3270, 90@example
88IRC and gopher URLs all have the form 91ftp://ftp.is.co.za/rfc/rfc1808.txt
92http://www.ietf.org/rfc/rfc2396.txt
93ldap://[2001:db8::7]/c=GB?objectClass?one
94mailto:John.Doe@@example.com
95news:comp.infosystems.www.servers.unix
96tel:+1-816-555-1212
97telnet://192.0.2.16:80/
98urn: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
102for parsing URIs and retrieving the resources to which they refer.
103(The library is so-named for historical reasons; nowadays, the ``URI''
104terminology is regarded as the more general one, and ``URL'' is
105technically 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
111meaning. 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{]} 114http://www.gnu.org/software/emacs/
92@end example 115@end example
116
93@noindent 117@noindent
94where @samp{@r{[}} and @samp{@r{]}} delimit optional parts. 118specifies 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/}.
96but you should beware of the security risks of sending cleartext 120
97passwords. @var{hostname} may be a domain name or a dotted decimal 121@cindex parsed URIs
98address. 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
99use the ``well known'' port for that service when accessing URLs. With 123provides the Lisp function @code{url-generic-parse-url}, a (mostly)
100the possible exception of @code{telnet}, it is rare for ports to be 124standard-compliant URI parser, as well as function
101specified, 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
102undesired consequences if a different service is listening on that 126string.
103port (e.g., an HTTP URL specifying the SMTP port can cause mail to be 127
104sent). @c , but @xref{Other Variables, url-bad-port-list}. 128@defun url-generic-parse-url uri-string
105The meaning of the @var{path} component depends on the service. 129This 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. 134Given 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
139expected by @code{url-recreate-url}, is a @dfn{parsed URI}: a CL
140structure whose slots hold the various components of the URI.
141@xref{top,the CL Manual,,cl,GNU Emacs Common Lisp Emulation}, for
142details 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.
118The directory in which URL configuration files, the cache etc., 148@end menu
119reside. The old default was @file{~/.url}, and this directory
120is still used if it exists. The new default is a @file{url/}
121directory 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
128The library functions typically operate on @dfn{parsed} versions of
129URLs. 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
138is the type of the URL scheme, e.g., @code{http} 157The URI scheme (a string, e.g.@: @code{http}). @xref{Supported URL
158Types}, for a list of schemes that the @code{url} library knows how to
159process. This slot can also be @code{nil}, if the URI is not fully
160specified.
161
139@item user 162@item user
140is the username associated with it, or @code{nil}; 163The user name (a string), or @code{nil}.
164
141@item password 165@item password
142is the user password associated with it, or @code{nil}; 166The user password (a string), or @code{nil}. The use of this URI
167component is strongly discouraged; nowadays, passwords are transmitted
168by other means, not as part of a URI.
169
143@item host 170@item host
144is the host name associated with it, or @code{nil}; 171The host name (a string), or @code{nil}. If present, this is
172typically a domain name or IP address.
173
145@item port 174@item port
146is the port number associated with it, or @code{nil}; 175The port number (an integer), or @code{nil}. Omitting this component
176usually means to use the ``standard'' port associated with the URI
177scheme.
178
147@item filename 179@item filename
148is the ``file'' part of it, or @code{nil}. This doesn't necessarily 180The combination of the ``path'' and ``query'' components of the URI (a
149actually refer to a file; 181string), or @code{nil}. If the query component is present, it is the
182substring following the first @samp{?} character, and the path
183component is the substring before the @samp{?}. The meaning of these
184components is scheme-dependent; they do not necessarily refer to a
185file on a disk.
186
150@item target 187@item target
151is the target part, or @code{nil}; 188The fragment component (a string), or @code{nil}. The fragment
152@item attributes 189component specifies a ``secondary resource'', such as a section of a
153is the attributes associated with it, or @code{nil}; 190webpage.
191
154@item fullness 192@item fullness
155is @code{t} for a fully-specified URL, with a host part indicated by 193This is @code{t} if the URI is fully specified, i.e.@: the
156@samp{//} after the scheme part. 194hierarchical components of the URI (the hostname and/or username
157@item use-cookies 195and/or password) are preceded by @samp{//}.
158is @code{nil} to neither send or store cookies to the server, @code{t}
159otherwise.
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
171These attributes have accessors named @code{url-@var{part}}, where 207These 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}
174using @code{setf}: 210accessor returns the default port for the URI scheme if the parsed
211URI'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
180If @var{port} is @var{nil}, @code{url-port} returns the default port 219@node URI Encoding
181of the protocol. 220@section URI Encoding
182 221
183There are functions for parsing and unparsing between the string and 222@cindex percent encoding
184vector forms. 223 The @code{url-generic-parse-url} parser does not obey RFC 3986 in
224one 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
228represented by converting them to UTF-8 byte sequences, and performing
229@dfn{percent encoding} on the bytes. For example, the o-umlaut
230character is converted to the UTF-8 byte sequence @samp{\xD3\xA7},
231then percent encoded to @samp{%D3%A7}. (Certain ``reserved''
232@acronym{ASCII} characters must also be percent encoded when they
233appear in URI components.)
234
235 The function @code{url-encode-url} can be used to convert a URI
236string containing arbitrary characters to one that is properly
237percent-encoded in accordance with RFC 3986.
238
239@defun url-encode-url url-string
240This function return a properly URI-encoded version of
241@var{url-string}. It also performs @dfn{URI normalization},
242e.g.@: converting the scheme component to lowercase if it was
243previously uppercase.
244@end defun
185 245
186@defun url-generic-parse-url url 246 To convert between a string containing arbitrary characters and a
187Return a parsed version of the string @var{url}. 247percent-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
251This function performs percent-encoding on @var{string}, and returns
252the result.
253
254If @var{string} is multibyte, it is first converted to a UTF-8 byte
255string. Each byte corresponding to an allowed character is left
256as-is, while all other bytes are converted to a three-character
257sequence: @samp{%} followed by two upper-case hex digits.
258
259@vindex url-unreserved-chars
260@cindex unreserved characters
261The allowed characters are specified by @var{allowed-chars}. If this
262argument 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
265be 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 270This function replaces percent-encoding sequences in @var{string} with
192Recreates a URL string from the parsed @var{url}. 271their character equivalents, and returns the resulting string.
272
273If @var{allow-newlines} is non-@code{nil}, it allows the decoding of
274carriage 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
281retrieving the data specified by a URL. The actual retrieval protocol
282depends on the URL's URI scheme, and is performed by lower-level
283scheme-specific functions. (Those lower-level functions are not
284documented here, and generally should not be called directly.)
285
286 In each of these functions, the @var{url} argument can be either a
287string or a parsed URL structure. If it is a string, that string is
288passed through @code{url-encode-url} before using it, to ensure that
289it is properly URI-encoded (@pxref{URI Encoding}).
290
198@defun url-retrieve-synchronously url 291@defun url-retrieve-synchronously url
199Retrieve @var{url} synchronously and return a buffer containing the 292This function synchronously retrieves the data specified by @var{url},
200data. @var{url} is either a string or a parsed URL structure. Return 293and 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
202info, or mailto URLs that need no further processing). 295for @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
206Retrieve @var{url} asynchronously and call @var{callback} with args 299This 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
208has been completely retrieved, with the current buffer containing the 301return value is the buffer into which the data will be inserted, or
209object and any MIME headers associated with it. @var{url} is either a 302@code{nil} if the process has already completed.
210string or a parsed URL structure. Returns the buffer @var{url} will 303
211load into, or @code{nil} if the process has already completed. 304The callback function is called this way:
212If the optional argument @var{silent} is non-@code{nil}, suppress 305
213progress messages. If the optional argument @var{no-cookies} is 306@example
214non-@code{nil}, do not store or send cookies. 307(apply @var{callback} @var{status} @var{cbargs})
308@end example
309
310@noindent
311where @var{status} is a plist representing what happened during the
312retrieval, with most recent events first, or an empty list if no
313events have occurred. Each pair in the plist is one of:
314
315@table @code
316@item (:redirect @var{redirected-to})
317This means that the request was redirected to the URL
318@var{redirected-to}.
319
320@item (:error (@var{error-symbol} . @var{data}))
321This means that an error occurred. If so desired, the error can be
322signaled with @code{(signal @var{error-symbol} @var{data})}.
323@end table
324
325When the callback function is called, the current buffer is the one
326containing the retrieved data (if any). The buffer also contains any
327MIME headers associated with the data retrieval.
328
329If the optional argument @var{silent} is non-@code{nil}, progress
330messages are suppressed. If the optional argument @var{no-cookies} is
331non-@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
220This acts like the @code{url-retrieve} function, but with limits on 335This function acts like @code{url-retrieve}, but with limits on the
221the degree of parallelism. The option @code{url-queue-parallel-processes} 336number of concurrently-running network processes. The option
222controls 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. 338processes, and the option @code{url-queue-timeout} sets a timeout in
339seconds.
340
341To 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
346The value of this option is an integer specifying the maximum number
347of concurrent @code{url-queue-retrieve} network processes. If the
348number of @code{url-queue-retrieve} calls is larger than this number,
349later ones are queued until ealier ones are finished.
350@end defopt
351
352@vindex url-queue-timeout
353@defopt url-queue-timeout
354The value of this option is a number specifying the maximum lifetime
355of a @code{url-queue-retrieve} network process, once it is started.
356If a process is not finished by then, it is killed and removed from
357the 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
363This chapter describes functions and variables affecting URL retrieval
364for 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
253The scheme @code{http} is Hypertext Transfer Protocol. The library 383The @code{http} scheme refers to the Hypertext Transfer Protocol. The
254supports version 1.1, specified in RFC 2616. (This supersedes 1.0, 384@code{url} library supports HTTP version 1.1, specified in RFC 2616.
255defined in RFC 1945) HTTP URLs have the following form, where most of 385Its default port is 80.
256the parts are optional: 386
257@example 387 The @code{https} scheme is a secure version of @code{http}, with
258http://@var{user}:@var{password}@@@var{host}:@var{port}/@var{path}?@var{searchpart}#@var{fragment} 388transmission via SSL. It is defined in RFC 2069, and its default port
259@end example 389is 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 390encryption via the @code{ssl} library, by forcing the @code{ssl}
261@c 80. The @code{/@var{path}} part, if present, is a slash-separated 391gateway 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
266The scheme @code{https} is a secure version of @code{http}, with
267transmission via SSL. It is defined in RFC 2069. Its default port is
268443. 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
273This controls honoring of HTTP @samp{Refresh} headers by which 394If this option is non-@code{nil} (the default), the @code{url} library
274servers can direct clients to reload documents from the same URL or a 395honors the HTTP @samp{Refresh} header, which is used by servers to
275or different one. @code{nil} means they will not be honored, 396direct clients to reload documents from the same URL or a or different
276@code{t} (the default) means they will always be honored, and 397one. If the value is @code{nil}, the @samp{Refresh} header is
277otherwise the user will be asked on each request. 398ignored; 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
532The @code{ftp} and @code{file} schemes are defined in RFC 1808. The
533@code{url} library treats @samp{ftp:} and @samp{file:} as synonymous.
534Such URLs have the form
535
412@example 536@example
413ftp://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file} 537ftp://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file}
414file://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file} 538file://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file}
415@end example 539@end example
416 540
417These schemes are defined in RFC 1808. 541@noindent
418@samp{ftp:} and @samp{file:} are synonymous in this library. They 542If the URL specifies a local file, it is retrieved by reading the file
419allow reading arbitrary files from hosts. Either @samp{ange-ftp} 543contents 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 544retrieved using the Ange-FTP package. @xref{Remote Files,,, emacs,
421hosts. Local files are accessed directly. 545The GNU Emacs Manual}.
422 546
423Compressed 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. 548if it has the file suffix @file{.z}, @file{.gz}, @file{.Z},
425Suffixes recognized are @samp{.z}, @samp{.gz}, @samp{.Z} and 549@file{.bz2}, or @file{.xz}. (The list of supported suffixes is
426@samp{.bz2}. 550hard-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
429The filename to look for when indexing a directory, default 554This 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
431will 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.
557Otherwise, 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
566The @code{info} scheme is non-standard. Such URLs have the form
567
440@example 568@example
441info:@var{file}#@var{node} 569info:@var{file}#@var{node}
442@end example 570@end example
443 571
444Info URLs are not officially defined. They invoke 572@noindent
445@code{Info-goto-node} with argument @samp{(@var{file})@var{node}}. 573and 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
453A mailto URL will send an email message to the address in the 582A @code{mailto} URL specifies an email message to be sent to a given
454URL, for example @samp{mailto:foo@@bar.com} would compose a 583email address. For example, @samp{mailto:foo@@bar.com} specifies
455message to @samp{foo@@bar.com}. 584sending a message to @samp{foo@@bar.com}. The ``retrieval method''
456 585for such URLs is to open a mail composition buffer in which the
457@defopt url-mail-command 586appropriate content (e.g.@: the recipient address) has been filled in.
458@vindex mail-user-agent
459The function called whenever url needs to send mail. This should
460normally be left to default from @var{mail-user-agent}. @xref{Mail
461Methods, , Mail-Composition Methods, emacs, The GNU Emacs Manual}.
462@end defopt
463 587
464An @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
465that contained the mailto URL is added if that URL is known.
466 589
467RFC 2368 extends the definition of mailto URLs in RFC 1738.
468The 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
474otherwise a @var{header} header field is created with @var{contents}
475as its contents. Note that the URL library does not consider any
476headers ``dangerous'' so you should check them before sending the
477message.
478 593
479@c Fixme: update 594@noindent
480Email messages are defined in @sc{rfc}822. 595where 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
597body; otherwise, a @var{header} header field is created with
598@var{contents} as its contents. Note that the @code{url} library does
599not perform any checking of @var{header} or @var{contents}, so you
600should check them before sending the message.
601
602@defopt url-mail-command
603@vindex mail-user-agent
604The value of this variable is the function called whenever url needs
605to send mail. This should normally be left its default, which is the
606standard mail-composition command @code{compose-mail}. @xref{Sending
607Mail,,, emacs, The GNU Emacs Manual}.
608@end defopt
609
610 If the document containing the @code{mailto} URL itself possessed a
611known URL, Emacs automatically inserts an @samp{X-Url-From} header
612field 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 622The @code{news}, @code{nntp}, and @code{snews} schemes, defined in RFC
491The network news URL scheme take the following forms following RFC 6231738, are used for reading Usenet newsgroups. For compatibility with
4921738 except that for compatibility with other clients, host and port 624non-standard-compliant news clients, the @code{url} library allows
493fields may be included in news URLs though they are properly only 625host and port fields to be included in @code{news} URLs, even though
494allowed for nntp an snews. 626they 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;
506Similar to the @samp{news} versions. 640Similar 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 644difference 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
512is :563. 646@samp{snews} scheme is the same as @samp{nntp}, except that it is
513@cindex SSL 647tunneled through SSL and has default port 563.
514(It is tunneled through SSL.)
515 648
516An @samp{nntp} URL is the same as a news URL, except that the URL may 649 These URLs are retrieved via the Gnus package.
517specify an article by its number.
518 650
519@defopt url-news-server
520This variable can be used to override the default news server.
521Usually this will be set by the Gnus package, which is used to fetch
522news.
523@cindex environment variable 651@cindex environment variable
524@vindex NNTPSERVER 652@vindex NNTPSERVER
525It may be set from the conventional environment variable 653@defopt url-news-server
526@code{NNTPSERVER}. 654This variable specifies the default news server from which to fetch
655news, if no server was specified in the URL. The default value,
656@code{nil}, means to use the server specified by the standard
657environment variable @samp{NNTPSERVER}, or @samp{news} if that
658environment 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
537These URL schemes from RFC 1738 for logon via a terminal emulator have 669These URL schemes are defined in RFC 1738, and are used for logging in
538the form 670via a terminal emulator. They have the form
671
539@example 672@example
540telnet://@var{user}:@var{password}@@@var{host}:@var{port} 673telnet://@var{user}:@var{password}@@@var{host}:@var{port}
541@end example 674@end example
542but the @code{:@var{password}} component is ignored. 675
676@noindent
677but the @var{password} component is ignored.
543 678
544To handle rlogin, telnet and tn3270 URLs, a @code{rlogin}, 679To 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
558session to a function named in @code{url-irc-function}. 693@url{http://www.w3.org/Addressing/draft-mirashi-url-irc-01.txt} (which
694was never approved as an RFC). Such URLs have the form
695
696@example
697irc://@var{host}:@var{port}/@var{target},@var{needpass}
698@end example
699
700@noindent
701and are retrieved by opening an @acronym{IRC} session using the
702function specified by @code{url-irc-function}.
559 703
560@defopt url-irc-function 704@defopt url-irc-function
561A function to actually open an IRC connection. 705The value of this option is a function, which is called to open an IRC
562This function 706connection for @code{irc} URLs. This function must take five
563must take five arguments, @var{host}, @var{port}, @var{channel}, 707arguments, @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
565channel to join immediately, this can be @code{nil}. By default this is 709join immediately, and may be @code{nil}.
566@code{url-irc-rcirc}. 710
711The default is @code{url-irc-rcirc}, which uses the Rcirc package.
712Other 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
569Processes the arguments and lets @code{rcirc} handle the session.
570@end defun
571@defun url-irc-erc host port channel user password
572Processes the arguments and lets @code{ERC} handle the session.
573@end defun
574@defun url-irc-zenirc host port channel user password
575Processes 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
721the URL itself. Such URLs have the form
722
582@example 723@example
583data:@r{[}@var{media-type}@r{]}@r{[};@var{base64}@r{]},@var{data} 724data:@r{[}@var{media-type}@r{]}@r{[};@var{base64}@r{]},@var{data}
584@end example 725@end example
585 726
586Data URLs contain MIME data in the URL itself. They are defined in 727@noindent
587RFC 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
590including parameters. It defaults to 729including 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
740The @code{nfs} scheme, defined in RFC 2224, is similar to @code{ftp}
741except that it points to a file on a remote host that is handled by an
742NFS automounter on the local host. Such URLs have the form
743
601@example 744@example
602nfs://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file} 745nfs://@var{user}:@var{password}@@@var{host}:@var{port}/@var{file}
603@end example 746@end example
604 747
605The @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
607handled 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
611A string saying how to invoke the NFS automounter. Certain @samp{%} 750A string saying how to invoke the NFS automounter. Certain @samp{%}
@@ -628,15 +767,6 @@ A literal @samp{%}.
628 767
629Each can be used any number of times. 768Each can be used any number of times.
630 769
631@node cid
632@section cid
633@cindex Content-ID
634
635RFC 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
645The LDAP scheme is defined in RFC 2255. 775The LDAP scheme is defined in RFC 2255.
646 776
647@node imap
648@section imap
649@cindex IMAP
650
651RFC 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
783The @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
663This is a non-standard scheme. @var{page-spec} is passed directly to 789@noindent
664the Lisp @code{man} function. 790and 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
1114The following environment variables affect the library's operation at 1213 The following environment variables affect the @code{url} library's
1115startup. 1214operation 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
1122it. 1221it.
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
1127The following user options, settable with Customize, affect the 1227@defopt url-configuration-directory
1128general operation of the package. 1228@cindex configuration files
1229The value of this variable specifies the name of the directory where
1230the @code{url} library stores its various configuration files, cache
1231files, etc.
1232
1233The default value specifies a subdirectory named @file{url/} in the
1234standard Emacs user data directory specified by the variable
1235@code{user-emacs-directory} (normally @file{~/.emacs.d}). However,
1236the old default was @file{~/.url}, and this directory is used instead
1237if it exists.
1238@end defopt
1129 1239
1130@defopt url-debug 1240@defopt url-debug
1131@cindex debugging 1241@cindex debugging