aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2012-10-27 15:54:53 -0700
committerGlenn Morris2012-10-27 15:54:53 -0700
commite11174254bab35ec88a8dfb483bd49104773d051 (patch)
tree595e786318cefa19e434fd1aed246f4f5e3d351b
parent5887564d5b5c90a1bc2ff7c0a3412cb6f765d03e (diff)
downloademacs-e11174254bab35ec88a8dfb483bd49104773d051.tar.gz
emacs-e11174254bab35ec88a8dfb483bd49104773d051.zip
* doc/misc/cl.texi: Use defmac for macros rather than defspec.
(Efficiency Concerns): Related copyedit.
-rw-r--r--doc/misc/ChangeLog3
-rw-r--r--doc/misc/cl.texi238
2 files changed, 121 insertions, 120 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog
index d447b0ca1ff..24d8f1cee25 100644
--- a/doc/misc/ChangeLog
+++ b/doc/misc/ChangeLog
@@ -1,5 +1,8 @@
12012-10-27 Glenn Morris <rgm@gnu.org> 12012-10-27 Glenn Morris <rgm@gnu.org>
2 2
3 * cl.texi: Use defmac for macros rather than defspec.
4 (Efficiency Concerns): Related copyedit.
5
3 * cl.texi (Control Structure): Update for setf now being in core. 6 * cl.texi (Control Structure): Update for setf now being in core.
4 (Setf Extensions): Rename from Basic Setf. Move much of the 7 (Setf Extensions): Rename from Basic Setf. Move much of the
5 former content to lispref/variables.texi. 8 former content to lispref/variables.texi.
diff --git a/doc/misc/cl.texi b/doc/misc/cl.texi
index aba3f244012..09386e2c0c7 100644
--- a/doc/misc/cl.texi
+++ b/doc/misc/cl.texi
@@ -268,14 +268,14 @@ this package to implement Common Lisp argument lists seamlessly.
268Instead, this package defines alternates for several Lisp forms 268Instead, this package defines alternates for several Lisp forms
269which you must use if you need Common Lisp argument lists. 269which you must use if you need Common Lisp argument lists.
270 270
271@defspec cl-defun name arglist body... 271@defmac cl-defun name arglist body...
272This form is identical to the regular @code{defun} form, except 272This form is identical to the regular @code{defun} form, except
273that @var{arglist} is allowed to be a full Common Lisp argument 273that @var{arglist} is allowed to be a full Common Lisp argument
274list. Also, the function body is enclosed in an implicit block 274list. Also, the function body is enclosed in an implicit block
275called @var{name}; @pxref{Blocks and Exits}. 275called @var{name}; @pxref{Blocks and Exits}.
276@end defspec 276@end defmac
277 277
278@defspec cl-defsubst name arglist body... 278@defmac cl-defsubst name arglist body...
279This is just like @code{cl-defun}, except that the function that 279This is just like @code{cl-defun}, except that the function that
280is defined is automatically proclaimed @code{inline}, i.e., 280is defined is automatically proclaimed @code{inline}, i.e.,
281calls to it may be expanded into in-line code by the byte compiler. 281calls to it may be expanded into in-line code by the byte compiler.
@@ -285,9 +285,9 @@ works in all versions of Emacs, and also generates somewhat more
285efficient inline expansions. In particular, @code{cl-defsubst} 285efficient inline expansions. In particular, @code{cl-defsubst}
286arranges for the processing of keyword arguments, default values, 286arranges for the processing of keyword arguments, default values,
287etc., to be done at compile-time whenever possible. 287etc., to be done at compile-time whenever possible.
288@end defspec 288@end defmac
289 289
290@defspec cl-defmacro name arglist body... 290@defmac cl-defmacro name arglist body...
291This is identical to the regular @code{defmacro} form, 291This is identical to the regular @code{defmacro} form,
292except that @var{arglist} is allowed to be a full Common Lisp 292except that @var{arglist} is allowed to be a full Common Lisp
293argument list. The @code{&environment} keyword is supported as 293argument list. The @code{&environment} keyword is supported as
@@ -296,13 +296,13 @@ within destructured lists (see below); top-level @code{&whole}
296cannot be implemented with the current Emacs Lisp interpreter. 296cannot be implemented with the current Emacs Lisp interpreter.
297The macro expander body is enclosed in an implicit block called 297The macro expander body is enclosed in an implicit block called
298@var{name}. 298@var{name}.
299@end defspec 299@end defmac
300 300
301@defspec cl-function symbol-or-lambda 301@defmac cl-function symbol-or-lambda
302This is identical to the regular @code{function} form, 302This is identical to the regular @code{function} form,
303except that if the argument is a @code{lambda} form then that 303except that if the argument is a @code{lambda} form then that
304form may use a full Common Lisp argument list. 304form may use a full Common Lisp argument list.
305@end defspec 305@end defmac
306 306
307Also, all forms (such as @code{cl-flet} and @code{cl-labels}) defined 307Also, all forms (such as @code{cl-flet} and @code{cl-labels}) defined
308in this package that include @var{arglist}s in their syntax allow 308in this package that include @var{arglist}s in their syntax allow
@@ -491,7 +491,7 @@ For example, the compiler effectively evaluates @code{defmacro} forms
491at compile-time so that later parts of the file can refer to the 491at compile-time so that later parts of the file can refer to the
492macros that are defined. 492macros that are defined.
493 493
494@defspec cl-eval-when (situations...) forms... 494@defmac cl-eval-when (situations...) forms...
495This form controls when the body @var{forms} are evaluated. 495This form controls when the body @var{forms} are evaluated.
496The @var{situations} list may contain any set of the symbols 496The @var{situations} list may contain any set of the symbols
497@code{compile}, @code{load}, and @code{eval} (or their long-winded 497@code{compile}, @code{load}, and @code{eval} (or their long-winded
@@ -563,7 +563,7 @@ to @code{(progn @dots{})} in all contexts. The compiler treats
563certain top-level forms, like @code{defmacro} (sort-of) and 563certain top-level forms, like @code{defmacro} (sort-of) and
564@code{require}, as if they were wrapped in @code{(cl-eval-when 564@code{require}, as if they were wrapped in @code{(cl-eval-when
565(compile load eval) @dots{})}. 565(compile load eval) @dots{})}.
566@end defspec 566@end defmac
567 567
568Emacs includes two special forms related to @code{cl-eval-when}. 568Emacs includes two special forms related to @code{cl-eval-when}.
569One of these, @code{eval-when-compile}, is not quite equivalent to 569One of these, @code{eval-when-compile}, is not quite equivalent to
@@ -573,7 +573,7 @@ The other form, @code{(eval-and-compile @dots{})}, is exactly
573equivalent to @samp{(cl-eval-when (compile load eval) @dots{})} and 573equivalent to @samp{(cl-eval-when (compile load eval) @dots{})} and
574so is not itself defined by this package. 574so is not itself defined by this package.
575 575
576@defspec eval-when-compile forms... 576@defmac eval-when-compile forms...
577The @var{forms} are evaluated at compile-time; at execution time, 577The @var{forms} are evaluated at compile-time; at execution time,
578this form acts like a quoted constant of the resulting value. Used 578this form acts like a quoted constant of the resulting value. Used
579at top-level, @code{eval-when-compile} is just like @samp{eval-when 579at top-level, @code{eval-when-compile} is just like @samp{eval-when
@@ -582,9 +582,9 @@ allows code to be evaluated once at compile-time for efficiency
582or other reasons. 582or other reasons.
583 583
584This form is similar to the @samp{#.} syntax of true Common Lisp. 584This form is similar to the @samp{#.} syntax of true Common Lisp.
585@end defspec 585@end defmac
586 586
587@defspec cl-load-time-value form 587@defmac cl-load-time-value form
588The @var{form} is evaluated at load-time; at execution time, 588The @var{form} is evaluated at load-time; at execution time,
589this form acts like a quoted constant of the resulting value. 589this form acts like a quoted constant of the resulting value.
590 590
@@ -625,7 +625,7 @@ Byte-compiled, the above defun will result in the following code
625 ", and loaded on: " 625 ", and loaded on: "
626 --temp--)) 626 --temp--))
627@end example 627@end example
628@end defspec 628@end defmac
629 629
630@node Predicates 630@node Predicates
631@chapter Predicates 631@chapter Predicates
@@ -733,7 +733,7 @@ floats. In all other circumstances, @code{cl-coerce} signals an
733error. 733error.
734@end defun 734@end defun
735 735
736@defspec cl-deftype name arglist forms... 736@defmac cl-deftype name arglist forms...
737This macro defines a new type called @var{name}. It is similar 737This macro defines a new type called @var{name}. It is similar
738to @code{defmacro} in many ways; when @var{name} is encountered 738to @code{defmacro} in many ways; when @var{name} is encountered
739as a type name, the body @var{forms} are evaluated and should 739as a type name, the body @var{forms} are evaluated and should
@@ -761,7 +761,7 @@ unsigned-byte @equiv{} (integer 0 *)
761The last example shows how the Common Lisp @code{unsigned-byte} 761The last example shows how the Common Lisp @code{unsigned-byte}
762type specifier could be implemented if desired; this package does 762type specifier could be implemented if desired; this package does
763not implement @code{unsigned-byte} by default. 763not implement @code{unsigned-byte} by default.
764@end defspec 764@end defmac
765 765
766The @code{cl-typecase} and @code{cl-check-type} macros also use type 766The @code{cl-typecase} and @code{cl-check-type} macros also use type
767names. @xref{Conditionals}. @xref{Assertions}. The @code{cl-map}, 767names. @xref{Conditionals}. @xref{Assertions}. The @code{cl-map},
@@ -826,7 +826,7 @@ constructs.
826The @code{cl-psetq} form is just like @code{setq}, except that multiple 826The @code{cl-psetq} form is just like @code{setq}, except that multiple
827assignments are done in parallel rather than sequentially. 827assignments are done in parallel rather than sequentially.
828 828
829@defspec cl-psetq [symbol form]@dots{} 829@defmac cl-psetq [symbol form]@dots{}
830This special form (actually a macro) is used to assign to several 830This special form (actually a macro) is used to assign to several
831variables simultaneously. Given only one @var{symbol} and @var{form}, 831variables simultaneously. Given only one @var{symbol} and @var{form},
832it has the same effect as @code{setq}. Given several @var{symbol} 832it has the same effect as @code{setq}. Given several @var{symbol}
@@ -854,7 +854,7 @@ provides an even more convenient way to swap two variables;
854@pxref{Modify Macros}.) 854@pxref{Modify Macros}.)
855 855
856@code{cl-psetq} always returns @code{nil}. 856@code{cl-psetq} always returns @code{nil}.
857@end defspec 857@end defmac
858 858
859@node Generalized Variables 859@node Generalized Variables
860@section Generalized Variables 860@section Generalized Variables
@@ -1010,15 +1010,15 @@ This package defines a number of macros that operate on generalized
1010variables. Many are interesting and useful even when the @var{place} 1010variables. Many are interesting and useful even when the @var{place}
1011is just a variable name. 1011is just a variable name.
1012 1012
1013@defspec cl-psetf [place form]@dots{} 1013@defmac cl-psetf [place form]@dots{}
1014This macro is to @code{setf} what @code{cl-psetq} is to @code{setq}: 1014This macro is to @code{setf} what @code{cl-psetq} is to @code{setq}:
1015When several @var{place}s and @var{form}s are involved, the 1015When several @var{place}s and @var{form}s are involved, the
1016assignments take place in parallel rather than sequentially. 1016assignments take place in parallel rather than sequentially.
1017Specifically, all subforms are evaluated from left to right, then 1017Specifically, all subforms are evaluated from left to right, then
1018all the assignments are done (in an undefined order). 1018all the assignments are done (in an undefined order).
1019@end defspec 1019@end defmac
1020 1020
1021@defspec cl-incf place &optional x 1021@defmac cl-incf place &optional x
1022This macro increments the number stored in @var{place} by one, or 1022This macro increments the number stored in @var{place} by one, or
1023by @var{x} if specified. The incremented value is returned. For 1023by @var{x} if specified. The incremented value is returned. For
1024example, @code{(cl-incf i)} is equivalent to @code{(setq i (1+ i))}, and 1024example, @code{(cl-incf i)} is equivalent to @code{(setq i (1+ i))}, and
@@ -1057,22 +1057,22 @@ the other generalized-variable macros.
1057As a more Emacs-specific example of @code{cl-incf}, the expression 1057As a more Emacs-specific example of @code{cl-incf}, the expression
1058@code{(cl-incf (point) @var{n})} is essentially equivalent to 1058@code{(cl-incf (point) @var{n})} is essentially equivalent to
1059@code{(forward-char @var{n})}. 1059@code{(forward-char @var{n})}.
1060@end defspec 1060@end defmac
1061 1061
1062@defspec cl-decf place &optional x 1062@defmac cl-decf place &optional x
1063This macro decrements the number stored in @var{place} by one, or 1063This macro decrements the number stored in @var{place} by one, or
1064by @var{x} if specified. 1064by @var{x} if specified.
1065@end defspec 1065@end defmac
1066 1066
1067@defspec cl-pushnew x place @t{&key :test :test-not :key} 1067@defmac cl-pushnew x place @t{&key :test :test-not :key}
1068This macro inserts @var{x} at the front of the list stored in 1068This macro inserts @var{x} at the front of the list stored in
1069@var{place}, but only if @var{x} was not @code{eql} to any 1069@var{place}, but only if @var{x} was not @code{eql} to any
1070existing element of the list. The optional keyword arguments 1070existing element of the list. The optional keyword arguments
1071are interpreted in the same way as for @code{cl-adjoin}. 1071are interpreted in the same way as for @code{cl-adjoin}.
1072@xref{Lists as Sets}. 1072@xref{Lists as Sets}.
1073@end defspec 1073@end defmac
1074 1074
1075@defspec cl-shiftf place@dots{} newvalue 1075@defmac cl-shiftf place@dots{} newvalue
1076This macro shifts the @var{place}s left by one, shifting in the 1076This macro shifts the @var{place}s left by one, shifting in the
1077value of @var{newvalue} (which may be any Lisp expression, not just 1077value of @var{newvalue} (which may be any Lisp expression, not just
1078a generalized variable), and returning the value shifted out of 1078a generalized variable), and returning the value shifted out of
@@ -1090,9 +1090,9 @@ the first @var{place}. Thus, @code{(cl-shiftf @var{a} @var{b} @var{c}
1090@noindent 1090@noindent
1091except that the subforms of @var{a}, @var{b}, and @var{c} are actually 1091except that the subforms of @var{a}, @var{b}, and @var{c} are actually
1092evaluated only once each and in the apparent order. 1092evaluated only once each and in the apparent order.
1093@end defspec 1093@end defmac
1094 1094
1095@defspec cl-rotatef place@dots{} 1095@defmac cl-rotatef place@dots{}
1096This macro rotates the @var{place}s left by one in circular fashion. 1096This macro rotates the @var{place}s left by one in circular fashion.
1097Thus, @code{(cl-rotatef @var{a} @var{b} @var{c} @var{d})} is equivalent to 1097Thus, @code{(cl-rotatef @var{a} @var{b} @var{c} @var{d})} is equivalent to
1098 1098
@@ -1107,12 +1107,12 @@ Thus, @code{(cl-rotatef @var{a} @var{b} @var{c} @var{d})} is equivalent to
1107except for the evaluation of subforms. @code{cl-rotatef} always 1107except for the evaluation of subforms. @code{cl-rotatef} always
1108returns @code{nil}. Note that @code{(cl-rotatef @var{a} @var{b})} 1108returns @code{nil}. Note that @code{(cl-rotatef @var{a} @var{b})}
1109conveniently exchanges @var{a} and @var{b}. 1109conveniently exchanges @var{a} and @var{b}.
1110@end defspec 1110@end defmac
1111 1111
1112The following macros were invented for this package; they have no 1112The following macros were invented for this package; they have no
1113analogues in Common Lisp. 1113analogues in Common Lisp.
1114 1114
1115@defspec letf (bindings@dots{}) forms@dots{} 1115@defmac letf (bindings@dots{}) forms@dots{}
1116This macro is analogous to @code{let}, but for generalized variables 1116This macro is analogous to @code{let}, but for generalized variables
1117rather than just symbols. Each @var{binding} should be of the form 1117rather than just symbols. Each @var{binding} should be of the form
1118@code{(@var{place} @var{value})}; the original contents of the 1118@code{(@var{place} @var{value})}; the original contents of the
@@ -1162,14 +1162,14 @@ entry to the @code{letf} form. The only exceptions are plain
1162variables and calls to @code{symbol-value} and @code{symbol-function}. 1162variables and calls to @code{symbol-value} and @code{symbol-function}.
1163If the symbol is not bound on entry, it is simply made unbound by 1163If the symbol is not bound on entry, it is simply made unbound by
1164@code{makunbound} or @code{fmakunbound} on exit. 1164@code{makunbound} or @code{fmakunbound} on exit.
1165@end defspec 1165@end defmac
1166 1166
1167@defspec cl-letf* (bindings@dots{}) forms@dots{} 1167@defmac cl-letf* (bindings@dots{}) forms@dots{}
1168This macro is to @code{letf} what @code{let*} is to @code{let}: 1168This macro is to @code{letf} what @code{let*} is to @code{let}:
1169It does the bindings in sequential rather than parallel order. 1169It does the bindings in sequential rather than parallel order.
1170@end defspec 1170@end defmac
1171 1171
1172@defspec cl-callf @var{function} @var{place} @var{args}@dots{} 1172@defmac cl-callf @var{function} @var{place} @var{args}@dots{}
1173This is the ``generic'' modify macro. It calls @var{function}, 1173This is the ``generic'' modify macro. It calls @var{function},
1174which should be an unquoted function name, macro name, or lambda. 1174which should be an unquoted function name, macro name, or lambda.
1175It passes @var{place} and @var{args} as arguments, and assigns the 1175It passes @var{place} and @var{args} as arguments, and assigns the
@@ -1186,14 +1186,14 @@ Some more examples:
1186@xref{Customizing Setf}, for @code{define-modify-macro}, a way 1186@xref{Customizing Setf}, for @code{define-modify-macro}, a way
1187to create even more concise notations for modify macros. Note 1187to create even more concise notations for modify macros. Note
1188again that @code{cl-callf} is an extension to standard Common Lisp. 1188again that @code{cl-callf} is an extension to standard Common Lisp.
1189@end defspec 1189@end defmac
1190 1190
1191@defspec cl-callf2 @var{function} @var{arg1} @var{place} @var{args}@dots{} 1191@defmac cl-callf2 @var{function} @var{arg1} @var{place} @var{args}@dots{}
1192This macro is like @code{cl-callf}, except that @var{place} is 1192This macro is like @code{cl-callf}, except that @var{place} is
1193the @emph{second} argument of @var{function} rather than the 1193the @emph{second} argument of @var{function} rather than the
1194first. For example, @code{(push @var{x} @var{place})} is 1194first. For example, @code{(push @var{x} @var{place})} is
1195equivalent to @code{(cl-callf2 cons @var{x} @var{place})}. 1195equivalent to @code{(cl-callf2 cons @var{x} @var{place})}.
1196@end defspec 1196@end defmac
1197 1197
1198The @code{cl-callf} and @code{cl-callf2} macros serve as building 1198The @code{cl-callf} and @code{cl-callf2} macros serve as building
1199blocks for other macros like @code{cl-incf}, @code{cl-pushnew}, and 1199blocks for other macros like @code{cl-incf}, @code{cl-pushnew}, and
@@ -1209,7 +1209,7 @@ Common Lisp defines three macros, @code{define-modify-macro},
1209@code{defsetf}, and @code{define-setf-method}, that allow the 1209@code{defsetf}, and @code{define-setf-method}, that allow the
1210user to extend generalized variables in various ways. 1210user to extend generalized variables in various ways.
1211 1211
1212@defspec define-modify-macro name arglist function [doc-string] 1212@defmac define-modify-macro name arglist function [doc-string]
1213This macro defines a ``read-modify-write'' macro similar to 1213This macro defines a ``read-modify-write'' macro similar to
1214@code{cl-incf} and @code{cl-decf}. The macro @var{name} is defined 1214@code{cl-incf} and @code{cl-decf}. The macro @var{name} is defined
1215to take a @var{place} argument followed by additional arguments 1215to take a @var{place} argument followed by additional arguments
@@ -1249,9 +1249,9 @@ follow the pattern of @code{define-modify-macro}. For example,
1249is completely irregular. You can define these macros ``by hand'' 1249is completely irregular. You can define these macros ``by hand''
1250using @code{get-setf-method}, or consult the source 1250using @code{get-setf-method}, or consult the source
1251to see how to use the internal @code{setf} building blocks. 1251to see how to use the internal @code{setf} building blocks.
1252@end defspec 1252@end defmac
1253 1253
1254@defspec defsetf access-fn update-fn 1254@defmac defsetf access-fn update-fn
1255This is the simpler of two @code{defsetf} forms. Where 1255This is the simpler of two @code{defsetf} forms. Where
1256@var{access-fn} is the name of a function which accesses a place, 1256@var{access-fn} is the name of a function which accesses a place,
1257this declares @var{update-fn} to be the corresponding store 1257this declares @var{update-fn} to be the corresponding store
@@ -1294,9 +1294,9 @@ suite of setf methods, are:
1294(defsetf symbol-value set) 1294(defsetf symbol-value set)
1295(defsetf buffer-name rename-buffer t) 1295(defsetf buffer-name rename-buffer t)
1296@end example 1296@end example
1297@end defspec 1297@end defmac
1298 1298
1299@defspec defsetf access-fn arglist (store-var) forms@dots{} 1299@defmac defsetf access-fn arglist (store-var) forms@dots{}
1300This is the second, more complex, form of @code{defsetf}. It is 1300This is the second, more complex, form of @code{defsetf}. It is
1301rather like @code{defmacro} except for the additional @var{store-var} 1301rather like @code{defmacro} except for the additional @var{store-var}
1302argument. The @var{forms} should return a Lisp form which stores 1302argument. The @var{forms} should return a Lisp form which stores
@@ -1325,9 +1325,9 @@ Another example drawn from the standard package:
1325(defsetf nth (n x) (store) 1325(defsetf nth (n x) (store)
1326 (list 'setcar (list 'nthcdr n x) store)) 1326 (list 'setcar (list 'nthcdr n x) store))
1327@end example 1327@end example
1328@end defspec 1328@end defmac
1329 1329
1330@defspec define-setf-method access-fn arglist forms@dots{} 1330@defmac define-setf-method access-fn arglist forms@dots{}
1331This is the most general way to create new place forms. When 1331This is the most general way to create new place forms. When
1332a @code{setf} to @var{access-fn} with arguments described by 1332a @code{setf} to @var{access-fn} with arguments described by
1333@var{arglist} is expanded, the @var{forms} are evaluated and 1333@var{arglist} is expanded, the @var{forms} are evaluated and
@@ -1372,7 +1372,7 @@ by @code{cl-gensym}. Macros like @code{setf} and @code{cl-incf} which
1372use this setf-method will optimize away most temporaries that 1372use this setf-method will optimize away most temporaries that
1373turn out to be unnecessary, so there is little reason for the 1373turn out to be unnecessary, so there is little reason for the
1374setf-method itself to optimize. 1374setf-method itself to optimize.
1375@end defspec 1375@end defmac
1376 1376
1377@defun get-setf-method place &optional env 1377@defun get-setf-method place &optional env
1378This function returns the setf-method for @var{place}, by 1378This function returns the setf-method for @var{place}, by
@@ -1435,7 +1435,7 @@ The standard @code{let} form binds variables whose names are known
1435at compile-time. The @code{cl-progv} form provides an easy way to 1435at compile-time. The @code{cl-progv} form provides an easy way to
1436bind variables whose names are computed at run-time. 1436bind variables whose names are computed at run-time.
1437 1437
1438@defspec cl-progv symbols values forms@dots{} 1438@defmac cl-progv symbols values forms@dots{}
1439This form establishes @code{let}-style variable bindings on a 1439This form establishes @code{let}-style variable bindings on a
1440set of variables computed at run-time. The expressions 1440set of variables computed at run-time. The expressions
1441@var{symbols} and @var{values} are evaluated, and must return lists 1441@var{symbols} and @var{values} are evaluated, and must return lists
@@ -1445,7 +1445,7 @@ If @var{values} is shorter than @var{symbols}, the last few symbols
1445are bound to @code{nil}. 1445are bound to @code{nil}.
1446If @var{symbols} is shorter than @var{values}, the excess values 1446If @var{symbols} is shorter than @var{values}, the excess values
1447are ignored. 1447are ignored.
1448@end defspec 1448@end defmac
1449 1449
1450@node Lexical Bindings 1450@node Lexical Bindings
1451@subsection Lexical Bindings 1451@subsection Lexical Bindings
@@ -1454,7 +1454,7 @@ are ignored.
1454The @code{CL} package defines the following macro which 1454The @code{CL} package defines the following macro which
1455more closely follows the Common Lisp @code{let} form: 1455more closely follows the Common Lisp @code{let} form:
1456 1456
1457@defspec lexical-let (bindings@dots{}) forms@dots{} 1457@defmac lexical-let (bindings@dots{}) forms@dots{}
1458This form is exactly like @code{let} except that the bindings it 1458This form is exactly like @code{let} except that the bindings it
1459establishes are purely lexical. Lexical bindings are similar to 1459establishes are purely lexical. Lexical bindings are similar to
1460local variables in a language like C: Only the code physically 1460local variables in a language like C: Only the code physically
@@ -1554,12 +1554,12 @@ instance of the lexical variable.
1554 1554
1555The @code{lexical-let} form is an extension to Common Lisp. In 1555The @code{lexical-let} form is an extension to Common Lisp. In
1556true Common Lisp, all bindings are lexical unless declared otherwise. 1556true Common Lisp, all bindings are lexical unless declared otherwise.
1557@end defspec 1557@end defmac
1558 1558
1559@defspec lexical-let* (bindings@dots{}) forms@dots{} 1559@defmac lexical-let* (bindings@dots{}) forms@dots{}
1560This form is just like @code{lexical-let}, except that the bindings 1560This form is just like @code{lexical-let}, except that the bindings
1561are made sequentially in the manner of @code{let*}. 1561are made sequentially in the manner of @code{let*}.
1562@end defspec 1562@end defmac
1563 1563
1564@node Function Bindings 1564@node Function Bindings
1565@subsection Function Bindings 1565@subsection Function Bindings
@@ -1568,7 +1568,7 @@ are made sequentially in the manner of @code{let*}.
1568These forms make @code{let}-like bindings to functions instead 1568These forms make @code{let}-like bindings to functions instead
1569of variables. 1569of variables.
1570 1570
1571@defspec flet (bindings@dots{}) forms@dots{} 1571@defmac flet (bindings@dots{}) forms@dots{}
1572This form establishes @code{let}-style bindings on the function 1572This form establishes @code{let}-style bindings on the function
1573cells of symbols rather than on the value cells. Each @var{binding} 1573cells of symbols rather than on the value cells. Each @var{binding}
1574must be a list of the form @samp{(@var{name} @var{arglist} 1574must be a list of the form @samp{(@var{name} @var{arglist}
@@ -1612,9 +1612,9 @@ Functions defined by @code{flet} may use the full Common Lisp
1612argument notation supported by @code{cl-defun}; also, the function 1612argument notation supported by @code{cl-defun}; also, the function
1613body is enclosed in an implicit block as if by @code{cl-defun}. 1613body is enclosed in an implicit block as if by @code{cl-defun}.
1614@xref{Program Structure}. 1614@xref{Program Structure}.
1615@end defspec 1615@end defmac
1616 1616
1617@defspec labels (bindings@dots{}) forms@dots{} 1617@defmac labels (bindings@dots{}) forms@dots{}
1618The @code{labels} form is like @code{flet}, except that it 1618The @code{labels} form is like @code{flet}, except that it
1619makes lexical bindings of the function names rather than 1619makes lexical bindings of the function names rather than
1620dynamic bindings. (In true Common Lisp, both @code{flet} and 1620dynamic bindings. (In true Common Lisp, both @code{flet} and
@@ -1635,7 +1635,7 @@ functions.
1635A ``reference'' to a function name is either a call to that 1635A ``reference'' to a function name is either a call to that
1636function, or a use of its name quoted by @code{quote} or 1636function, or a use of its name quoted by @code{quote} or
1637@code{function} to be passed on to, say, @code{mapcar}. 1637@code{function} to be passed on to, say, @code{mapcar}.
1638@end defspec 1638@end defmac
1639 1639
1640@node Macro Bindings 1640@node Macro Bindings
1641@subsection Macro Bindings 1641@subsection Macro Bindings
@@ -1643,7 +1643,7 @@ function, or a use of its name quoted by @code{quote} or
1643@noindent 1643@noindent
1644These forms create local macros and ``symbol macros''. 1644These forms create local macros and ``symbol macros''.
1645 1645
1646@defspec cl-macrolet (bindings@dots{}) forms@dots{} 1646@defmac cl-macrolet (bindings@dots{}) forms@dots{}
1647This form is analogous to @code{flet}, but for macros instead of 1647This form is analogous to @code{flet}, but for macros instead of
1648functions. Each @var{binding} is a list of the same form as the 1648functions. Each @var{binding} is a list of the same form as the
1649arguments to @code{cl-defmacro} (i.e., a macro name, argument list, 1649arguments to @code{cl-defmacro} (i.e., a macro name, argument list,
@@ -1655,9 +1655,9 @@ scoped even in Emacs Lisp: The @code{cl-macrolet} binding will
1655affect only calls that appear physically within the body 1655affect only calls that appear physically within the body
1656@var{forms}, possibly after expansion of other macros in the 1656@var{forms}, possibly after expansion of other macros in the
1657body. 1657body.
1658@end defspec 1658@end defmac
1659 1659
1660@defspec cl-symbol-macrolet (bindings@dots{}) forms@dots{} 1660@defmac cl-symbol-macrolet (bindings@dots{}) forms@dots{}
1661This form creates @dfn{symbol macros}, which are macros that look 1661This form creates @dfn{symbol macros}, which are macros that look
1662like variable references rather than function calls. Each 1662like variable references rather than function calls. Each
1663@var{binding} is a list @samp{(@var{var} @var{expansion})}; 1663@var{binding} is a list @samp{(@var{var} @var{expansion})};
@@ -1723,7 +1723,7 @@ which in turn expands to
1723@xref{Loop Facility}, for a description of the @code{cl-loop} macro. 1723@xref{Loop Facility}, for a description of the @code{cl-loop} macro.
1724This package defines a nonstandard @code{in-ref} loop clause that 1724This package defines a nonstandard @code{in-ref} loop clause that
1725works much like @code{my-dolist}. 1725works much like @code{my-dolist}.
1726@end defspec 1726@end defmac
1727 1727
1728@node Conditionals 1728@node Conditionals
1729@section Conditionals 1729@section Conditionals
@@ -1732,7 +1732,7 @@ works much like @code{my-dolist}.
1732These conditional forms augment Emacs Lisp's simple @code{if}, 1732These conditional forms augment Emacs Lisp's simple @code{if},
1733@code{and}, @code{or}, and @code{cond} forms. 1733@code{and}, @code{or}, and @code{cond} forms.
1734 1734
1735@defspec cl-case keyform clause@dots{} 1735@defmac cl-case keyform clause@dots{}
1736This macro evaluates @var{keyform}, then compares it with the key 1736This macro evaluates @var{keyform}, then compares it with the key
1737values listed in the various @var{clause}s. Whichever clause matches 1737values listed in the various @var{clause}s. Whichever clause matches
1738the key is executed; comparison is done by @code{eql}. If no clause 1738the key is executed; comparison is done by @code{eql}. If no clause
@@ -1766,15 +1766,15 @@ a @key{RET} or @kbd{C-j}, or anything else.
1766 ((?\r ?\n) (do-ret-thing)) 1766 ((?\r ?\n) (do-ret-thing))
1767 (t (do-other-thing))) 1767 (t (do-other-thing)))
1768@end example 1768@end example
1769@end defspec 1769@end defmac
1770 1770
1771@defspec cl-ecase keyform clause@dots{} 1771@defmac cl-ecase keyform clause@dots{}
1772This macro is just like @code{cl-case}, except that if the key does 1772This macro is just like @code{cl-case}, except that if the key does
1773not match any of the clauses, an error is signaled rather than 1773not match any of the clauses, an error is signaled rather than
1774simply returning @code{nil}. 1774simply returning @code{nil}.
1775@end defspec 1775@end defmac
1776 1776
1777@defspec cl-typecase keyform clause@dots{} 1777@defmac cl-typecase keyform clause@dots{}
1778This macro is a version of @code{cl-case} that checks for types 1778This macro is a version of @code{cl-case} that checks for types
1779rather than values. Each @var{clause} is of the form 1779rather than values. Each @var{clause} is of the form
1780@samp{(@var{type} @var{body}...)}. @xref{Type Predicates}, 1780@samp{(@var{type} @var{body}...)}. @xref{Type Predicates},
@@ -1791,13 +1791,13 @@ for a description of type specifiers. For example,
1791The type specifier @code{t} matches any type of object; the word 1791The type specifier @code{t} matches any type of object; the word
1792@code{otherwise} is also allowed. To make one clause match any of 1792@code{otherwise} is also allowed. To make one clause match any of
1793several types, use an @code{(or ...)} type specifier. 1793several types, use an @code{(or ...)} type specifier.
1794@end defspec 1794@end defmac
1795 1795
1796@defspec cl-etypecase keyform clause@dots{} 1796@defmac cl-etypecase keyform clause@dots{}
1797This macro is just like @code{cl-typecase}, except that if the key does 1797This macro is just like @code{cl-typecase}, except that if the key does
1798not match any of the clauses, an error is signaled rather than 1798not match any of the clauses, an error is signaled rather than
1799simply returning @code{nil}. 1799simply returning @code{nil}.
1800@end defspec 1800@end defmac
1801 1801
1802@node Blocks and Exits 1802@node Blocks and Exits
1803@section Blocks and Exits 1803@section Blocks and Exits
@@ -1810,7 +1810,7 @@ in terms of @code{catch}; however, the lexical scoping allows the
1810optimizing byte-compiler to omit the costly @code{catch} step if the 1810optimizing byte-compiler to omit the costly @code{catch} step if the
1811body of the block does not actually @code{cl-return-from} the block. 1811body of the block does not actually @code{cl-return-from} the block.
1812 1812
1813@defspec cl-block name forms@dots{} 1813@defmac cl-block name forms@dots{}
1814The @var{forms} are evaluated as if by a @code{progn}. However, 1814The @var{forms} are evaluated as if by a @code{progn}. However,
1815if any of the @var{forms} execute @code{(cl-return-from @var{name})}, 1815if any of the @var{forms} execute @code{(cl-return-from @var{name})},
1816they will jump out and return directly from the @code{cl-block} form. 1816they will jump out and return directly from the @code{cl-block} form.
@@ -1849,20 +1849,20 @@ not in fact contain any @code{cl-return} or @code{cl-return-from} calls
1849that jump to it. This means that @code{cl-do} loops and @code{cl-defun} 1849that jump to it. This means that @code{cl-do} loops and @code{cl-defun}
1850functions which don't use @code{cl-return} don't pay the overhead to 1850functions which don't use @code{cl-return} don't pay the overhead to
1851support it. 1851support it.
1852@end defspec 1852@end defmac
1853 1853
1854@defspec cl-return-from name [result] 1854@defmac cl-return-from name [result]
1855This macro returns from the block named @var{name}, which must be 1855This macro returns from the block named @var{name}, which must be
1856an (unevaluated) symbol. If a @var{result} form is specified, it 1856an (unevaluated) symbol. If a @var{result} form is specified, it
1857is evaluated to produce the result returned from the @code{block}. 1857is evaluated to produce the result returned from the @code{block}.
1858Otherwise, @code{nil} is returned. 1858Otherwise, @code{nil} is returned.
1859@end defspec 1859@end defmac
1860 1860
1861@defspec cl-return [result] 1861@defmac cl-return [result]
1862This macro is exactly like @code{(cl-return-from nil @var{result})}. 1862This macro is exactly like @code{(cl-return-from nil @var{result})}.
1863Common Lisp loops like @code{cl-do} and @code{cl-dolist} implicitly enclose 1863Common Lisp loops like @code{cl-do} and @code{cl-dolist} implicitly enclose
1864themselves in @code{nil} blocks. 1864themselves in @code{nil} blocks.
1865@end defspec 1865@end defmac
1866 1866
1867@node Iteration 1867@node Iteration
1868@section Iteration 1868@section Iteration
@@ -1872,7 +1872,7 @@ The macros described here provide more sophisticated, high-level
1872looping constructs to complement Emacs Lisp's basic @code{while} 1872looping constructs to complement Emacs Lisp's basic @code{while}
1873loop. 1873loop.
1874 1874
1875@defspec cl-loop forms@dots{} 1875@defmac cl-loop forms@dots{}
1876The @code{CL} package supports both the simple, old-style meaning of 1876The @code{CL} package supports both the simple, old-style meaning of
1877@code{loop} and the extremely powerful and flexible feature known as 1877@code{loop} and the extremely powerful and flexible feature known as
1878the @dfn{Loop Facility} or @dfn{Loop Macro}. This more advanced 1878the @dfn{Loop Facility} or @dfn{Loop Macro}. This more advanced
@@ -1900,9 +1900,9 @@ interpreted as a Loop Macro specification as described later.
1900(This is not a restriction in practice, since a plain symbol 1900(This is not a restriction in practice, since a plain symbol
1901in the above notation would simply access and throw away the 1901in the above notation would simply access and throw away the
1902value of a variable.) 1902value of a variable.)
1903@end defspec 1903@end defmac
1904 1904
1905@defspec cl-do (spec@dots{}) (end-test [result@dots{}]) forms@dots{} 1905@defmac cl-do (spec@dots{}) (end-test [result@dots{}]) forms@dots{}
1906This macro creates a general iterative loop. Each @var{spec} is 1906This macro creates a general iterative loop. Each @var{spec} is
1907of the form 1907of the form
1908 1908
@@ -1948,9 +1948,9 @@ the rest of the loop.
1948 ((or (null x) (null y)) 1948 ((or (null x) (null y))
1949 (nreverse z))) 1949 (nreverse z)))
1950@end example 1950@end example
1951@end defspec 1951@end defmac
1952 1952
1953@defspec cl-do* (spec@dots{}) (end-test [result@dots{}]) forms@dots{} 1953@defmac cl-do* (spec@dots{}) (end-test [result@dots{}]) forms@dots{}
1954This is to @code{cl-do} what @code{let*} is to @code{let}. In 1954This is to @code{cl-do} what @code{let*} is to @code{let}. In
1955particular, the initial values are bound as if by @code{let*} 1955particular, the initial values are bound as if by @code{let*}
1956rather than @code{let}, and the steps are assigned as if by 1956rather than @code{let}, and the steps are assigned as if by
@@ -1968,9 +1968,9 @@ Here is another way to write the above loop:
1968 (nreverse z)) 1968 (nreverse z))
1969 (push (f x y) z)) 1969 (push (f x y) z))
1970@end example 1970@end example
1971@end defspec 1971@end defmac
1972 1972
1973@defspec cl-dolist (var list [result]) forms@dots{} 1973@defmac cl-dolist (var list [result]) forms@dots{}
1974This is a more specialized loop which iterates across the elements 1974This is a more specialized loop which iterates across the elements
1975of a list. @var{list} should evaluate to a list; the body @var{forms} 1975of a list. @var{list} should evaluate to a list; the body @var{forms}
1976are executed with @var{var} bound to each element of the list in 1976are executed with @var{var} bound to each element of the list in
@@ -1978,9 +1978,9 @@ turn. Finally, the @var{result} form (or @code{nil}) is evaluated
1978with @var{var} bound to @code{nil} to produce the result returned by 1978with @var{var} bound to @code{nil} to produce the result returned by
1979the loop. Unlike with Emacs's built in @code{dolist}, the loop is 1979the loop. Unlike with Emacs's built in @code{dolist}, the loop is
1980surrounded by an implicit @code{nil} block. 1980surrounded by an implicit @code{nil} block.
1981@end defspec 1981@end defmac
1982 1982
1983@defspec cl-dotimes (var count [result]) forms@dots{} 1983@defmac cl-dotimes (var count [result]) forms@dots{}
1984This is a more specialized loop which iterates a specified number 1984This is a more specialized loop which iterates a specified number
1985of times. The body is executed with @var{var} bound to the integers 1985of times. The body is executed with @var{var} bound to the integers
1986from zero (inclusive) to @var{count} (exclusive), in turn. Then 1986from zero (inclusive) to @var{count} (exclusive), in turn. Then
@@ -1988,9 +1988,9 @@ the @code{result} form is evaluated with @var{var} bound to the total
1988number of iterations that were done (i.e., @code{(max 0 @var{count})}) 1988number of iterations that were done (i.e., @code{(max 0 @var{count})})
1989to get the return value for the loop form. Unlike with Emacs's built in 1989to get the return value for the loop form. Unlike with Emacs's built in
1990@code{dolist}, the loop is surrounded by an implicit @code{nil} block. 1990@code{dolist}, the loop is surrounded by an implicit @code{nil} block.
1991@end defspec 1991@end defmac
1992 1992
1993@defspec cl-do-symbols (var [obarray [result]]) forms@dots{} 1993@defmac cl-do-symbols (var [obarray [result]]) forms@dots{}
1994This loop iterates over all interned symbols. If @var{obarray} 1994This loop iterates over all interned symbols. If @var{obarray}
1995is specified and is not @code{nil}, it loops over all symbols in 1995is specified and is not @code{nil}, it loops over all symbols in
1996that obarray. For each symbol, the body @var{forms} are evaluated 1996that obarray. For each symbol, the body @var{forms} are evaluated
@@ -1998,12 +1998,12 @@ with @var{var} bound to that symbol. The symbols are visited in
1998an unspecified order. Afterward the @var{result} form, if any, 1998an unspecified order. Afterward the @var{result} form, if any,
1999is evaluated (with @var{var} bound to @code{nil}) to get the return 1999is evaluated (with @var{var} bound to @code{nil}) to get the return
2000value. The loop is surrounded by an implicit @code{nil} block. 2000value. The loop is surrounded by an implicit @code{nil} block.
2001@end defspec 2001@end defmac
2002 2002
2003@defspec cl-do-all-symbols (var [result]) forms@dots{} 2003@defmac cl-do-all-symbols (var [result]) forms@dots{}
2004This is identical to @code{cl-do-symbols} except that the @var{obarray} 2004This is identical to @code{cl-do-symbols} except that the @var{obarray}
2005argument is omitted; it always iterates over the default obarray. 2005argument is omitted; it always iterates over the default obarray.
2006@end defspec 2006@end defmac
2007 2007
2008@xref{Mapping over Sequences}, for some more functions for 2008@xref{Mapping over Sequences}, for some more functions for
2009iterating over vectors or lists. 2009iterating over vectors or lists.
@@ -2043,7 +2043,7 @@ Since @code{cl-loop} is a macro, all parsing of the loop language
2043takes place at byte-compile time; compiled @code{cl-loop}s are just 2043takes place at byte-compile time; compiled @code{cl-loop}s are just
2044as efficient as the equivalent @code{while} loops written longhand. 2044as efficient as the equivalent @code{while} loops written longhand.
2045 2045
2046@defspec cl-loop clauses@dots{} 2046@defmac cl-loop clauses@dots{}
2047A loop construct consists of a series of @var{clause}s, each 2047A loop construct consists of a series of @var{clause}s, each
2048introduced by a symbol like @code{for} or @code{do}. Clauses 2048introduced by a symbol like @code{for} or @code{do}. Clauses
2049are simply strung together in the argument list of @code{cl-loop}, 2049are simply strung together in the argument list of @code{cl-loop},
@@ -2082,7 +2082,7 @@ explicit @code{return} clause to jump out of the implicit block.
2082(Because the loop body is enclosed in an implicit block, you can 2082(Because the loop body is enclosed in an implicit block, you can
2083also use regular Lisp @code{cl-return} or @code{cl-return-from} to 2083also use regular Lisp @code{cl-return} or @code{cl-return-from} to
2084break out of the loop.) 2084break out of the loop.)
2085@end defspec 2085@end defmac
2086 2086
2087The following sections give some examples of the Loop Macro in 2087The following sections give some examples of the Loop Macro in
2088action, and describe the particular loop clauses in great detail. 2088action, and describe the particular loop clauses in great detail.
@@ -2773,21 +2773,21 @@ in Emacs Lisp these functions simply operate on lists instead.
2773The @code{values} form, for example, is a synonym for @code{list} 2773The @code{values} form, for example, is a synonym for @code{list}
2774in Emacs. 2774in Emacs.
2775 2775
2776@defspec cl-multiple-value-bind (var@dots{}) values-form forms@dots{} 2776@defmac cl-multiple-value-bind (var@dots{}) values-form forms@dots{}
2777This form evaluates @var{values-form}, which must return a list of 2777This form evaluates @var{values-form}, which must return a list of
2778values. It then binds the @var{var}s to these respective values, 2778values. It then binds the @var{var}s to these respective values,
2779as if by @code{let}, and then executes the body @var{forms}. 2779as if by @code{let}, and then executes the body @var{forms}.
2780If there are more @var{var}s than values, the extra @var{var}s 2780If there are more @var{var}s than values, the extra @var{var}s
2781are bound to @code{nil}. If there are fewer @var{var}s than 2781are bound to @code{nil}. If there are fewer @var{var}s than
2782values, the excess values are ignored. 2782values, the excess values are ignored.
2783@end defspec 2783@end defmac
2784 2784
2785@defspec cl-multiple-value-setq (var@dots{}) form 2785@defmac cl-multiple-value-setq (var@dots{}) form
2786This form evaluates @var{form}, which must return a list of values. 2786This form evaluates @var{form}, which must return a list of values.
2787It then sets the @var{var}s to these respective values, as if by 2787It then sets the @var{var}s to these respective values, as if by
2788@code{setq}. Extra @var{var}s or values are treated the same as 2788@code{setq}. Extra @var{var}s or values are treated the same as
2789in @code{cl-multiple-value-bind}. 2789in @code{cl-multiple-value-bind}.
2790@end defspec 2790@end defmac
2791 2791
2792Since a perfect emulation is not feasible in Emacs Lisp, this 2792Since a perfect emulation is not feasible in Emacs Lisp, this
2793package opts to keep it as simple and predictable as possible. 2793package opts to keep it as simple and predictable as possible.
@@ -2805,7 +2805,7 @@ for @code{defmacro} due to technical difficulties.
2805Destructuring is made available to the user by way of the 2805Destructuring is made available to the user by way of the
2806following macro: 2806following macro:
2807 2807
2808@defspec cl-destructuring-bind arglist expr forms@dots{} 2808@defmac cl-destructuring-bind arglist expr forms@dots{}
2809This macro expands to code which executes @var{forms}, with 2809This macro expands to code which executes @var{forms}, with
2810the variables in @var{arglist} bound to the list of values 2810the variables in @var{arglist} bound to the list of values
2811returned by @var{expr}. The @var{arglist} can include all 2811returned by @var{expr}. The @var{arglist} can include all
@@ -2814,13 +2814,13 @@ including destructuring. (The @code{&environment} keyword
2814is not allowed.) The macro expansion will signal an error 2814is not allowed.) The macro expansion will signal an error
2815if @var{expr} returns a list of the wrong number of arguments 2815if @var{expr} returns a list of the wrong number of arguments
2816or with incorrect keyword arguments. 2816or with incorrect keyword arguments.
2817@end defspec 2817@end defmac
2818 2818
2819This package also includes the Common Lisp @code{cl-define-compiler-macro} 2819This package also includes the Common Lisp @code{cl-define-compiler-macro}
2820facility, which allows you to define compile-time expansions and 2820facility, which allows you to define compile-time expansions and
2821optimizations for your functions. 2821optimizations for your functions.
2822 2822
2823@defspec cl-define-compiler-macro name arglist forms@dots{} 2823@defmac cl-define-compiler-macro name arglist forms@dots{}
2824This form is similar to @code{defmacro}, except that it only expands 2824This form is similar to @code{defmacro}, except that it only expands
2825calls to @var{name} at compile-time; calls processed by the Lisp 2825calls to @var{name} at compile-time; calls processed by the Lisp
2826interpreter are not expanded, nor are they expanded by the 2826interpreter are not expanded, nor are they expanded by the
@@ -2854,7 +2854,7 @@ if there are any keyword arguments in the call, then the original
2854@code{cl-member} call is left intact. (The actual compiler macro 2854@code{cl-member} call is left intact. (The actual compiler macro
2855for @code{cl-member} optimizes a number of other cases, including 2855for @code{cl-member} optimizes a number of other cases, including
2856common @code{:test} predicates.) 2856common @code{:test} predicates.)
2857@end defspec 2857@end defmac
2858 2858
2859@defun cl-compiler-macroexpand form 2859@defun cl-compiler-macroexpand form
2860This function is analogous to @code{macroexpand}, except that it 2860This function is analogous to @code{macroexpand}, except that it
@@ -2896,7 +2896,7 @@ This function records a ``global'' declaration specified by
2896is evaluated and thus should normally be quoted. 2896is evaluated and thus should normally be quoted.
2897@end defun 2897@end defun
2898 2898
2899@defspec cl-declaim decl-specs@dots{} 2899@defmac cl-declaim decl-specs@dots{}
2900This macro is like @code{cl-proclaim}, except that it takes any number 2900This macro is like @code{cl-proclaim}, except that it takes any number
2901of @var{decl-spec} arguments, and the arguments are unevaluated and 2901of @var{decl-spec} arguments, and the arguments are unevaluated and
2902unquoted. The @code{cl-declaim} macro also puts an @code{(cl-eval-when 2902unquoted. The @code{cl-declaim} macro also puts an @code{(cl-eval-when
@@ -2905,22 +2905,22 @@ be registered at compile-time as well as at run-time. (This is vital,
2905since normally the declarations are meant to influence the way the 2905since normally the declarations are meant to influence the way the
2906compiler treats the rest of the file that contains the @code{cl-declaim} 2906compiler treats the rest of the file that contains the @code{cl-declaim}
2907form.) 2907form.)
2908@end defspec 2908@end defmac
2909 2909
2910@defspec cl-declare decl-specs@dots{} 2910@defmac cl-declare decl-specs@dots{}
2911This macro is used to make declarations within functions and other 2911This macro is used to make declarations within functions and other
2912code. Common Lisp allows declarations in various locations, generally 2912code. Common Lisp allows declarations in various locations, generally
2913at the beginning of any of the many ``implicit @code{progn}s'' 2913at the beginning of any of the many ``implicit @code{progn}s''
2914throughout Lisp syntax, such as function bodies, @code{let} bodies, 2914throughout Lisp syntax, such as function bodies, @code{let} bodies,
2915etc. Currently the only declaration understood by @code{cl-declare} 2915etc. Currently the only declaration understood by @code{cl-declare}
2916is @code{special}. 2916is @code{special}.
2917@end defspec 2917@end defmac
2918 2918
2919@defspec cl-locally declarations@dots{} forms@dots{} 2919@defmac cl-locally declarations@dots{} forms@dots{}
2920In this package, @code{cl-locally} is no different from @code{progn}. 2920In this package, @code{cl-locally} is no different from @code{progn}.
2921@end defspec 2921@end defmac
2922 2922
2923@defspec cl-the type form 2923@defmac cl-the type form
2924Type information provided by @code{cl-the} is ignored in this package; 2924Type information provided by @code{cl-the} is ignored in this package;
2925in other words, @code{(cl-the @var{type} @var{form})} is equivalent 2925in other words, @code{(cl-the @var{type} @var{form})} is equivalent
2926to @var{form}. Future versions of the optimizing byte-compiler may 2926to @var{form}. Future versions of the optimizing byte-compiler may
@@ -2933,7 +2933,7 @@ of time. With @code{(mapcar 'car (cl-the vector foo))}, a future
2933compiler would have enough information to expand the loop in-line. 2933compiler would have enough information to expand the loop in-line.
2934For now, Emacs Lisp will treat the above code as exactly equivalent 2934For now, Emacs Lisp will treat the above code as exactly equivalent
2935to @code{(mapcar 'car foo)}. 2935to @code{(mapcar 'car foo)}.
2936@end defspec 2936@end defmac
2937 2937
2938Each @var{decl-spec} in a @code{cl-proclaim}, @code{cl-declaim}, or 2938Each @var{decl-spec} in a @code{cl-proclaim}, @code{cl-declaim}, or
2939@code{cl-declare} should be a list beginning with a symbol that says 2939@code{cl-declare} should be a list beginning with a symbol that says
@@ -3137,7 +3137,7 @@ function and its @var{place} argument can actually be any Lisp
3137expression. 3137expression.
3138@end defun 3138@end defun
3139 3139
3140@defspec cl-remf place property 3140@defmac cl-remf place property
3141This macro removes the property-value pair for @var{property} from 3141This macro removes the property-value pair for @var{property} from
3142the property list stored at @var{place}, which is any @code{setf}-able 3142the property list stored at @var{place}, which is any @code{setf}-able
3143place expression. It returns true if the property was found. Note 3143place expression. It returns true if the property was found. Note
@@ -3145,7 +3145,7 @@ that if @var{property} happens to be first on the list, this will
3145effectively do a @code{(setf @var{place} (cddr @var{place}))}, 3145effectively do a @code{(setf @var{place} (cddr @var{place}))},
3146whereas if it occurs later, this simply uses @code{setcdr} to splice 3146whereas if it occurs later, this simply uses @code{setcdr} to splice
3147out the property and value cells. 3147out the property and value cells.
3148@end defspec 3148@end defmac
3149 3149
3150@node Creating Symbols 3150@node Creating Symbols
3151@section Creating Symbols 3151@section Creating Symbols
@@ -4259,7 +4259,7 @@ system provides no way to create new distinct types, this package
4259implements structures as vectors (or lists upon request) with a 4259implements structures as vectors (or lists upon request) with a
4260special ``tag'' symbol to identify them. 4260special ``tag'' symbol to identify them.
4261 4261
4262@defspec cl-defstruct name slots@dots{} 4262@defmac cl-defstruct name slots@dots{}
4263The @code{cl-defstruct} form defines a new structure type called 4263The @code{cl-defstruct} form defines a new structure type called
4264@var{name}, with the specified @var{slots}. (The @var{slots} 4264@var{name}, with the specified @var{slots}. (The @var{slots}
4265may begin with a string which documents the structure type.) 4265may begin with a string which documents the structure type.)
@@ -4563,7 +4563,7 @@ the type @code{:include}s another type, then @code{:initial-offset}
4563specifies a number of slots to be skipped between the last slot 4563specifies a number of slots to be skipped between the last slot
4564of the included type and the first new slot. 4564of the included type and the first new slot.
4565@end table 4565@end table
4566@end defspec 4566@end defmac
4567 4567
4568Except as noted, the @code{cl-defstruct} facility of this package is 4568Except as noted, the @code{cl-defstruct} facility of this package is
4569entirely compatible with that of Common Lisp. 4569entirely compatible with that of Common Lisp.
@@ -4582,7 +4582,7 @@ If the optimization property @code{speed} has been set to 3, and
4582away the following assertions. Because assertions might be optimized 4582away the following assertions. Because assertions might be optimized
4583away, it is a bad idea for them to include side-effects. 4583away, it is a bad idea for them to include side-effects.
4584 4584
4585@defspec cl-assert test-form [show-args string args@dots{}] 4585@defmac cl-assert test-form [show-args string args@dots{}]
4586This form verifies that @var{test-form} is true (i.e., evaluates to 4586This form verifies that @var{test-form} is true (i.e., evaluates to
4587a non-@code{nil} value). If so, it returns @code{nil}. If the test 4587a non-@code{nil} value). If so, it returns @code{nil}. If the test
4588is not satisfied, @code{cl-assert} signals an error. 4588is not satisfied, @code{cl-assert} signals an error.
@@ -4606,9 +4606,9 @@ true Common Lisp, the second argument gives a list of @var{places}
4606which can be @code{setf}'d by the user before continuing from the 4606which can be @code{setf}'d by the user before continuing from the
4607error. Since Emacs Lisp does not support continuable errors, it 4607error. Since Emacs Lisp does not support continuable errors, it
4608makes no sense to specify @var{places}. 4608makes no sense to specify @var{places}.
4609@end defspec 4609@end defmac
4610 4610
4611@defspec cl-check-type form type [string] 4611@defmac cl-check-type form type [string]
4612This form verifies that @var{form} evaluates to a value of type 4612This form verifies that @var{form} evaluates to a value of type
4613@var{type}. If so, it returns @code{nil}. If not, @code{cl-check-type} 4613@var{type}. If so, it returns @code{nil}. If not, @code{cl-check-type}
4614signals a @code{wrong-type-argument} error. The default error message 4614signals a @code{wrong-type-argument} error. The default error message
@@ -4627,7 +4627,7 @@ Note that in Common Lisp, the first argument to @code{check-type}
4627must be a @var{place} suitable for use by @code{setf}, because 4627must be a @var{place} suitable for use by @code{setf}, because
4628@code{check-type} signals a continuable error that allows the 4628@code{check-type} signals a continuable error that allows the
4629user to modify @var{place}. 4629user to modify @var{place}.
4630@end defspec 4630@end defmac
4631 4631
4632@node Efficiency Concerns 4632@node Efficiency Concerns
4633@appendix Efficiency Concerns 4633@appendix Efficiency Concerns
@@ -4660,12 +4660,10 @@ readable @code{cl-incf} form in your compiled code.
4660@emph{Interpreted} code, on the other hand, must expand these macros 4660@emph{Interpreted} code, on the other hand, must expand these macros
4661every time they are executed. For this reason it is strongly 4661every time they are executed. For this reason it is strongly
4662recommended that code making heavy use of macros be compiled. 4662recommended that code making heavy use of macros be compiled.
4663@c FIXME why are they not labelled as macros? 4663A loop using @code{cl-incf} a hundred times will execute considerably
4664(The features labeled ``Special Form'' instead of ``Function'' in 4664faster if compiled, and will also garbage-collect less because the
4665this manual are macros.) A loop using @code{cl-incf} a hundred times 4665macro expansion will not have to be generated, used, and thrown away a
4666will execute considerably faster if compiled, and will also 4666hundred times.
4667garbage-collect less because the macro expansion will not have
4668to be generated, used, and thrown away a hundred times.
4669 4667
4670You can find out how a macro expands by using the 4668You can find out how a macro expands by using the
4671@code{cl-prettyexpand} function. 4669@code{cl-prettyexpand} function.