aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2012-10-24 20:58:40 -0400
committerGlenn Morris2012-10-24 20:58:40 -0400
commita05cb6e32625355cceef4593321780836b76e348 (patch)
tree2bb8de2b48419404176c052f686efd12ab4b9ff5
parenta6880551db39f264286f6ba9bf9735665ea6b967 (diff)
downloademacs-a05cb6e32625355cceef4593321780836b76e348.tar.gz
emacs-a05cb6e32625355cceef4593321780836b76e348.zip
More cl doc updates
* doc/misc/cl.texi: Don't mess with the TeX section number counter. Use Texinfo recommended convention for quotes+punctuation. (Overview, Sequence Functions): Rephrase for better line-breaking. (Time of Evaluation, Type Predicates, Modify Macros, Function Bindings) (Macro Bindings, Conditionals, Iteration, Loop Basics) (Random Numbers, Mapping over Sequences, Structures) (Porting Common Lisp): Further updates for cl-lib namespace. (Modify Macros, Declarations, Macro Bindings, Structures): Break long lines in examples. (Dynamic Bindings): Update for changed progv behavior. (Loop Examples, Efficiency Concerns): Markup fixes. (Structures): Remove TeX margin change. * lisp/emacs-lisp/cl-macs.el (cl-progv): Doc fix. * etc/NEWS: Related markup.
-rw-r--r--doc/misc/ChangeLog15
-rw-r--r--doc/misc/cl.texi167
-rw-r--r--etc/NEWS1
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/emacs-lisp/cl-macs.el2
5 files changed, 90 insertions, 99 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog
index a511ec3b75d..efc4de8646b 100644
--- a/doc/misc/ChangeLog
+++ b/doc/misc/ChangeLog
@@ -1,3 +1,18 @@
12012-10-25 Glenn Morris <rgm@gnu.org>
2
3 * cl.texi: Don't mess with the TeX section number counter.
4 Use Texinfo recommended convention for quotes+punctuation.
5 (Overview, Sequence Functions): Rephrase for better line-breaking.
6 (Time of Evaluation, Type Predicates, Modify Macros, Function Bindings)
7 (Macro Bindings, Conditionals, Iteration, Loop Basics)
8 (Random Numbers, Mapping over Sequences, Structures)
9 (Porting Common Lisp): Further updates for cl-lib namespace.
10 (Modify Macros, Declarations, Macro Bindings, Structures):
11 Break long lines in examples.
12 (Dynamic Bindings): Update for changed progv behavior.
13 (Loop Examples, Efficiency Concerns): Markup fixes.
14 (Structures): Remove TeX margin change.
15
12012-10-24 Glenn Morris <rgm@gnu.org> 162012-10-24 Glenn Morris <rgm@gnu.org>
2 17
3 * cl.texi (Overview, Multiple Values, Creating Symbols) 18 * cl.texi (Overview, Multiple Values, Creating Symbols)
diff --git a/doc/misc/cl.texi b/doc/misc/cl.texi
index 80fe5d2f1c8..d3cc8bb76eb 100644
--- a/doc/misc/cl.texi
+++ b/doc/misc/cl.texi
@@ -115,17 +115,16 @@ features.
115 115
116@end itemize 116@end itemize
117 117
118The package described here was originally written by Dave Gillespie, 118This package was originally written by Dave Gillespie,
119@file{daveg@@synaptics.com}, as a total rewrite of an earlier 119@file{daveg@@synaptics.com}, as a total rewrite of an earlier 1986
1201986 @file{cl.el} package by Cesar Quiroz. Care has been taken 120@file{cl.el} package by Cesar Quiroz. Care has been taken to ensure
121to ensure that each function is defined efficiently, concisely, and 121that each function is defined efficiently, concisely, and with minimal
122with minimal impact on the rest of the Emacs environment. Stefan 122impact on the rest of the Emacs environment. Stefan Monnier added the
123Monnier added the file @file{cl-lib.el} and rationalized the namespace 123file @file{cl-lib.el} and rationalized the namespace for Emacs 24.3.
124for Emacs 24.3.
125 124
126@menu 125@menu
127* Usage:: How to use the CL package. 126* Usage:: How to use the CL package.
128* Organization:: The package's five component files. 127* Organization:: The package's component files.
129* Naming Conventions:: Notes on CL function names. 128* Naming Conventions:: Notes on CL function names.
130@end menu 129@end menu
131 130
@@ -254,10 +253,6 @@ and the @code{cl-eval-when} construct.
254* Time of Evaluation:: The @code{cl-eval-when} construct. 253* Time of Evaluation:: The @code{cl-eval-when} construct.
255@end menu 254@end menu
256 255
257@iftex
258@secno=1
259@end iftex
260
261@node Argument Lists 256@node Argument Lists
262@section Argument Lists 257@section Argument Lists
263 258
@@ -566,16 +561,16 @@ last four would have been equivalent to the corresponding @code{setq}s.
566Note that @code{(cl-eval-when (load eval) @dots{})} is equivalent 561Note that @code{(cl-eval-when (load eval) @dots{})} is equivalent
567to @code{(progn @dots{})} in all contexts. The compiler treats 562to @code{(progn @dots{})} in all contexts. The compiler treats
568certain top-level forms, like @code{defmacro} (sort-of) and 563certain top-level forms, like @code{defmacro} (sort-of) and
569@code{require}, as if they were wrapped in @code{(eval-when 564@code{require}, as if they were wrapped in @code{(cl-eval-when
570(compile load eval) @dots{})}. 565(compile load eval) @dots{})}.
571@end defspec 566@end defspec
572 567
573Emacs includes two special forms related to @code{cl-eval-when}. 568Emacs includes two special forms related to @code{cl-eval-when}.
574One of these, @code{eval-when-compile}, is not quite equivalent to 569One of these, @code{eval-when-compile}, is not quite equivalent to
575any @code{eval-when} construct and is described below. 570any @code{cl-eval-when} construct and is described below.
576 571
577The other form, @code{(eval-and-compile @dots{})}, is exactly 572The other form, @code{(eval-and-compile @dots{})}, is exactly
578equivalent to @samp{(eval-when (compile load eval) @dots{})} and 573equivalent to @samp{(cl-eval-when (compile load eval) @dots{})} and
579so is not itself defined by this package. 574so is not itself defined by this package.
580 575
581@defspec eval-when-compile forms... 576@defspec eval-when-compile forms...
@@ -647,10 +642,6 @@ facts are true or false.
647@node Type Predicates 642@node Type Predicates
648@section Type Predicates 643@section Type Predicates
649 644
650@noindent
651The @code{CL} package defines a version of the Common Lisp @code{typep}
652predicate.
653
654@defun cl-typep object type 645@defun cl-typep object type
655Check if @var{object} is of type @var{type}, where @var{type} is a 646Check if @var{object} is of type @var{type}, where @var{type} is a
656(quoted) type name of the sort used by Common Lisp. For example, 647(quoted) type name of the sort used by Common Lisp. For example,
@@ -731,7 +722,7 @@ related to @code{cl-typep}.
731@defun cl-coerce object type 722@defun cl-coerce object type
732This function attempts to convert @var{object} to the specified 723This function attempts to convert @var{object} to the specified
733@var{type}. If @var{object} is already of that type as determined by 724@var{type}. If @var{object} is already of that type as determined by
734@code{typep}, it is simply returned. Otherwise, certain types of 725@code{cl-typep}, it is simply returned. Otherwise, certain types of
735conversions will be made: If @var{type} is any sequence type 726conversions will be made: If @var{type} is any sequence type
736(@code{string}, @code{list}, etc.) then @var{object} will be 727(@code{string}, @code{list}, etc.) then @var{object} will be
737converted to that type if possible. If @var{type} is 728converted to that type if possible. If @var{type} is
@@ -1103,7 +1094,8 @@ does, which means the above form is @emph{not} equivalent to the
1103``obvious'' expansion, 1094``obvious'' expansion,
1104 1095
1105@example 1096@example
1106(setf (aref vec (cl-incf i)) (1+ (aref vec (cl-incf i)))) ; Wrong! 1097(setf (aref vec (cl-incf i))
1098 (1+ (aref vec (cl-incf i)))) ; wrong!
1107@end example 1099@end example
1108 1100
1109@noindent 1101@noindent
@@ -1128,6 +1120,7 @@ This macro decrements the number stored in @var{place} by one, or
1128by @var{x} if specified. 1120by @var{x} if specified.
1129@end defspec 1121@end defspec
1130 1122
1123@c FIXME move to lispref, add generalized variables.
1131@defspec pop place 1124@defspec pop place
1132This macro removes and returns the first element of the list stored 1125This macro removes and returns the first element of the list stored
1133in @var{place}. It is analogous to @code{(prog1 (car @var{place}) 1126in @var{place}. It is analogous to @code{(prog1 (car @var{place})
@@ -1135,17 +1128,18 @@ in @var{place}. It is analogous to @code{(prog1 (car @var{place})
1135to evaluate all subforms only once. 1128to evaluate all subforms only once.
1136@end defspec 1129@end defspec
1137 1130
1131@c FIXME move to lispref, add generalized variables.
1138@defspec push x place 1132@defspec push x place
1139This macro inserts @var{x} at the front of the list stored in 1133This macro inserts @var{x} at the front of the list stored in
1140@var{place}. It is analogous to @code{(setf @var{place} (cons 1134@var{place}. It is analogous to @code{(setf @var{place} (cons
1141@var{x} @var{place}))}, except for evaluation of the subforms. 1135@var{x} @var{place}))}, except for evaluation of the subforms.
1142@end defspec 1136@end defspec
1143 1137
1144@defspec pushnew x place @t{&key :test :test-not :key} 1138@defspec cl-pushnew x place @t{&key :test :test-not :key}
1145This macro inserts @var{x} at the front of the list stored in 1139This macro inserts @var{x} at the front of the list stored in
1146@var{place}, but only if @var{x} was not @code{eql} to any 1140@var{place}, but only if @var{x} was not @code{eql} to any
1147existing element of the list. The optional keyword arguments 1141existing element of the list. The optional keyword arguments
1148are interpreted in the same way as for @code{adjoin}. 1142are interpreted in the same way as for @code{cl-adjoin}.
1149@xref{Lists as Sets}. 1143@xref{Lists as Sets}.
1150@end defspec 1144@end defspec
1151 1145
@@ -1169,9 +1163,9 @@ except that the subforms of @var{a}, @var{b}, and @var{c} are actually
1169evaluated only once each and in the apparent order. 1163evaluated only once each and in the apparent order.
1170@end defspec 1164@end defspec
1171 1165
1172@defspec rotatef place@dots{} 1166@defspec cl-rotatef place@dots{}
1173This macro rotates the @var{place}s left by one in circular fashion. 1167This macro rotates the @var{place}s left by one in circular fashion.
1174Thus, @code{(rotatef @var{a} @var{b} @var{c} @var{d})} is equivalent to 1168Thus, @code{(cl-rotatef @var{a} @var{b} @var{c} @var{d})} is equivalent to
1175 1169
1176@example 1170@example
1177(psetf @var{a} @var{b} 1171(psetf @var{a} @var{b}
@@ -1181,8 +1175,8 @@ Thus, @code{(rotatef @var{a} @var{b} @var{c} @var{d})} is equivalent to
1181@end example 1175@end example
1182 1176
1183@noindent 1177@noindent
1184except for the evaluation of subforms. @code{rotatef} always 1178except for the evaluation of subforms. @code{cl-rotatef} always
1185returns @code{nil}. Note that @code{(rotatef @var{a} @var{b})} 1179returns @code{nil}. Note that @code{(cl-rotatef @var{a} @var{b})}
1186conveniently exchanges @var{a} and @var{b}. 1180conveniently exchanges @var{a} and @var{b}.
1187@end defspec 1181@end defspec
1188 1182
@@ -1241,40 +1235,40 @@ If the symbol is not bound on entry, it is simply made unbound by
1241@code{makunbound} or @code{fmakunbound} on exit. 1235@code{makunbound} or @code{fmakunbound} on exit.
1242@end defspec 1236@end defspec
1243 1237
1244@defspec letf* (bindings@dots{}) forms@dots{} 1238@defspec cl-letf* (bindings@dots{}) forms@dots{}
1245This macro is to @code{letf} what @code{let*} is to @code{let}: 1239This macro is to @code{letf} what @code{let*} is to @code{let}:
1246It does the bindings in sequential rather than parallel order. 1240It does the bindings in sequential rather than parallel order.
1247@end defspec 1241@end defspec
1248 1242
1249@defspec callf @var{function} @var{place} @var{args}@dots{} 1243@defspec cl-callf @var{function} @var{place} @var{args}@dots{}
1250This is the ``generic'' modify macro. It calls @var{function}, 1244This is the ``generic'' modify macro. It calls @var{function},
1251which should be an unquoted function name, macro name, or lambda. 1245which should be an unquoted function name, macro name, or lambda.
1252It passes @var{place} and @var{args} as arguments, and assigns the 1246It passes @var{place} and @var{args} as arguments, and assigns the
1253result back to @var{place}. For example, @code{(cl-incf @var{place} 1247result back to @var{place}. For example, @code{(cl-incf @var{place}
1254@var{n})} is the same as @code{(callf + @var{place} @var{n})}. 1248@var{n})} is the same as @code{(cl-callf + @var{place} @var{n})}.
1255Some more examples: 1249Some more examples:
1256 1250
1257@example 1251@example
1258(callf abs my-number) 1252(cl-callf abs my-number)
1259(callf concat (buffer-name) "<" (int-to-string n) ">") 1253(cl-callf concat (buffer-name) "<" (number-to-string n) ">")
1260(callf union happy-people (list joe bob) :test 'same-person) 1254(cl-callf cl-union happy-people (list joe bob) :test 'same-person)
1261@end example 1255@end example
1262 1256
1263@xref{Customizing Setf}, for @code{define-modify-macro}, a way 1257@xref{Customizing Setf}, for @code{define-modify-macro}, a way
1264to create even more concise notations for modify macros. Note 1258to create even more concise notations for modify macros. Note
1265again that @code{callf} is an extension to standard Common Lisp. 1259again that @code{cl-callf} is an extension to standard Common Lisp.
1266@end defspec 1260@end defspec
1267 1261
1268@defspec callf2 @var{function} @var{arg1} @var{place} @var{args}@dots{} 1262@defspec cl-callf2 @var{function} @var{arg1} @var{place} @var{args}@dots{}
1269This macro is like @code{callf}, except that @var{place} is 1263This macro is like @code{cl-callf}, except that @var{place} is
1270the @emph{second} argument of @var{function} rather than the 1264the @emph{second} argument of @var{function} rather than the
1271first. For example, @code{(push @var{x} @var{place})} is 1265first. For example, @code{(push @var{x} @var{place})} is
1272equivalent to @code{(callf2 cons @var{x} @var{place})}. 1266equivalent to @code{(cl-callf2 cons @var{x} @var{place})}.
1273@end defspec 1267@end defspec
1274 1268
1275The @code{callf} and @code{callf2} macros serve as building 1269The @code{cl-callf} and @code{cl-callf2} macros serve as building
1276blocks for other macros like @code{cl-incf}, @code{pushnew}, and 1270blocks for other macros like @code{cl-incf}, @code{cl-pushnew}, and
1277@code{define-modify-macro}. The @code{letf} and @code{letf*} 1271@code{define-modify-macro}. The @code{letf} and @code{cl-letf*}
1278macros are used in the processing of symbol macros; 1272macros are used in the processing of symbol macros;
1279@pxref{Macro Bindings}. 1273@pxref{Macro Bindings}.
1280 1274
@@ -1488,10 +1482,6 @@ or otherwise declared; in newer Common Lisps, this would not be
1488an error since the function @code{(setf @var{func})} might be 1482an error since the function @code{(setf @var{func})} might be
1489defined later. 1483defined later.
1490 1484
1491@iftex
1492@secno=4
1493@end iftex
1494
1495@node Variable Bindings 1485@node Variable Bindings
1496@section Variable Bindings 1486@section Variable Bindings
1497 1487
@@ -1524,7 +1514,7 @@ set of variables computed at run-time. The expressions
1524of symbols and values, respectively. The symbols are bound to the 1514of symbols and values, respectively. The symbols are bound to the
1525corresponding values for the duration of the body @var{form}s. 1515corresponding values for the duration of the body @var{form}s.
1526If @var{values} is shorter than @var{symbols}, the last few symbols 1516If @var{values} is shorter than @var{symbols}, the last few symbols
1527are made unbound (as if by @code{makunbound}) inside the body. 1517are bound to @code{nil}.
1528If @var{symbols} is shorter than @var{values}, the excess values 1518If @var{symbols} is shorter than @var{values}, the excess values
1529are ignored. 1519are ignored.
1530@end defspec 1520@end defspec
@@ -1655,7 +1645,7 @@ This form establishes @code{let}-style bindings on the function
1655cells of symbols rather than on the value cells. Each @var{binding} 1645cells of symbols rather than on the value cells. Each @var{binding}
1656must be a list of the form @samp{(@var{name} @var{arglist} 1646must be a list of the form @samp{(@var{name} @var{arglist}
1657@var{forms}@dots{})}, which defines a function exactly as if 1647@var{forms}@dots{})}, which defines a function exactly as if
1658it were a @code{defun*} form. The function @var{name} is defined 1648it were a @code{cl-defun} form. The function @var{name} is defined
1659accordingly for the duration of the body of the @code{flet}; then 1649accordingly for the duration of the body of the @code{flet}; then
1660the old function definition, or lack thereof, is restored. 1650the old function definition, or lack thereof, is restored.
1661 1651
@@ -1723,7 +1713,7 @@ function, or a use of its name quoted by @code{quote} or
1723@subsection Macro Bindings 1713@subsection Macro Bindings
1724 1714
1725@noindent 1715@noindent
1726These forms create local macros and ``symbol macros.'' 1716These forms create local macros and ``symbol macros''.
1727 1717
1728@defspec cl-macrolet (bindings@dots{}) forms@dots{} 1718@defspec cl-macrolet (bindings@dots{}) forms@dots{}
1729This form is analogous to @code{flet}, but for macros instead of 1719This form is analogous to @code{flet}, but for macros instead of
@@ -1759,7 +1749,7 @@ I.e., @code{(setq foo 4)} in the above would be equivalent to
1759@code{(setf foo 4)}, which in turn expands to @code{(setf (car bar) 4)}. 1749@code{(setf foo 4)}, which in turn expands to @code{(setf (car bar) 4)}.
1760 1750
1761Likewise, a @code{let} or @code{let*} binding a symbol macro is 1751Likewise, a @code{let} or @code{let*} binding a symbol macro is
1762treated like a @code{letf} or @code{letf*}. This differs from true 1752treated like a @code{letf} or @code{cl-letf*}. This differs from true
1763Common Lisp, where the rules of lexical scoping cause a @code{let} 1753Common Lisp, where the rules of lexical scoping cause a @code{let}
1764binding to shadow a @code{cl-symbol-macrolet} binding. In this package, 1754binding to shadow a @code{cl-symbol-macrolet} binding. In this package,
1765only @code{lexical-let} and @code{lexical-let*} will shadow a symbol 1755only @code{lexical-let} and @code{lexical-let*} will shadow a symbol
@@ -1773,8 +1763,9 @@ expansion of another macro:
1773(cl-defmacro my-dolist ((x list) &rest body) 1763(cl-defmacro my-dolist ((x list) &rest body)
1774 (let ((var (gensym))) 1764 (let ((var (gensym)))
1775 (list 'cl-loop 'for var 'on list 'do 1765 (list 'cl-loop 'for var 'on list 'do
1776 (cl-list* 'cl-symbol-macrolet (list (list x (list 'car var))) 1766 (cl-list* 'cl-symbol-macrolet
1777 body)))) 1767 (list (list x (list 'car var)))
1768 body))))
1778 1769
1779(setq mylist '(1 2 3 4)) 1770(setq mylist '(1 2 3 4))
1780(my-dolist (x mylist) (cl-incf x)) 1771(my-dolist (x mylist) (cl-incf x))
@@ -1828,7 +1819,7 @@ of the form
1828where @var{keylist} is a list of key values. If there is exactly 1819where @var{keylist} is a list of key values. If there is exactly
1829one value, and it is not a cons cell or the symbol @code{nil} or 1820one value, and it is not a cons cell or the symbol @code{nil} or
1830@code{t}, then it can be used by itself as a @var{keylist} without 1821@code{t}, then it can be used by itself as a @var{keylist} without
1831being enclosed in a list. All key values in the @code{case} form 1822being enclosed in a list. All key values in the @code{cl-case} form
1832must be distinct. The final clauses may use @code{t} in place of 1823must be distinct. The final clauses may use @code{t} in place of
1833a @var{keylist} to indicate a default clause that should be taken 1824a @var{keylist} to indicate a default clause that should be taken
1834if none of the other clauses match. (The symbol @code{otherwise} 1825if none of the other clauses match. (The symbol @code{otherwise}
@@ -1999,7 +1990,7 @@ evaluated, then each @var{var} is set to the associated @var{step}
1999expression (as if by a @code{cl-psetq} form) and the next iteration 1990expression (as if by a @code{cl-psetq} form) and the next iteration
2000begins. Once the @var{end-test} becomes true, the @var{result} 1991begins. Once the @var{end-test} becomes true, the @var{result}
2001forms are evaluated (with the @var{var}s still bound to their 1992forms are evaluated (with the @var{var}s still bound to their
2002values) to produce the result returned by @code{do}. 1993values) to produce the result returned by @code{cl-do}.
2003 1994
2004The entire @code{cl-do} loop is enclosed in an implicit @code{nil} 1995The entire @code{cl-do} loop is enclosed in an implicit @code{nil}
2005block, so that you can use @code{(cl-return)} to break out of the 1996block, so that you can use @code{(cl-return)} to break out of the
@@ -2007,7 +1998,7 @@ loop at any time.
2007 1998
2008If there are no @var{result} forms, the loop returns @code{nil}. 1999If there are no @var{result} forms, the loop returns @code{nil}.
2009If a given @var{var} has no @var{step} form, it is bound to its 2000If a given @var{var} has no @var{step} form, it is bound to its
2010@var{init} value but not otherwise modified during the @code{do} 2001@var{init} value but not otherwise modified during the @code{cl-do}
2011loop (unless the code explicitly modifies it); this case is just 2002loop (unless the code explicitly modifies it); this case is just
2012a shorthand for putting a @code{(let ((@var{var} @var{init})) @dots{})} 2003a shorthand for putting a @code{(let ((@var{var} @var{init})) @dots{})}
2013around the loop. If @var{init} is also omitted it defaults to 2004around the loop. If @var{init} is also omitted it defaults to
@@ -2099,7 +2090,7 @@ that they are either too simple and limited, such as Common Lisp's
2099obscure, like Common Lisp's @code{do} loop. 2090obscure, like Common Lisp's @code{do} loop.
2100 2091
2101To remedy this, recent versions of Common Lisp have added a new 2092To remedy this, recent versions of Common Lisp have added a new
2102construct called the ``Loop Facility'' or ``@code{loop} macro,'' 2093construct called the ``Loop Facility'' or ``@code{loop} macro'',
2103with an easy-to-use but very powerful and expressive syntax. 2094with an easy-to-use but very powerful and expressive syntax.
2104 2095
2105@menu 2096@menu
@@ -2161,7 +2152,7 @@ them to return a value by using an accumulation clause like
2161@code{collect}, an end-test clause like @code{always}, or an 2152@code{collect}, an end-test clause like @code{always}, or an
2162explicit @code{return} clause to jump out of the implicit block. 2153explicit @code{return} clause to jump out of the implicit block.
2163(Because the loop body is enclosed in an implicit block, you can 2154(Because the loop body is enclosed in an implicit block, you can
2164also use regular Lisp @code{return} or @code{return-from} to 2155also use regular Lisp @code{cl-return} or @code{cl-return-from} to
2165break out of the loop.) 2156break out of the loop.)
2166@end defspec 2157@end defspec
2167 2158
@@ -2185,7 +2176,7 @@ language.
2185 2176
2186@noindent 2177@noindent
2187This loop iterates over all Emacs buffers, using the list 2178This loop iterates over all Emacs buffers, using the list
2188returned by @code{buffer-list}. For each buffer @code{buf}, 2179returned by @code{buffer-list}. For each buffer @var{buf},
2189it calls @code{buffer-file-name} and collects the results into 2180it calls @code{buffer-file-name} and collects the results into
2190a list, which is then returned from the @code{cl-loop} construct. 2181a list, which is then returned from the @code{cl-loop} construct.
2191The result is a list of the file names of all the buffers in 2182The result is a list of the file names of all the buffers in
@@ -2818,6 +2809,7 @@ Of course, @code{return} is generally used inside an @code{if} or
2818the loop would never get to ``loop'' more than once. 2809the loop would never get to ``loop'' more than once.
2819 2810
2820The clause @samp{return @var{form}} is equivalent to 2811The clause @samp{return @var{form}} is equivalent to
2812@c FIXME cl-do, cl-return?
2821@samp{do (return @var{form})} (or @code{return-from} if the loop 2813@samp{do (return @var{form})} (or @code{return-from} if the loop
2822was named). The @code{return} clause is implemented a bit more 2814was named). The @code{return} clause is implemented a bit more
2823efficiently, though. 2815efficiently, though.
@@ -3061,7 +3053,8 @@ and declare it inline all at once.
3061 3053
3062@example 3054@example
3063(cl-declaim (inline foo bar)) 3055(cl-declaim (inline foo bar))
3064(cl-eval-when (compile load eval) (cl-proclaim '(inline foo bar))) 3056(cl-eval-when (compile load eval)
3057 (cl-proclaim '(inline foo bar)))
3065(defsubst foo (...) ...) ; instead of defun 3058(defsubst foo (...) ...) ; instead of defun
3066@end example 3059@end example
3067 3060
@@ -3091,7 +3084,7 @@ The word @code{optimize} is followed by any number of lists like
3091@code{(speed 3)} or @code{(safety 2)}. Common Lisp defines several 3084@code{(speed 3)} or @code{(safety 2)}. Common Lisp defines several
3092optimization ``qualities''; this package ignores all but @code{speed} 3085optimization ``qualities''; this package ignores all but @code{speed}
3093and @code{safety}. The value of a quality should be an integer from 3086and @code{safety}. The value of a quality should be an integer from
30940 to 3, with 0 meaning ``unimportant'' and 3 meaning ``very important.'' 30870 to 3, with 0 meaning ``unimportant'' and 3 meaning ``very important''.
3095The default level for both qualities is 1. 3088The default level for both qualities is 1.
3096 3089
3097In this package, with the optimizing compiler, the 3090In this package, with the optimizing compiler, the
@@ -3125,7 +3118,7 @@ automatically be unset after the enclosing form is done.)
3125This declaration controls what sorts of warnings are generated 3118This declaration controls what sorts of warnings are generated
3126by the byte compiler. Again, only the optimizing compiler 3119by the byte compiler. Again, only the optimizing compiler
3127generates warnings. The word @code{warn} is followed by any 3120generates warnings. The word @code{warn} is followed by any
3128number of ``warning qualities,'' similar in form to optimization 3121number of ``warning qualities'', similar in form to optimization
3129qualities. The currently supported warning types are 3122qualities. The currently supported warning types are
3130@code{redefine}, @code{callargs}, @code{unresolved}, and 3123@code{redefine}, @code{callargs}, @code{unresolved}, and
3131@code{free-vars}; in the current system, a value of 0 will 3124@code{free-vars}; in the current system, a value of 0 will
@@ -3227,10 +3220,6 @@ whereas if it occurs later, this simply uses @code{setcdr} to splice
3227out the property and value cells. 3220out the property and value cells.
3228@end defspec 3221@end defspec
3229 3222
3230@iftex
3231@secno=2
3232@end iftex
3233
3234@node Creating Symbols 3223@node Creating Symbols
3235@section Creating Symbols 3224@section Creating Symbols
3236 3225
@@ -3289,10 +3278,6 @@ which were left out of Emacs Lisp.
3289* Implementation Parameters:: @code{cl-most-positive-float}. 3278* Implementation Parameters:: @code{cl-most-positive-float}.
3290@end menu 3279@end menu
3291 3280
3292@iftex
3293@secno=1
3294@end iftex
3295
3296@node Predicates on Numbers 3281@node Predicates on Numbers
3297@section Predicates on Numbers 3282@section Predicates on Numbers
3298 3283
@@ -3326,10 +3311,6 @@ number. On systems that support floating-point, this is equivalent
3326to @code{floatp}. On other systems, this always returns @code{nil}. 3311to @code{floatp}. On other systems, this always returns @code{nil}.
3327@end defun 3312@end defun
3328 3313
3329@iftex
3330@secno=3
3331@end iftex
3332
3333@node Numerical Functions 3314@node Numerical Functions
3334@section Numerical Functions 3315@section Numerical Functions
3335 3316
@@ -3412,10 +3393,6 @@ This function returns the same value as the second return value
3412of @code{cl-truncate}. 3393of @code{cl-truncate}.
3413@end defun 3394@end defun
3414 3395
3415@iftex
3416@secno=8
3417@end iftex
3418
3419@node Random Numbers 3396@node Random Numbers
3420@section Random Numbers 3397@section Random Numbers
3421 3398
@@ -3433,7 +3410,7 @@ The @var{state} argument should be a @code{random-state} object
3433which holds the state of the random number generator. The 3410which holds the state of the random number generator. The
3434function modifies this state object as a side effect. If 3411function modifies this state object as a side effect. If
3435@var{state} is omitted, it defaults to the variable 3412@var{state} is omitted, it defaults to the variable
3436@code{*random-state*}, which contains a pre-initialized 3413@code{cl--random-state}, which contains a pre-initialized
3437@code{random-state} object. 3414@code{random-state} object.
3438@end defun 3415@end defun
3439 3416
@@ -3683,7 +3660,7 @@ just like @code{cl-mapcar}, but it returns a sequence of type
3683@var{result-type} rather than a list. @var{result-type} must 3660@var{result-type} rather than a list. @var{result-type} must
3684be one of the following symbols: @code{vector}, @code{string}, 3661be one of the following symbols: @code{vector}, @code{string},
3685@code{list} (in which case the effect is the same as for 3662@code{list} (in which case the effect is the same as for
3686@code{mapcar*}), or @code{nil} (in which case the results are 3663@code{cl-mapcar}), or @code{nil} (in which case the results are
3687thrown away and @code{cl-map} returns @code{nil}). 3664thrown away and @code{cl-map} returns @code{nil}).
3688@end defun 3665@end defun
3689 3666
@@ -3914,9 +3891,10 @@ by returning a changed copy of the sequence.
3914@findex cl-substitute-if-not 3891@findex cl-substitute-if-not
3915@findex cl-nsubstitute-if 3892@findex cl-nsubstitute-if
3916@findex cl-nsubstitute-if-not 3893@findex cl-nsubstitute-if-not
3917The @code{cl-substitute-if}, @code{cl-substitute-if-not}, @code{cl-nsubstitute-if}, 3894The functions @code{cl-substitute-if}, @code{cl-substitute-if-not},
3918and @code{cl-nsubstitute-if-not} functions are defined similarly. For 3895@code{cl-nsubstitute-if}, and @code{cl-nsubstitute-if-not} are defined
3919these, a @var{predicate} is given in place of the @var{old} argument. 3896similarly. For these, a @var{predicate} is given in place of the
3897@var{old} argument.
3920 3898
3921@node Searching Sequences 3899@node Searching Sequences
3922@section Searching Sequences 3900@section Searching Sequences
@@ -4145,10 +4123,6 @@ specified test. The @code{:key} function, if specified, is
4145applied to the elements of both trees. @xref{Sequences}. 4123applied to the elements of both trees. @xref{Sequences}.
4146@end defun 4124@end defun
4147 4125
4148@iftex
4149@secno=3
4150@end iftex
4151
4152@node Substitution of Expressions 4126@node Substitution of Expressions
4153@section Substitution of Expressions 4127@section Substitution of Expressions
4154 4128
@@ -4384,7 +4358,7 @@ You can create a new @code{person} by calling @code{make-person},
4384which takes keyword arguments @code{:name}, @code{:age}, and 4358which takes keyword arguments @code{:name}, @code{:age}, and
4385@code{:sex} to specify the initial values of these slots in the 4359@code{:sex} to specify the initial values of these slots in the
4386new object. (Omitting any of these arguments leaves the corresponding 4360new object. (Omitting any of these arguments leaves the corresponding
4387slot ``undefined,'' according to the Common Lisp standard; in Emacs 4361slot ``undefined'', according to the Common Lisp standard; in Emacs
4388Lisp, such uninitialized slots are filled with @code{nil}.) 4362Lisp, such uninitialized slots are filled with @code{nil}.)
4389 4363
4390Given a @code{person}, @code{(copy-person @var{p})} makes a new 4364Given a @code{person}, @code{(copy-person @var{p})} makes a new
@@ -4465,10 +4439,6 @@ enclosed in lists.)
4465The following structure options are recognized. 4439The following structure options are recognized.
4466 4440
4467@table @code 4441@table @code
4468@iftex
4469@itemmax=0 in
4470@advance@leftskip-.5@tableindent
4471@end iftex
4472@item :conc-name 4442@item :conc-name
4473The argument is a symbol whose print name is used as the prefix for 4443The argument is a symbol whose print name is used as the prefix for
4474the names of slot accessor functions. The default is the name of 4444the names of slot accessor functions. The default is the name of
@@ -4508,7 +4478,8 @@ option.
4508(cl-defstruct 4478(cl-defstruct
4509 (person 4479 (person
4510 (:constructor nil) ; no default constructor 4480 (:constructor nil) ; no default constructor
4511 (:constructor new-person (name sex &optional (age 0))) 4481 (:constructor new-person
4482 (name sex &optional (age 0)))
4512 (:constructor new-hound (&key (name "Rover") 4483 (:constructor new-hound (&key (name "Rover")
4513 (dog-years 0) 4484 (dog-years 0)
4514 &aux (age (* 7 dog-years)) 4485 &aux (age (* 7 dog-years))
@@ -4519,7 +4490,7 @@ option.
4519The first constructor here takes its arguments positionally rather 4490The first constructor here takes its arguments positionally rather
4520than by keyword. (In official Common Lisp terminology, constructors 4491than by keyword. (In official Common Lisp terminology, constructors
4521that work By Order of Arguments instead of by keyword are called 4492that work By Order of Arguments instead of by keyword are called
4522``BOA constructors.'' No, I'm not making this up.) For example, 4493``BOA constructors''. No, I'm not making this up.) For example,
4523@code{(new-person "Jane" 'female)} generates a person whose slots 4494@code{(new-person "Jane" 'female)} generates a person whose slots
4524are @code{"Jane"}, 0, and @code{female}, respectively. 4495are @code{"Jane"}, 0, and @code{female}, respectively.
4525 4496
@@ -4545,7 +4516,7 @@ ever generated.)
4545 4516
4546In true Common Lisp, @code{typep} is always able to recognize a 4517In true Common Lisp, @code{typep} is always able to recognize a
4547structure object even if @code{:predicate} was used. In this 4518structure object even if @code{:predicate} was used. In this
4548package, @code{typep} simply looks for a function called 4519package, @code{cl-typep} simply looks for a function called
4549@code{@var{typename}-p}, so it will work for structure types 4520@code{@var{typename}-p}, so it will work for structure types
4550only if they used the default predicate name. 4521only if they used the default predicate name.
4551 4522
@@ -4778,7 +4749,7 @@ This function takes a single Lisp form as an argument and inserts
4778a nicely formatted copy of it in the current buffer (which must be 4749a nicely formatted copy of it in the current buffer (which must be
4779in Lisp mode so that indentation works properly). It also expands 4750in Lisp mode so that indentation works properly). It also expands
4780all Lisp macros which appear in the form. The easiest way to use 4751all Lisp macros which appear in the form. The easiest way to use
4781this function is to go to the @code{*scratch*} buffer and type, say, 4752this function is to go to the @file{*scratch*} buffer and type, say,
4782 4753
4783@example 4754@example
4784(cl-prettyexpand '(loop for x below 10 collect x)) 4755(cl-prettyexpand '(loop for x below 10 collect x))
@@ -4998,8 +4969,8 @@ in @code{map-odd-elements} by the time the @code{(+ a x)} function
4998is called. 4969is called.
4999 4970
5000(This package avoids such problems in its own mapping functions 4971(This package avoids such problems in its own mapping functions
5001by using names like @code{cl-x} instead of @code{x} internally; 4972by using names like @code{cl--x} instead of @code{x} internally;
5002as long as you don't use the @code{cl-} prefix for your own 4973as long as you don't use this prefix for your own
5003variables no collision can occur.) 4974variables no collision can occur.)
5004 4975
5005@xref{Lexical Bindings}, for a description of the @code{lexical-let} 4976@xref{Lexical Bindings}, for a description of the @code{lexical-let}
@@ -5044,7 +5015,7 @@ Lisp, they are totally distinct in Emacs Lisp. Common Lisp
5044programs which refer to a symbol by the full name sometimes 5015programs which refer to a symbol by the full name sometimes
5045and the short name other times will not port cleanly to Emacs. 5016and the short name other times will not port cleanly to Emacs.
5046 5017
5047Emacs Lisp does have a concept of ``obarrays,'' which are 5018Emacs Lisp does have a concept of ``obarrays'', which are
5048package-like collections of symbols, but this feature is not 5019package-like collections of symbols, but this feature is not
5049strong enough to be used as a true package mechanism. 5020strong enough to be used as a true package mechanism.
5050 5021
@@ -5064,10 +5035,10 @@ codes provide such features as paragraph filling, case
5064conversion, and even loops and conditionals. 5035conversion, and even loops and conditionals.
5065 5036
5066While it would have been possible to implement most of Common 5037While it would have been possible to implement most of Common
5067Lisp @code{format} in this package (under the name @code{format*}, 5038Lisp @code{format} in this package (under the name @code{cl-format},
5068of course), it was not deemed worthwhile. It would have required 5039of course), it was not deemed worthwhile. It would have required
5069a huge amount of code to implement even a decent subset of 5040a huge amount of code to implement even a decent subset of
5070@code{format*}, yet the functionality it would provide over 5041@code{cl-format}, yet the functionality it would provide over
5071Emacs Lisp's @code{format} would rarely be useful. 5042Emacs Lisp's @code{format} would rarely be useful.
5072 5043
5073@item 5044@item
diff --git a/etc/NEWS b/etc/NEWS
index d891e28e7ef..b6f8cd92af1 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -332,6 +332,7 @@ The difference is that it relies on the `lexical-binding' machinery (as opposed
332to the `lexical-let' machinery used previously) to capture definitions in 332to the `lexical-let' machinery used previously) to capture definitions in
333closures, so such closures will only work if `lexical-binding' is in use. 333closures, so such closures will only work if `lexical-binding' is in use.
334 334
335+++
335*** `progv' was rewritten to use the `let' machinery. 336*** `progv' was rewritten to use the `let' machinery.
336A side effect is that vars without corresponding value are bound to nil 337A side effect is that vars without corresponding value are bound to nil
337rather than making them unbound. 338rather than making them unbound.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 07ce9cea1a3..1150b68fe0f 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
12012-10-25 Glenn Morris <rgm@gnu.org>
2
3 * emacs-lisp/cl-macs.el (cl-progv): Doc fix.
4
12012-10-24 Stefan Monnier <monnier@iro.umontreal.ca> 52012-10-24 Stefan Monnier <monnier@iro.umontreal.ca>
2 6
3 * minibuffer.el (minibuffer-force-complete): Use one more marker 7 * minibuffer.el (minibuffer-force-complete): Use one more marker
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 592c33d21c5..a448973c1bb 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -1603,7 +1603,7 @@ before assigning any symbols SYM to the corresponding values.
1603 "Bind SYMBOLS to VALUES dynamically in BODY. 1603 "Bind SYMBOLS to VALUES dynamically in BODY.
1604The forms SYMBOLS and VALUES are evaluated, and must evaluate to lists. 1604The forms SYMBOLS and VALUES are evaluated, and must evaluate to lists.
1605Each symbol in the first list is bound to the corresponding value in the 1605Each symbol in the first list is bound to the corresponding value in the
1606second list (or made unbound if VALUES is shorter than SYMBOLS); then the 1606second list (or to nil if VALUES is shorter than SYMBOLS); then the
1607BODY forms are executed and their result is returned. This is much like 1607BODY forms are executed and their result is returned. This is much like
1608a `let' form, except that the list of symbols can be computed at run-time." 1608a `let' form, except that the list of symbols can be computed at run-time."
1609 (declare (indent 2) (debug (form form body))) 1609 (declare (indent 2) (debug (form form body)))