Now on revision 110662. ------------------------------------------------------------ revno: 110662 committer: Paul Eggert branch nick: trunk timestamp: Wed 2012-10-24 21:35:39 -0700 message: Don't assume process IDs fit in int. * emacs.c (shut_down_emacs) [!DOS_NT]: * sysdep.c (sys_suspend) [SIGTSTP && !MSDOS]: * term.c (dissociate_if_controlling_tty) [!DOS_NT]: Use pid_t, not int, to store process IDs, as 'int' is not wide enough on a few platforms (e.g., AIX and IRIX). diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-10-23 15:47:51 +0000 +++ src/ChangeLog 2012-10-25 04:35:39 +0000 @@ -1,3 +1,12 @@ +2012-10-25 Paul Eggert + + Don't assume process IDs fit in int. + * emacs.c (shut_down_emacs) [!DOS_NT]: + * sysdep.c (sys_suspend) [SIGTSTP && !MSDOS]: + * term.c (dissociate_if_controlling_tty) [!DOS_NT]: + Use pid_t, not int, to store process IDs, as 'int' + is not wide enough on a few platforms (e.g., AIX and IRIX). + 2012-10-23 Kenichi Handa The following change is to make face-font-rescale-alist work === modified file 'src/emacs.c' --- src/emacs.c 2012-10-08 22:14:39 +0000 +++ src/emacs.c 2012-10-25 04:35:39 +0000 @@ -1903,8 +1903,8 @@ /* If we are controlling the terminal, reset terminal modes. */ #ifndef DOS_NT { - int pgrp = EMACS_GETPGRP (0); - int tpgrp = tcgetpgrp (0); + pid_t pgrp = EMACS_GETPGRP (0); + pid_t tpgrp = tcgetpgrp (0); if ((tpgrp != -1) && tpgrp == pgrp) { reset_all_sys_modes (); === modified file 'src/sysdep.c' --- src/sysdep.c 2012-10-19 19:25:18 +0000 +++ src/sysdep.c 2012-10-25 04:35:39 +0000 @@ -452,7 +452,7 @@ #if defined (SIGTSTP) && !defined (MSDOS) { - int pgrp = EMACS_GETPGRP (0); + pid_t pgrp = EMACS_GETPGRP (0); EMACS_KILLPG (pgrp, SIGTSTP); } === modified file 'src/term.c' --- src/term.c 2012-10-19 19:25:18 +0000 +++ src/term.c 2012-10-25 04:35:39 +0000 @@ -2919,7 +2919,7 @@ dissociate_if_controlling_tty (int fd) { #ifndef DOS_NT - int pgid = tcgetpgrp (fd); /* If tcgetpgrp succeeds, fd is the ctty. */ + pid_t pgid = tcgetpgrp (fd); /* If tcgetpgrp succeeds, fd is the ctty. */ if (pgid != -1) { #if defined (USG5) ------------------------------------------------------------ revno: 110661 committer: Glenn Morris branch nick: trunk timestamp: Wed 2012-10-24 21:49:54 -0400 message: * doc/misc/cl.texi (Declarations): Fix typos. diff: === modified file 'doc/misc/ChangeLog' --- doc/misc/ChangeLog 2012-10-25 00:58:40 +0000 +++ doc/misc/ChangeLog 2012-10-25 01:49:54 +0000 @@ -12,6 +12,7 @@ (Dynamic Bindings): Update for changed progv behavior. (Loop Examples, Efficiency Concerns): Markup fixes. (Structures): Remove TeX margin change. + (Declarations): Fix typos. 2012-10-24 Glenn Morris === modified file 'doc/misc/cl.texi' --- doc/misc/cl.texi 2012-10-25 00:58:40 +0000 +++ doc/misc/cl.texi 2012-10-25 01:49:54 +0000 @@ -3088,12 +3088,11 @@ The default level for both qualities is 1. In this package, with the optimizing compiler, the -@c FIXME does not exist? -@code{speed} quality is tied to the @code{byte-compile-optimize} +@code{speed} quality is tied to the @code{byte-optimize} flag, which is set to @code{nil} for @code{(speed 0)} and to @code{t} for higher settings; and the @code{safety} quality is tied to the @code{byte-compile-delete-errors} flag, which is -set to @code{t} for @code{(safety 3)} and to @code{nil} for all +set to @code{nil} for @code{(safety 3)} and to @code{t} for all lower settings. (The latter flag controls whether the compiler is allowed to optimize out code whose only side-effect could be to signal an error, e.g., rewriting @code{(progn foo bar)} to ------------------------------------------------------------ revno: 110660 committer: Glenn Morris branch nick: trunk timestamp: Wed 2012-10-24 21:24:21 -0400 message: NEWS copyedits diff: === modified file 'etc/NEWS' --- etc/NEWS 2012-10-25 00:58:40 +0000 +++ etc/NEWS 2012-10-25 01:24:21 +0000 @@ -77,19 +77,10 @@ you want them. --- -** On Mac OS X, configure no longer automatically adds the Fink /sw -directories to the search path. You must add them yourself if you want them. - ---- ** The standalone scripts rcs-checkin and vcdiff have been removed (from the bin and libexec directories, respectively). The former is no longer relevant, the latter is replaced by lisp (in vc-sccs.el). ---- -** The native Windows user interface is available for Cygwin. Passing ---with-w32 will configure a Cygwin emacs to use the Windows user -interface instead of the default, X11. - * Startup Changes in Emacs 24.3 @@ -205,9 +196,7 @@ --- *** New input method `vietnamese-vni'. -** NextStep/OSX port changes. ---- -*** OSX 10.4 or newer is required to build Emacs. +** Nextstep (GNUstep / Mac OS X) port changes --- *** Fullscreen and frame parameter fullscreen is supported. --- @@ -926,20 +915,32 @@ * Changes in Emacs 24.3 on non-free operating systems -+++ -** On MS Windows, you can pass --without-libxml2 to configure.bat to omit -support for libxml2, even if its presence is detected. - -** When invoked with the -nw switch to run on the Windows text-mode terminal, -Emacs now supports mouse highlight, help-echo (in the echo area), and -`mouse-autoselect-window'. +--- +** Cygwin builds can use the native MS Windows user interface. +Pass --with-w32 to configure. The default remains the X11 interface. ** Two new functions are available in Cygwin builds: `cygwin-convert-path-from-windows' and `cygwin-convert-path-to-windows'. These functions allow Lisp code to access the Cygwin file-name mapping machinery to convert between Cygwin and Windows-native file names. +** When invoked with the -nw switch to run on the Windows text-mode terminal, +Emacs now supports mouse highlight, help-echo (in the echo area), and +`mouse-autoselect-window'. + ** On MS Windows Vista and later Emacs now supports symbolic links. + ++++ +** On MS Windows, you can pass --without-libxml2 to configure.bat to omit +support for libxml2, even if its presence is detected. + +--- +** On Mac OS X, the Nextstep port requires OS X 10.4 or later. + +--- +** On Mac OS X, configure no longer automatically adds the Fink /sw +directories to the search path. You must add them yourself if you want them. + * Changes in Emacs 24.2 ------------------------------------------------------------ revno: 110659 committer: Glenn Morris branch nick: trunk timestamp: Wed 2012-10-24 20:58:40 -0400 message: 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. diff: === modified file 'doc/misc/ChangeLog' --- doc/misc/ChangeLog 2012-10-24 21:53:47 +0000 +++ doc/misc/ChangeLog 2012-10-25 00:58:40 +0000 @@ -1,3 +1,18 @@ +2012-10-25 Glenn Morris + + * 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. + 2012-10-24 Glenn Morris * cl.texi (Overview, Multiple Values, Creating Symbols) === modified file 'doc/misc/cl.texi' --- doc/misc/cl.texi 2012-10-24 21:53:47 +0000 +++ doc/misc/cl.texi 2012-10-25 00:58:40 +0000 @@ -115,17 +115,16 @@ @end itemize -The package described here was originally written by Dave Gillespie, -@file{daveg@@synaptics.com}, as a total rewrite of an earlier -1986 @file{cl.el} package by Cesar Quiroz. Care has been taken -to ensure that each function is defined efficiently, concisely, and -with minimal impact on the rest of the Emacs environment. Stefan -Monnier added the file @file{cl-lib.el} and rationalized the namespace -for Emacs 24.3. +This package was originally written by Dave Gillespie, +@file{daveg@@synaptics.com}, as a total rewrite of an earlier 1986 +@file{cl.el} package by Cesar Quiroz. Care has been taken to ensure +that each function is defined efficiently, concisely, and with minimal +impact on the rest of the Emacs environment. Stefan Monnier added the +file @file{cl-lib.el} and rationalized the namespace for Emacs 24.3. @menu * Usage:: How to use the CL package. -* Organization:: The package's five component files. +* Organization:: The package's component files. * Naming Conventions:: Notes on CL function names. @end menu @@ -254,10 +253,6 @@ * Time of Evaluation:: The @code{cl-eval-when} construct. @end menu -@iftex -@secno=1 -@end iftex - @node Argument Lists @section Argument Lists @@ -566,16 +561,16 @@ Note that @code{(cl-eval-when (load eval) @dots{})} is equivalent to @code{(progn @dots{})} in all contexts. The compiler treats certain top-level forms, like @code{defmacro} (sort-of) and -@code{require}, as if they were wrapped in @code{(eval-when +@code{require}, as if they were wrapped in @code{(cl-eval-when (compile load eval) @dots{})}. @end defspec Emacs includes two special forms related to @code{cl-eval-when}. One of these, @code{eval-when-compile}, is not quite equivalent to -any @code{eval-when} construct and is described below. +any @code{cl-eval-when} construct and is described below. The other form, @code{(eval-and-compile @dots{})}, is exactly -equivalent to @samp{(eval-when (compile load eval) @dots{})} and +equivalent to @samp{(cl-eval-when (compile load eval) @dots{})} and so is not itself defined by this package. @defspec eval-when-compile forms... @@ -647,10 +642,6 @@ @node Type Predicates @section Type Predicates -@noindent -The @code{CL} package defines a version of the Common Lisp @code{typep} -predicate. - @defun cl-typep object type Check if @var{object} is of type @var{type}, where @var{type} is a (quoted) type name of the sort used by Common Lisp. For example, @@ -731,7 +722,7 @@ @defun cl-coerce object type This function attempts to convert @var{object} to the specified @var{type}. If @var{object} is already of that type as determined by -@code{typep}, it is simply returned. Otherwise, certain types of +@code{cl-typep}, it is simply returned. Otherwise, certain types of conversions will be made: If @var{type} is any sequence type (@code{string}, @code{list}, etc.) then @var{object} will be converted to that type if possible. If @var{type} is @@ -1103,7 +1094,8 @@ ``obvious'' expansion, @example -(setf (aref vec (cl-incf i)) (1+ (aref vec (cl-incf i)))) ; Wrong! +(setf (aref vec (cl-incf i)) + (1+ (aref vec (cl-incf i)))) ; wrong! @end example @noindent @@ -1128,6 +1120,7 @@ by @var{x} if specified. @end defspec +@c FIXME move to lispref, add generalized variables. @defspec pop place This macro removes and returns the first element of the list stored in @var{place}. It is analogous to @code{(prog1 (car @var{place}) @@ -1135,17 +1128,18 @@ to evaluate all subforms only once. @end defspec +@c FIXME move to lispref, add generalized variables. @defspec push x place This macro inserts @var{x} at the front of the list stored in @var{place}. It is analogous to @code{(setf @var{place} (cons @var{x} @var{place}))}, except for evaluation of the subforms. @end defspec -@defspec pushnew x place @t{&key :test :test-not :key} +@defspec cl-pushnew x place @t{&key :test :test-not :key} This macro inserts @var{x} at the front of the list stored in @var{place}, but only if @var{x} was not @code{eql} to any existing element of the list. The optional keyword arguments -are interpreted in the same way as for @code{adjoin}. +are interpreted in the same way as for @code{cl-adjoin}. @xref{Lists as Sets}. @end defspec @@ -1169,9 +1163,9 @@ evaluated only once each and in the apparent order. @end defspec -@defspec rotatef place@dots{} +@defspec cl-rotatef place@dots{} This macro rotates the @var{place}s left by one in circular fashion. -Thus, @code{(rotatef @var{a} @var{b} @var{c} @var{d})} is equivalent to +Thus, @code{(cl-rotatef @var{a} @var{b} @var{c} @var{d})} is equivalent to @example (psetf @var{a} @var{b} @@ -1181,8 +1175,8 @@ @end example @noindent -except for the evaluation of subforms. @code{rotatef} always -returns @code{nil}. Note that @code{(rotatef @var{a} @var{b})} +except for the evaluation of subforms. @code{cl-rotatef} always +returns @code{nil}. Note that @code{(cl-rotatef @var{a} @var{b})} conveniently exchanges @var{a} and @var{b}. @end defspec @@ -1241,40 +1235,40 @@ @code{makunbound} or @code{fmakunbound} on exit. @end defspec -@defspec letf* (bindings@dots{}) forms@dots{} +@defspec cl-letf* (bindings@dots{}) forms@dots{} This macro is to @code{letf} what @code{let*} is to @code{let}: It does the bindings in sequential rather than parallel order. @end defspec -@defspec callf @var{function} @var{place} @var{args}@dots{} +@defspec cl-callf @var{function} @var{place} @var{args}@dots{} This is the ``generic'' modify macro. It calls @var{function}, which should be an unquoted function name, macro name, or lambda. It passes @var{place} and @var{args} as arguments, and assigns the result back to @var{place}. For example, @code{(cl-incf @var{place} -@var{n})} is the same as @code{(callf + @var{place} @var{n})}. +@var{n})} is the same as @code{(cl-callf + @var{place} @var{n})}. Some more examples: @example -(callf abs my-number) -(callf concat (buffer-name) "<" (int-to-string n) ">") -(callf union happy-people (list joe bob) :test 'same-person) +(cl-callf abs my-number) +(cl-callf concat (buffer-name) "<" (number-to-string n) ">") +(cl-callf cl-union happy-people (list joe bob) :test 'same-person) @end example @xref{Customizing Setf}, for @code{define-modify-macro}, a way to create even more concise notations for modify macros. Note -again that @code{callf} is an extension to standard Common Lisp. +again that @code{cl-callf} is an extension to standard Common Lisp. @end defspec -@defspec callf2 @var{function} @var{arg1} @var{place} @var{args}@dots{} -This macro is like @code{callf}, except that @var{place} is +@defspec cl-callf2 @var{function} @var{arg1} @var{place} @var{args}@dots{} +This macro is like @code{cl-callf}, except that @var{place} is the @emph{second} argument of @var{function} rather than the first. For example, @code{(push @var{x} @var{place})} is -equivalent to @code{(callf2 cons @var{x} @var{place})}. +equivalent to @code{(cl-callf2 cons @var{x} @var{place})}. @end defspec -The @code{callf} and @code{callf2} macros serve as building -blocks for other macros like @code{cl-incf}, @code{pushnew}, and -@code{define-modify-macro}. The @code{letf} and @code{letf*} +The @code{cl-callf} and @code{cl-callf2} macros serve as building +blocks for other macros like @code{cl-incf}, @code{cl-pushnew}, and +@code{define-modify-macro}. The @code{letf} and @code{cl-letf*} macros are used in the processing of symbol macros; @pxref{Macro Bindings}. @@ -1488,10 +1482,6 @@ an error since the function @code{(setf @var{func})} might be defined later. -@iftex -@secno=4 -@end iftex - @node Variable Bindings @section Variable Bindings @@ -1524,7 +1514,7 @@ of symbols and values, respectively. The symbols are bound to the corresponding values for the duration of the body @var{form}s. If @var{values} is shorter than @var{symbols}, the last few symbols -are made unbound (as if by @code{makunbound}) inside the body. +are bound to @code{nil}. If @var{symbols} is shorter than @var{values}, the excess values are ignored. @end defspec @@ -1655,7 +1645,7 @@ cells of symbols rather than on the value cells. Each @var{binding} must be a list of the form @samp{(@var{name} @var{arglist} @var{forms}@dots{})}, which defines a function exactly as if -it were a @code{defun*} form. The function @var{name} is defined +it were a @code{cl-defun} form. The function @var{name} is defined accordingly for the duration of the body of the @code{flet}; then the old function definition, or lack thereof, is restored. @@ -1723,7 +1713,7 @@ @subsection Macro Bindings @noindent -These forms create local macros and ``symbol macros.'' +These forms create local macros and ``symbol macros''. @defspec cl-macrolet (bindings@dots{}) forms@dots{} This form is analogous to @code{flet}, but for macros instead of @@ -1759,7 +1749,7 @@ @code{(setf foo 4)}, which in turn expands to @code{(setf (car bar) 4)}. Likewise, a @code{let} or @code{let*} binding a symbol macro is -treated like a @code{letf} or @code{letf*}. This differs from true +treated like a @code{letf} or @code{cl-letf*}. This differs from true Common Lisp, where the rules of lexical scoping cause a @code{let} binding to shadow a @code{cl-symbol-macrolet} binding. In this package, only @code{lexical-let} and @code{lexical-let*} will shadow a symbol @@ -1773,8 +1763,9 @@ (cl-defmacro my-dolist ((x list) &rest body) (let ((var (gensym))) (list 'cl-loop 'for var 'on list 'do - (cl-list* 'cl-symbol-macrolet (list (list x (list 'car var))) - body)))) + (cl-list* 'cl-symbol-macrolet + (list (list x (list 'car var))) + body)))) (setq mylist '(1 2 3 4)) (my-dolist (x mylist) (cl-incf x)) @@ -1828,7 +1819,7 @@ where @var{keylist} is a list of key values. If there is exactly one value, and it is not a cons cell or the symbol @code{nil} or @code{t}, then it can be used by itself as a @var{keylist} without -being enclosed in a list. All key values in the @code{case} form +being enclosed in a list. All key values in the @code{cl-case} form must be distinct. The final clauses may use @code{t} in place of a @var{keylist} to indicate a default clause that should be taken if none of the other clauses match. (The symbol @code{otherwise} @@ -1999,7 +1990,7 @@ expression (as if by a @code{cl-psetq} form) and the next iteration begins. Once the @var{end-test} becomes true, the @var{result} forms are evaluated (with the @var{var}s still bound to their -values) to produce the result returned by @code{do}. +values) to produce the result returned by @code{cl-do}. The entire @code{cl-do} loop is enclosed in an implicit @code{nil} block, so that you can use @code{(cl-return)} to break out of the @@ -2007,7 +1998,7 @@ If there are no @var{result} forms, the loop returns @code{nil}. If a given @var{var} has no @var{step} form, it is bound to its -@var{init} value but not otherwise modified during the @code{do} +@var{init} value but not otherwise modified during the @code{cl-do} loop (unless the code explicitly modifies it); this case is just a shorthand for putting a @code{(let ((@var{var} @var{init})) @dots{})} around the loop. If @var{init} is also omitted it defaults to @@ -2099,7 +2090,7 @@ obscure, like Common Lisp's @code{do} loop. To remedy this, recent versions of Common Lisp have added a new -construct called the ``Loop Facility'' or ``@code{loop} macro,'' +construct called the ``Loop Facility'' or ``@code{loop} macro'', with an easy-to-use but very powerful and expressive syntax. @menu @@ -2161,7 +2152,7 @@ @code{collect}, an end-test clause like @code{always}, or an explicit @code{return} clause to jump out of the implicit block. (Because the loop body is enclosed in an implicit block, you can -also use regular Lisp @code{return} or @code{return-from} to +also use regular Lisp @code{cl-return} or @code{cl-return-from} to break out of the loop.) @end defspec @@ -2185,7 +2176,7 @@ @noindent This loop iterates over all Emacs buffers, using the list -returned by @code{buffer-list}. For each buffer @code{buf}, +returned by @code{buffer-list}. For each buffer @var{buf}, it calls @code{buffer-file-name} and collects the results into a list, which is then returned from the @code{cl-loop} construct. The result is a list of the file names of all the buffers in @@ -2818,6 +2809,7 @@ the loop would never get to ``loop'' more than once. The clause @samp{return @var{form}} is equivalent to +@c FIXME cl-do, cl-return? @samp{do (return @var{form})} (or @code{return-from} if the loop was named). The @code{return} clause is implemented a bit more efficiently, though. @@ -3061,7 +3053,8 @@ @example (cl-declaim (inline foo bar)) -(cl-eval-when (compile load eval) (cl-proclaim '(inline foo bar))) +(cl-eval-when (compile load eval) + (cl-proclaim '(inline foo bar))) (defsubst foo (...) ...) ; instead of defun @end example @@ -3091,7 +3084,7 @@ @code{(speed 3)} or @code{(safety 2)}. Common Lisp defines several optimization ``qualities''; this package ignores all but @code{speed} and @code{safety}. The value of a quality should be an integer from -0 to 3, with 0 meaning ``unimportant'' and 3 meaning ``very important.'' +0 to 3, with 0 meaning ``unimportant'' and 3 meaning ``very important''. The default level for both qualities is 1. In this package, with the optimizing compiler, the @@ -3125,7 +3118,7 @@ This declaration controls what sorts of warnings are generated by the byte compiler. Again, only the optimizing compiler generates warnings. The word @code{warn} is followed by any -number of ``warning qualities,'' similar in form to optimization +number of ``warning qualities'', similar in form to optimization qualities. The currently supported warning types are @code{redefine}, @code{callargs}, @code{unresolved}, and @code{free-vars}; in the current system, a value of 0 will @@ -3227,10 +3220,6 @@ out the property and value cells. @end defspec -@iftex -@secno=2 -@end iftex - @node Creating Symbols @section Creating Symbols @@ -3289,10 +3278,6 @@ * Implementation Parameters:: @code{cl-most-positive-float}. @end menu -@iftex -@secno=1 -@end iftex - @node Predicates on Numbers @section Predicates on Numbers @@ -3326,10 +3311,6 @@ to @code{floatp}. On other systems, this always returns @code{nil}. @end defun -@iftex -@secno=3 -@end iftex - @node Numerical Functions @section Numerical Functions @@ -3412,10 +3393,6 @@ of @code{cl-truncate}. @end defun -@iftex -@secno=8 -@end iftex - @node Random Numbers @section Random Numbers @@ -3433,7 +3410,7 @@ which holds the state of the random number generator. The function modifies this state object as a side effect. If @var{state} is omitted, it defaults to the variable -@code{*random-state*}, which contains a pre-initialized +@code{cl--random-state}, which contains a pre-initialized @code{random-state} object. @end defun @@ -3683,7 +3660,7 @@ @var{result-type} rather than a list. @var{result-type} must be one of the following symbols: @code{vector}, @code{string}, @code{list} (in which case the effect is the same as for -@code{mapcar*}), or @code{nil} (in which case the results are +@code{cl-mapcar}), or @code{nil} (in which case the results are thrown away and @code{cl-map} returns @code{nil}). @end defun @@ -3914,9 +3891,10 @@ @findex cl-substitute-if-not @findex cl-nsubstitute-if @findex cl-nsubstitute-if-not -The @code{cl-substitute-if}, @code{cl-substitute-if-not}, @code{cl-nsubstitute-if}, -and @code{cl-nsubstitute-if-not} functions are defined similarly. For -these, a @var{predicate} is given in place of the @var{old} argument. +The functions @code{cl-substitute-if}, @code{cl-substitute-if-not}, +@code{cl-nsubstitute-if}, and @code{cl-nsubstitute-if-not} are defined +similarly. For these, a @var{predicate} is given in place of the +@var{old} argument. @node Searching Sequences @section Searching Sequences @@ -4145,10 +4123,6 @@ applied to the elements of both trees. @xref{Sequences}. @end defun -@iftex -@secno=3 -@end iftex - @node Substitution of Expressions @section Substitution of Expressions @@ -4384,7 +4358,7 @@ which takes keyword arguments @code{:name}, @code{:age}, and @code{:sex} to specify the initial values of these slots in the new object. (Omitting any of these arguments leaves the corresponding -slot ``undefined,'' according to the Common Lisp standard; in Emacs +slot ``undefined'', according to the Common Lisp standard; in Emacs Lisp, such uninitialized slots are filled with @code{nil}.) Given a @code{person}, @code{(copy-person @var{p})} makes a new @@ -4465,10 +4439,6 @@ The following structure options are recognized. @table @code -@iftex -@itemmax=0 in -@advance@leftskip-.5@tableindent -@end iftex @item :conc-name The argument is a symbol whose print name is used as the prefix for the names of slot accessor functions. The default is the name of @@ -4508,7 +4478,8 @@ (cl-defstruct (person (:constructor nil) ; no default constructor - (:constructor new-person (name sex &optional (age 0))) + (:constructor new-person + (name sex &optional (age 0))) (:constructor new-hound (&key (name "Rover") (dog-years 0) &aux (age (* 7 dog-years)) @@ -4519,7 +4490,7 @@ The first constructor here takes its arguments positionally rather than by keyword. (In official Common Lisp terminology, constructors that work By Order of Arguments instead of by keyword are called -``BOA constructors.'' No, I'm not making this up.) For example, +``BOA constructors''. No, I'm not making this up.) For example, @code{(new-person "Jane" 'female)} generates a person whose slots are @code{"Jane"}, 0, and @code{female}, respectively. @@ -4545,7 +4516,7 @@ In true Common Lisp, @code{typep} is always able to recognize a structure object even if @code{:predicate} was used. In this -package, @code{typep} simply looks for a function called +package, @code{cl-typep} simply looks for a function called @code{@var{typename}-p}, so it will work for structure types only if they used the default predicate name. @@ -4778,7 +4749,7 @@ a nicely formatted copy of it in the current buffer (which must be in Lisp mode so that indentation works properly). It also expands all Lisp macros which appear in the form. The easiest way to use -this function is to go to the @code{*scratch*} buffer and type, say, +this function is to go to the @file{*scratch*} buffer and type, say, @example (cl-prettyexpand '(loop for x below 10 collect x)) @@ -4998,8 +4969,8 @@ is called. (This package avoids such problems in its own mapping functions -by using names like @code{cl-x} instead of @code{x} internally; -as long as you don't use the @code{cl-} prefix for your own +by using names like @code{cl--x} instead of @code{x} internally; +as long as you don't use this prefix for your own variables no collision can occur.) @xref{Lexical Bindings}, for a description of the @code{lexical-let} @@ -5044,7 +5015,7 @@ programs which refer to a symbol by the full name sometimes and the short name other times will not port cleanly to Emacs. -Emacs Lisp does have a concept of ``obarrays,'' which are +Emacs Lisp does have a concept of ``obarrays'', which are package-like collections of symbols, but this feature is not strong enough to be used as a true package mechanism. @@ -5064,10 +5035,10 @@ conversion, and even loops and conditionals. While it would have been possible to implement most of Common -Lisp @code{format} in this package (under the name @code{format*}, +Lisp @code{format} in this package (under the name @code{cl-format}, of course), it was not deemed worthwhile. It would have required a huge amount of code to implement even a decent subset of -@code{format*}, yet the functionality it would provide over +@code{cl-format}, yet the functionality it would provide over Emacs Lisp's @code{format} would rarely be useful. @item === modified file 'etc/NEWS' --- etc/NEWS 2012-10-24 14:38:49 +0000 +++ etc/NEWS 2012-10-25 00:58:40 +0000 @@ -332,6 +332,7 @@ to the `lexical-let' machinery used previously) to capture definitions in closures, so such closures will only work if `lexical-binding' is in use. ++++ *** `progv' was rewritten to use the `let' machinery. A side effect is that vars without corresponding value are bound to nil rather than making them unbound. === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-10-24 19:40:23 +0000 +++ lisp/ChangeLog 2012-10-25 00:58:40 +0000 @@ -1,3 +1,7 @@ +2012-10-25 Glenn Morris + + * emacs-lisp/cl-macs.el (cl-progv): Doc fix. + 2012-10-24 Stefan Monnier * minibuffer.el (minibuffer-force-complete): Use one more marker === modified file 'lisp/emacs-lisp/cl-macs.el' --- lisp/emacs-lisp/cl-macs.el 2012-10-11 20:36:23 +0000 +++ lisp/emacs-lisp/cl-macs.el 2012-10-25 00:58:40 +0000 @@ -1603,7 +1603,7 @@ "Bind SYMBOLS to VALUES dynamically in BODY. The forms SYMBOLS and VALUES are evaluated, and must evaluate to lists. Each symbol in the first list is bound to the corresponding value in the -second list (or made unbound if VALUES is shorter than SYMBOLS); then the +second list (or to nil if VALUES is shorter than SYMBOLS); then the BODY forms are executed and their result is returned. This is much like a `let' form, except that the list of symbols can be computed at run-time." (declare (indent 2) (debug (form form body))) ------------------------------------------------------------ revno: 110658 committer: Glenn Morris branch nick: trunk timestamp: Wed 2012-10-24 17:53:47 -0400 message: Remove some old information from cl.texi that is no longer relevant * doc/misc/cl.texi (Overview, Multiple Values, Creating Symbols) (Numerical Functions): Say less/nothing about the original cl.el. (Old CL Compatibility): Remove. (Assertions): Remove ignore-errors (standard Elisp for some time). diff: === modified file 'doc/misc/ChangeLog' --- doc/misc/ChangeLog 2012-10-24 07:41:11 +0000 +++ doc/misc/ChangeLog 2012-10-24 21:53:47 +0000 @@ -1,5 +1,10 @@ 2012-10-24 Glenn Morris + * cl.texi (Overview, Multiple Values, Creating Symbols) + (Numerical Functions): Say less/nothing about the original cl.el. + (Old CL Compatibility): Remove. + (Assertions): Remove ignore-errors (standard Elisp for some time). + * cl.texi (Basic Setf, Macros, Declarations, Symbols, Numbers) (Sequences, Lists, Structures, Assertions, Efficiency Concerns) (Efficiency Concerns, Efficiency Concerns) === modified file 'doc/misc/cl.texi' --- doc/misc/cl.texi 2012-10-24 07:41:11 +0000 +++ doc/misc/cl.texi 2012-10-24 21:53:47 +0000 @@ -65,11 +65,10 @@ * Sequences:: Mapping, functions, searching, sorting. * Lists:: @code{cl-caddr}, @code{cl-sublis}, @code{cl-member}, @code{cl-assoc}, etc. * Structures:: @code{cl-defstruct}. -* Assertions:: @code{cl-check-type}, @code{cl-assert}, @code{ignore-errors}. +* Assertions:: @code{cl-check-type}, @code{cl-assert}. * Efficiency Concerns:: Hints and techniques. * Common Lisp Compatibility:: All known differences with Steele. -* Old CL Compatibility:: All known differences with old cl.el. * Porting Common Lisp:: Hints for porting Common Lisp code. * GNU Free Documentation License:: The license for this documentation. @@ -118,13 +117,11 @@ The package described here was originally written by Dave Gillespie, @file{daveg@@synaptics.com}, as a total rewrite of an earlier -1986 @file{cl.el} package by Cesar Quiroz. Most features of the -Quiroz package were retained; any incompatibilities are -noted in the descriptions below. Care has been taken in this -version to ensure that each function is defined efficiently, -concisely, and with minimal impact on the rest of the Emacs -environment. Stefan Monnier added the file @file{cl-lib.el} and -rationalized the namespace for Emacs 24.3. +1986 @file{cl.el} package by Cesar Quiroz. Care has been taken +to ensure that each function is defined efficiently, concisely, and +with minimal impact on the rest of the Emacs environment. Stefan +Monnier added the file @file{cl-lib.el} and rationalized the namespace +for Emacs 24.3. @menu * Usage:: How to use the CL package. @@ -198,12 +195,9 @@ @code{cl-lib} rather than @code{cl}. @xref{Naming Conventions}. There is one more file, @file{cl-compat.el}, which defines some -routines from the older CL package that are not otherwise -present in the new package. This includes internal routines -like @code{setelt} and @code{zip-lists}, deprecated features -like @code{defkeyword}, and an emulation of the old-style -multiple-values feature. This file is obsolete and should not be used -in new code. @xref{Old CL Compatibility}. +routines from the older Quiroz CL package that are not otherwise +present in the new package. This file is obsolete and should not be +used in new code. @node Naming Conventions @section Naming Conventions @@ -2875,13 +2869,6 @@ in @code{cl-multiple-value-bind}. @end defspec -The older Quiroz package attempted a more faithful (but still -imperfect) emulation of Common Lisp multiple values. The old -method ``usually'' simulated true multiple values quite well, -but under certain circumstances would leave spurious return -values in memory where a later, unrelated @code{cl-multiple-value-bind} -form would see them. - Since a perfect emulation is not feasible in Emacs Lisp, this package opts to keep it as simple and predictable as possible. @@ -3282,12 +3269,11 @@ again until a new symbol is generated. @end defun -The Quiroz @file{cl.el} package also defined a @code{defkeyword} -form for creating self-quoting keyword symbols. This package -automatically creates all keywords that are called for by -@code{&key} argument specifiers, and discourages the use of -keywords as data unrelated to keyword arguments, so the -@code{defkeyword} form has been discontinued. +This package automatically creates all keywords that are called for by +@code{&key} argument specifiers, and discourages the use of keywords +as data unrelated to keyword arguments, so the related function +@code{defkeyword} (to create self-quoting keyword symbols) is not +provided. @node Numbers @chapter Numbers @@ -3426,13 +3412,6 @@ of @code{cl-truncate}. @end defun -@c FIXME this stuff is probably no longer of interest to anyone. -These definitions are compatible with those in the Quiroz -@file{cl.el} package, except that -@c this package appends @samp{*} to certain function names to avoid -@c conflicts with existing Emacs functions, and that -the mechanism for returning multiple values is different. - @iftex @secno=8 @end iftex @@ -4752,18 +4731,6 @@ user to modify @var{place}. @end defspec -The following error-related macro is also defined: - -@c FIXME standard for some time. -@defspec ignore-errors forms@dots{} -This executes @var{forms} exactly like a @code{progn}, except that -errors are ignored during the @var{forms}. More precisely, if -an error is signaled then @code{ignore-errors} immediately -aborts execution of the @var{forms} and returns @code{nil}. -If the @var{forms} complete successfully, @code{ignore-errors} -returns the result of the last @var{form}. -@end defspec - @node Efficiency Concerns @appendix Efficiency Concerns @@ -4971,110 +4938,6 @@ The second argument of @code{cl-check-type} is treated differently. -@c FIXME Time to remove this? -@node Old CL Compatibility -@appendix Old CL Compatibility - -@noindent -Following is a list of all known incompatibilities between this package -and the older Quiroz @file{cl.el} package. - -This package's emulation of multiple return values in functions is -incompatible with that of the older package. That package attempted -to come as close as possible to true Common Lisp multiple return -values; unfortunately, it could not be 100% reliable and so was prone -to occasional surprises if used freely. This package uses a simpler -method, namely replacing multiple values with lists of values, which -is more predictable though more noticeably different from Common Lisp. - -The @code{defkeyword} form and @code{keywordp} function are not -implemented in this package. - -@ignore -The @code{member}, @code{floor}, @code{ceiling}, @code{truncate}, -@code{round}, @code{mod}, and @code{rem} functions are suffixed -by @samp{*} in this package to avoid collision with existing -functions in Emacs. The older package simply -redefined these functions, overwriting the built-in meanings and -causing serious portability problems. (Some more -recent versions of the Quiroz package changed the names to -@code{cl-member}, etc.; this package defines the latter names as -aliases for @code{member*}, etc.) -@end ignore - -Certain functions in the old package which were buggy or inconsistent -with the Common Lisp standard are incompatible with the conforming -versions in this package. For example, @code{eql} and @code{member} -were synonyms for @code{eq} and @code{memq} in that package, @code{setf} -failed to preserve correct order of evaluation of its arguments, etc. - -Finally, unlike the older package, this package is careful to -prefix all of its internal names with @code{cl--}. Except for a -few functions which are explicitly defined as additional features -(such as @code{cl-floatp-safe} and @code{letf}), this package does not -export any non-@samp{cl-} symbols which are not also part of Common -Lisp. - -@ifinfo -@example - -@end example -@end ifinfo -@appendixsec The @code{cl-compat} package - -@noindent -The @code{CL} package includes emulations of some features of the -old @file{cl.el}, in the form of a compatibility package -@code{cl-compat}. This file is obsolete and may be removed in future, -so it should not be used in new code. - -The old package defined a number of internal routines without -@code{cl-} prefixes or other annotations. Call to these routines -may have crept into existing Lisp code. @code{cl-compat} -provides emulations of the following internal routines: -@code{pair-with-newsyms}, @code{zip-lists}, @code{unzip-lists}, -@code{reassemble-arglists}, @code{duplicate-symbols-p}, -@code{safe-idiv}. - -Some @code{setf} forms translated into calls to internal -functions that user code might call directly. The functions -@code{setnth}, @code{setnthcdr}, and @code{setelt} fall in -this category; they are defined by @code{cl-compat}, but the -best fix is to change to use @code{setf} properly. - -The @code{cl-compat} file defines the keyword functions -@code{keywordp}, @code{keyword-of}, and @code{defkeyword}, -which are not defined by the new @code{CL} package because the -use of keywords as data is discouraged. - -The @code{build-klist} mechanism for parsing keyword arguments -is emulated by @code{cl-compat}; the @code{with-keyword-args} -macro is not, however, and in any case it's best to change to -use the more natural keyword argument processing offered by -@code{defun*}. - -Multiple return values are treated differently by the two -Common Lisp packages. The old package's method was more -compatible with true Common Lisp, though it used heuristics -that caused it to report spurious multiple return values in -certain cases. The @code{cl-compat} package defines a set -of multiple-value macros that are compatible with the old -CL package; again, they are heuristic in nature, but they -are guaranteed to work in any case where the old package's -macros worked. To avoid name collision with the ``official'' -multiple-value facilities, the ones in @code{cl-compat} have -capitalized names: @code{Values}, @code{Values-list}, -@code{Multiple-value-bind}, etc. - -The functions @code{cl-floor}, @code{cl-ceiling}, @code{cl-truncate}, -and @code{cl-round} are defined by @code{cl-compat} to use the -old-style multiple-value mechanism, just as they did in the old -package. The newer @code{floor*} and friends return their two -results in a list rather than as multiple values. Note that -older versions of the old package used the unadorned names -@code{floor}, @code{ceiling}, etc.; @code{cl-compat} cannot use -these names because they conflict with Emacs built-ins. - @node Porting Common Lisp @appendix Porting Common Lisp ------------------------------------------------------------ revno: 110657 fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12619 committer: Stefan Monnier branch nick: trunk timestamp: Wed 2012-10-24 15:40:23 -0400 message: * lisp/minibuffer.el (minibuffer-force-complete): Use one more marker for the temporary-overlay-map command. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-10-24 18:26:22 +0000 +++ lisp/ChangeLog 2012-10-24 19:40:23 +0000 @@ -1,3 +1,8 @@ +2012-10-24 Stefan Monnier + + * minibuffer.el (minibuffer-force-complete): Use one more marker + for the temporary-overlay-map command (bug#12619). + 2012-10-24 Chong Yidong * time.el (display-time-world-mode): Derive from special-mode. === modified file 'lisp/minibuffer.el' --- lisp/minibuffer.el 2012-10-24 03:22:21 +0000 +++ lisp/minibuffer.el 2012-10-24 19:40:23 +0000 @@ -1114,7 +1114,7 @@ ;; FIXME: Need to deal with the extra-size issue here as well. ;; FIXME: ~/src/emacs/t/lisp/minibuffer.el completes to ;; ~/src/emacs/trunk/ and throws away lisp/minibuffer.el. - (let* ((start (field-beginning)) + (let* ((start (copy-marker (field-beginning))) (end (field-end)) ;; (md (completion--field-metadata start)) (all (completion-all-sorted-completions)) ------------------------------------------------------------ revno: 110656 committer: Chong Yidong branch nick: trunk timestamp: Thu 2012-10-25 02:26:22 +0800 message: * time.el (display-time-world-display): Wrap delete-char inside inhibit-read-only. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-10-24 14:50:30 +0000 +++ lisp/ChangeLog 2012-10-24 18:26:22 +0000 @@ -3,6 +3,8 @@ * time.el (display-time-world-mode): Derive from special-mode. (display-time-world): Use display-buffer (Bug#12708). (display-time-world-mode-map): Variable deleted. + (display-time-world-display): Wrap the final delete-char inside + inhibit-read-only. 2012-10-24 Chong Yidong === modified file 'lisp/time.el' --- lisp/time.el 2012-10-24 14:50:30 +0000 +++ lisp/time.el 2012-10-24 18:26:22 +0000 @@ -543,8 +543,8 @@ (setenv "TZ" old-tz)) (setq fmt (concat "%-" (int-to-string max-width) "s %s\n")) (dolist (timedata (nreverse result)) - (insert (format fmt (car timedata) (cdr timedata))))) - (delete-char -1)) + (insert (format fmt (car timedata) (cdr timedata)))) + (delete-char -1))) ;;;###autoload (defun display-time-world () ------------------------------------------------------------ revno: 110655 committer: Chong Yidong branch nick: trunk timestamp: Thu 2012-10-25 02:16:41 +0800 message: Revert last change to org-lparse.el diff: === modified file 'lisp/org/ChangeLog' --- lisp/org/ChangeLog 2012-10-24 15:04:12 +0000 +++ lisp/org/ChangeLog 2012-10-24 18:16:41 +0000 @@ -1,8 +1,3 @@ -2012-10-24 Jambunathan K - - * org-lparse.el: Move some hooks from org-lparse to org-do-lparse - (Bug#12718). - 2012-09-30 Abdó Roig-Maranges * org-html.el (org-export-html-preprocess) === modified file 'lisp/org/org-lparse.el' --- lisp/org/org-lparse.el 2012-10-24 15:04:12 +0000 +++ lisp/org/org-lparse.el 2012-10-24 18:16:41 +0000 @@ -435,6 +435,10 @@ (let* ((org-lparse-backend (intern native-backend)) (org-lparse-other-backend (and target-backend (intern target-backend)))) + (add-hook 'org-export-preprocess-hook + 'org-lparse-strip-experimental-blocks-maybe) + (add-hook 'org-export-preprocess-after-blockquote-hook + 'org-lparse-preprocess-after-blockquote) (unless (org-lparse-backend-is-native-p native-backend) (error "Don't know how to export natively to backend %s" native-backend)) @@ -442,7 +446,12 @@ (org-lparse-reachable-p native-backend target-backend)) (error "Don't know how to export to backend %s %s" target-backend (format "via %s" native-backend))) - (org-do-lparse arg hidden ext-plist to-buffer body-only pub-dir))) + (run-hooks 'org-export-first-hook) + (org-do-lparse arg hidden ext-plist to-buffer body-only pub-dir) + (remove-hook 'org-export-preprocess-hook + 'org-lparse-strip-experimental-blocks-maybe) + (remove-hook 'org-export-preprocess-after-blockquote-hook + 'org-lparse-preprocess-after-blockquote))) (defcustom org-lparse-use-flashy-warning nil "Control flashing of messages logged with `org-lparse-warn'. @@ -585,16 +594,6 @@ (setq-default org-deadline-line-regexp org-deadline-line-regexp) (setq-default org-done-keywords org-done-keywords) (setq-default org-maybe-keyword-time-regexp org-maybe-keyword-time-regexp) - - ;; Run first hook. - (run-hooks 'org-export-first-hook) - - ;; Add pre-process hooks. - (add-hook 'org-export-preprocess-hook - 'org-lparse-strip-experimental-blocks-maybe) - (add-hook 'org-export-preprocess-after-blockquote-hook - 'org-lparse-preprocess-after-blockquote) - (let* (hfy-user-sheet-assoc ; let `htmlfontify' know that ; we are interested in ; collecting styles @@ -786,11 +785,6 @@ org-lparse-toc href ) - ;; Remove pre-process hooks. - (remove-hook 'org-export-preprocess-hook - 'org-lparse-strip-experimental-blocks-maybe) - (remove-hook 'org-export-preprocess-after-blockquote-hook - 'org-lparse-preprocess-after-blockquote) (let ((inhibit-read-only t)) (org-unmodified ------------------------------------------------------------ revno: 110654 committer: Glenn Morris branch nick: trunk timestamp: Wed 2012-10-24 13:25:24 -0400 message: * Makefile.in (install-etc): Don't apply program transform to file suffixes. diff: === modified file 'ChangeLog' --- ChangeLog 2012-10-24 16:41:59 +0000 +++ ChangeLog 2012-10-24 17:25:24 +0000 @@ -1,6 +1,7 @@ 2012-10-24 Glenn Morris - * Makefile.in (install-man): Don't apply transform to suffix. + * Makefile.in (install-etc, install-man): + Don't apply program transform to standard file suffixes. 2012-10-23 Paul Eggert === modified file 'Makefile.in' --- Makefile.in 2012-10-24 16:41:59 +0000 +++ Makefile.in 2012-10-24 17:25:24 +0000 @@ -647,7 +647,8 @@ ( cd $${thisdir}; ${MKDIR_P} $(DESTDIR)${icondir}/$${dir} ) ; \ for icon in $${dir}/emacs[.-]*; do \ [ -r $${icon} ] || continue ; \ - dest=`echo "$${icon}" | sed -e 's|.*/||' -e '$(TRANSFORM)'` ; \ + ext=`echo "$${icon}" | sed -e 's|.*\.||'`; \ + dest=`echo "$${icon}" | sed -e 's|.*/||' -e "s|\.$${ext}$$||" -e '$(TRANSFORM)'`.$${ext} ; \ ( cd $${thisdir}; \ ${INSTALL_DATA} ${iconsrcdir}/$${icon} $(DESTDIR)${icondir}/$${dir}/$${dest} ) \ || exit 1; \ ------------------------------------------------------------ revno: 110653 committer: Glenn Morris branch nick: trunk timestamp: Wed 2012-10-24 09:41:59 -0700 message: * Makefile.in (install-man): Don't apply transform to suffix. diff: === modified file 'ChangeLog' --- ChangeLog 2012-10-23 19:39:36 +0000 +++ ChangeLog 2012-10-24 16:41:59 +0000 @@ -1,3 +1,7 @@ +2012-10-24 Glenn Morris + + * Makefile.in (install-man): Don't apply transform to suffix. + 2012-10-23 Paul Eggert * configure.ac (_FORTIFY_SOURCE): Do not multiply define (Bug#12714). === modified file 'Makefile.in' --- Makefile.in 2012-10-23 17:33:22 +0000 +++ Makefile.in 2012-10-24 16:41:59 +0000 @@ -622,7 +622,7 @@ thisdir=`/bin/pwd`; \ cd ${mansrcdir}; \ for page in *.1; do \ - dest=`echo "$${page}" | sed '$(TRANSFORM)'`; \ + dest=`echo "$${page}" | sed -e 's/\.1$$//' -e '$(TRANSFORM)'`.1; \ (cd $${thisdir}; \ ${INSTALL_DATA} ${mansrcdir}/$${page} $(DESTDIR)${man1dir}/$${dest}); \ ( [ -n "${GZIP_INFO}" ] && [ -n "${GZIP_PROG}" ] ) || continue ; \ ------------------------------------------------------------ revno: 110652 fixes bug: http://debbugs.gnu.org/12718 author: Jambunathan K committer: Chong Yidong branch nick: trunk timestamp: Wed 2012-10-24 23:04:12 +0800 message: Fix error in previous merge from Org. * lisp/org/org-lparse.el: Move some hooks from org-lparse to org-do-lparse. diff: === modified file 'lisp/org/ChangeLog' --- lisp/org/ChangeLog 2012-10-05 05:57:24 +0000 +++ lisp/org/ChangeLog 2012-10-24 15:04:12 +0000 @@ -1,3 +1,8 @@ +2012-10-24 Jambunathan K + + * org-lparse.el: Move some hooks from org-lparse to org-do-lparse + (Bug#12718). + 2012-09-30 Abdó Roig-Maranges * org-html.el (org-export-html-preprocess) === modified file 'lisp/org/org-lparse.el' --- lisp/org/org-lparse.el 2012-09-30 15:14:59 +0000 +++ lisp/org/org-lparse.el 2012-10-24 15:04:12 +0000 @@ -435,10 +435,6 @@ (let* ((org-lparse-backend (intern native-backend)) (org-lparse-other-backend (and target-backend (intern target-backend)))) - (add-hook 'org-export-preprocess-hook - 'org-lparse-strip-experimental-blocks-maybe) - (add-hook 'org-export-preprocess-after-blockquote-hook - 'org-lparse-preprocess-after-blockquote) (unless (org-lparse-backend-is-native-p native-backend) (error "Don't know how to export natively to backend %s" native-backend)) @@ -446,12 +442,7 @@ (org-lparse-reachable-p native-backend target-backend)) (error "Don't know how to export to backend %s %s" target-backend (format "via %s" native-backend))) - (run-hooks 'org-export-first-hook) - (org-do-lparse arg hidden ext-plist to-buffer body-only pub-dir) - (remove-hook 'org-export-preprocess-hook - 'org-lparse-strip-experimental-blocks-maybe) - (remove-hook 'org-export-preprocess-after-blockquote-hook - 'org-lparse-preprocess-after-blockquote))) + (org-do-lparse arg hidden ext-plist to-buffer body-only pub-dir))) (defcustom org-lparse-use-flashy-warning nil "Control flashing of messages logged with `org-lparse-warn'. @@ -594,6 +585,16 @@ (setq-default org-deadline-line-regexp org-deadline-line-regexp) (setq-default org-done-keywords org-done-keywords) (setq-default org-maybe-keyword-time-regexp org-maybe-keyword-time-regexp) + + ;; Run first hook. + (run-hooks 'org-export-first-hook) + + ;; Add pre-process hooks. + (add-hook 'org-export-preprocess-hook + 'org-lparse-strip-experimental-blocks-maybe) + (add-hook 'org-export-preprocess-after-blockquote-hook + 'org-lparse-preprocess-after-blockquote) + (let* (hfy-user-sheet-assoc ; let `htmlfontify' know that ; we are interested in ; collecting styles @@ -785,6 +786,11 @@ org-lparse-toc href ) + ;; Remove pre-process hooks. + (remove-hook 'org-export-preprocess-hook + 'org-lparse-strip-experimental-blocks-maybe) + (remove-hook 'org-export-preprocess-after-blockquote-hook + 'org-lparse-preprocess-after-blockquote) (let ((inhibit-read-only t)) (org-unmodified ------------------------------------------------------------ revno: 110651 fixes bug: http://debbugs.gnu.org/12708 committer: Chong Yidong branch nick: trunk timestamp: Wed 2012-10-24 22:50:30 +0800 message: * time.el (display-time-world-mode): Derive from special-mode. (display-time-world): Use display-buffer. (display-time-world-mode-map): Variable deleted. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-10-24 14:38:49 +0000 +++ lisp/ChangeLog 2012-10-24 14:50:30 +0000 @@ -1,5 +1,11 @@ 2012-10-24 Chong Yidong + * time.el (display-time-world-mode): Derive from special-mode. + (display-time-world): Use display-buffer (Bug#12708). + (display-time-world-mode-map): Variable deleted. + +2012-10-24 Chong Yidong + * dired.el (dired-mark, dired-unmark, dired-flag-file-deletion): Doc fix. === modified file 'lisp/time.el' --- lisp/time.el 2012-10-01 02:07:14 +0000 +++ lisp/time.el 2012-10-24 14:50:30 +0000 @@ -206,12 +206,6 @@ :type 'integer :version "23.1") -(defvar display-time-world-mode-map - (let ((map (make-sparse-keymap))) - (define-key map "q" 'kill-this-buffer) - map) - "Keymap of Display Time World mode.") - ;;;###autoload (defun display-time () "Enable display of time, load level, and mail flag in mode lines. @@ -523,7 +517,7 @@ 'display-time-event-handler))) -(define-derived-mode display-time-world-mode nil "World clock" +(define-derived-mode display-time-world-mode special-mode "World clock" "Major mode for buffer that displays times in various time zones. See `display-time-world'." (setq show-trailing-whitespace nil)) @@ -562,10 +556,9 @@ (not (get-buffer display-time-world-buffer-name))) (run-at-time t display-time-world-timer-second 'display-time-world-timer)) (with-current-buffer (get-buffer-create display-time-world-buffer-name) - (display-time-world-display display-time-world-list)) - (pop-to-buffer display-time-world-buffer-name) - (fit-window-to-buffer) - (display-time-world-mode)) + (display-time-world-display display-time-world-list) + (display-buffer display-time-world-buffer-name) + (display-time-world-mode))) (defun display-time-world-timer () (if (get-buffer display-time-world-buffer-name) ------------------------------------------------------------ revno: 110650 committer: Chong Yidong branch nick: trunk timestamp: Wed 2012-10-24 22:38:49 +0800 message: Document some Emacs 24.3 changes. * doc/emacs/dired.texi (Dired Deletion, Marks vs Flags): Document Emacs 24.3 changes to the mark and unmark commands. (Comparison in Dired): Document chages to dired-diff. Remove M-=, which is no longer bound to dired-backup-diff. * doc/emacs/mule.texi (Text Coding): set-buffer-file-coding-system can now be invoked from the mode line. * lisp/dired.el (dired-mark, dired-unmark, dired-flag-file-deletion): Doc fix. diff: === modified file 'doc/emacs/ChangeLog' --- doc/emacs/ChangeLog 2012-10-23 21:26:00 +0000 +++ doc/emacs/ChangeLog 2012-10-24 14:38:49 +0000 @@ -1,3 +1,13 @@ +2012-10-24 Chong Yidong + + * mule.texi (Text Coding): set-buffer-file-coding-system can now + be invoked from the mode line. + + * dired.texi (Dired Deletion, Marks vs Flags): Document Emacs 24.3 + changes to the mark and unmark commands. + (Comparison in Dired): Document chages to dired-diff. Remove M-=, + which is no longer bound to dired-backup-diff. + 2012-10-23 Bastien Guerry * text.texi (Org Authoring): Use a comma after @ref to avoid the === modified file 'doc/emacs/dired.texi' --- doc/emacs/dired.texi 2012-05-09 03:06:08 +0000 +++ doc/emacs/dired.texi 2012-10-24 14:38:49 +0000 @@ -167,13 +167,14 @@ @table @kbd @item d -Flag this file for deletion. +Flag this file for deletion (@code{dired-flag-file-deletion}). @item u -Remove deletion flag on this line. +Remove the deletion flag (@code{dired-unmark}). @item @key{DEL} -Move point to previous line and remove the deletion flag on that line. +Move point to previous line and remove the deletion flag on that line +(@code{dired-unmark-backward}). @item x -Delete the files that are flagged for deletion. +Delete files flagged for deletion (@code{dired-do-flagged-delete}). @end table @kindex d @r{(Dired)} @@ -182,8 +183,12 @@ the file and typing @kbd{d} (@code{dired-flag-file-deletion}). The deletion flag is visible as a @samp{D} at the beginning of the line. This command moves point to the next line, so that repeated @kbd{d} -commands flag successive files. A numeric argument serves as a repeat -count. +commands flag successive files. A numeric prefix argument serves as a +repeat count; a negative count means to flag preceding files. + + If the region is active, the @kbd{d} command flags all files in the +region for deletion; in this case, the command does not move point, +and ignores any prefix argument. @kindex u @r{(Dired deletion)} @kindex DEL @r{(Dired)} @@ -194,14 +199,17 @@ @kbd{u} (@code{dired-unmark}) works just like @kbd{d}, but removes flags rather than making flags. @key{DEL} (@code{dired-unmark-backward}) moves upward, removing flags; it is -like @kbd{u} with argument @minus{}1. +like @kbd{u} with argument @minus{}1. A numeric prefix argument to +either command serves as a repeat count, with a negative count meaning +to unflag in the opposite direction. If the region is active, these +commands instead unflag all files in the region, without moving point. @kindex x @r{(Dired)} @findex dired-do-flagged-delete - To delete the flagged files, type @kbd{x} -(@code{dired-do-flagged-delete}). This command first displays a list -of all the file names flagged for deletion, and requests confirmation -with @kbd{yes}. If you confirm, Dired deletes the flagged files, then + To delete flagged files, type @kbd{x} +(@code{dired-do-flagged-delete}). This command displays a list of all +the file names flagged for deletion, and requests confirmation with +@kbd{yes}. If you confirm, Dired deletes the flagged files, then deletes their lines from the text of the Dired buffer. The Dired buffer, with somewhat fewer lines, remains selected. @@ -387,10 +395,11 @@ @kindex m @r{(Dired)} @kindex * m @r{(Dired)} @findex dired-mark -Mark the current file with @samp{*} (@code{dired-mark}). With a numeric -argument @var{n}, mark the next @var{n} files starting with the current -file. (If @var{n} is negative, mark the previous @minus{}@var{n} -files.) +Mark the current file with @samp{*} (@code{dired-mark}). If the +region is active, mark all files in the region instead; otherwise, if +a numeric argument @var{n} is supplied, mark the next @var{n} files +instead, starting with the current file (if @var{n} is negative, mark +the previous @minus{}@var{n} files). @item * * @kindex * * @r{(Dired)} @@ -426,7 +435,11 @@ @kindex u @r{(Dired)} @kindex * u @r{(Dired)} @findex dired-unmark -Remove any mark on this line (@code{dired-unmark}). +Remove any mark on this line (@code{dired-unmark}). If the region is +active, unmark all files in the region instead; otherwise, if a +numeric argument @var{n} is supplied, unmark the next @var{n} files +instead, starting with the current file (if @var{n} is negative, +unmark the previous @minus{}@var{n} files). @item @key{DEL} @itemx * @key{DEL} @@ -434,7 +447,11 @@ @findex dired-unmark-backward @cindex unmarking files (in Dired) Move point to previous line and remove any mark on that line -(@code{dired-unmark-backward}). +(@code{dired-unmark-backward}). If the region is active, unmark all +files in the region instead; otherwise, if a numeric argument @var{n} +is supplied, unmark the @var{n} preceding files instead, starting with +the current file (if @var{n} is negative, unmark the next +@minus{}@var{n} files). @item * ! @itemx U @@ -936,32 +953,19 @@ @cindex file comparison (in Dired) @cindex compare files (in Dired) - Here are two Dired commands that compare specified files using -@code{diff}. They show the output in a buffer using Diff mode -(@pxref{Comparing Files}). - -@table @kbd -@item = @findex dired-diff @kindex = @r{(Dired)} -Compare the current file (the file at point) with another file (the -file at the mark) using the @code{diff} program (@code{dired-diff}). -The file at the mark is the first argument of @code{diff}, and the -file at point is the second argument. This refers to the ordinary -Emacs mark, not Dired marks; use @kbd{C-@key{SPC}} -(@code{set-mark-command}) to set the mark at the first file's line -(@pxref{Setting Mark}). - -@findex dired-backup-diff -@kindex M-= @r{(Dired)} -@item M-= -Compare the current file with its latest backup file -(@code{dired-backup-diff}). If the current file is itself a backup, -compare it with the file it is a backup of; this way, you can compare -a file with any one of its backups. - -The backup file is the first file given to @code{diff}. -@end table + The @kbd{=} (@code{dired-diff}) command compares the current file +(the file at point) with another file (read using the minibuffer) +using the @command{diff} program. The file specified with the +minibuffer is the first argument of @command{diff}, and file at point +is the second argument. The output of the @command{diff} program is +shown in a buffer using Diff mode (@pxref{Comparing Files}). + + If the region is active, the default for the file read using the +minibuffer is the file at the mark (i.e.@: the ordinary Emacs mark, +not a Dired mark; @pxref{Setting Mark}). Otherwise, if the file at +point has a backup file (@pxref{Backup}), that is the default. @node Subdirectories in Dired @section Subdirectories in Dired === modified file 'doc/emacs/mule.texi' --- doc/emacs/mule.texi 2012-07-17 07:43:01 +0000 +++ doc/emacs/mule.texi 2012-10-24 14:38:49 +0000 @@ -1040,12 +1040,16 @@ @findex set-buffer-file-coding-system The command @kbd{C-x @key{RET} f} (@code{set-buffer-file-coding-system}) sets the file coding system for -the current buffer---in other words, it says which coding system to -use when saving or reverting the visited file. You specify which -coding system using the minibuffer. If you specify a coding system -that cannot handle all of the characters in the buffer, Emacs warns -you about the troublesome characters when you actually save the -buffer. +the current buffer (i.e.@: the coding system to use when saving or +reverting the file). You specify which coding system using the +minibuffer. You can also invoke this command by clicking with +@kbd{Mouse-3} on the coding system indicator in the mode line +(@pxref{Mode Line}). + + If you specify a coding system that cannot handle all the characters +in the buffer, Emacs will warn you about the troublesome characters, +and ask you to choose another coding system, when you try to save the +buffer (@pxref{Output Coding}). @cindex specify end-of-line conversion You can also use this command to specify the end-of-line conversion === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2012-10-24 05:12:23 +0000 +++ doc/lispref/ChangeLog 2012-10-24 14:38:49 +0000 @@ -11,6 +11,12 @@ 2012-10-24 Chong Yidong + * minibuf.texi (Text from Minibuffer): Document read-regexp + changes. + + * nonascii.texi (Selecting a Representation): Document + set-buffer-multibyte changes. + * keymaps.texi (Toolkit Differences): Node deleted. (Easy Menu): New node. === modified file 'doc/lispref/minibuf.texi' --- doc/lispref/minibuf.texi 2012-10-05 07:48:25 +0000 +++ doc/lispref/minibuf.texi 2012-10-24 14:38:49 +0000 @@ -211,22 +211,25 @@ @end smallexample @end defun -@defun read-regexp prompt &optional default +@defun read-regexp prompt &optional default history This function reads a regular expression as a string from the minibuffer and returns it. The argument @var{prompt} is used as in -@code{read-from-minibuffer}. The keymap used is -@code{minibuffer-local-map}, and @code{regexp-history} is used as the -history list (@pxref{Minibuffer History, regexp-history}). +@code{read-from-minibuffer}. The optional argument @var{default} specifies a default value to return if the user enters null input; it should be a string, or @code{nil}, which is equivalent to an empty string. -In addition, @code{read-regexp} collects a few useful candidates for -input and passes them to @code{read-from-minibuffer}, to make them -available to the user as the ``future minibuffer history list'' -(@pxref{Minibuffer History, future list,, emacs, The GNU Emacs -Manual}). These candidates are: +The optional argument @var{history}, if non-@code{nil}, is a symbol +specifying a minibuffer history list to use (@pxref{Minibuffer +History}). If it is omitted or @code{nil}, the history list defaults +to @code{regexp-history}. + +@code{read-regexp} also collects a few useful candidates for input and +passes them to @code{read-from-minibuffer}, to make them available to +the user as the ``future minibuffer history list'' (@pxref{Minibuffer +History, future list,, emacs, The GNU Emacs Manual}). These +candidates are: @itemize @minus @item === modified file 'doc/lispref/nonascii.texi' --- doc/lispref/nonascii.texi 2012-07-28 07:47:58 +0000 +++ doc/lispref/nonascii.texi 2012-10-24 14:38:49 +0000 @@ -241,8 +241,12 @@ (including overlays, text properties and markers) so that they cover the same text as they did before. -You cannot use @code{set-buffer-multibyte} on an indirect buffer, -because indirect buffers always inherit the representation of the +This function signals an error if the buffer is narrowed, since the +narrowing might have occurred in the middle of multibyte character +sequences. + +This function also signals an error if the buffer is an indirect +buffer. An indirect buffer always inherits the representation of its base buffer. @end defun === modified file 'etc/NEWS' --- etc/NEWS 2012-10-23 16:26:52 +0000 +++ etc/NEWS 2012-10-24 14:38:49 +0000 @@ -104,26 +104,19 @@ * Changes in Emacs 24.3 -** minibuffer-electric-default-mode can rewrite (default ...) to [...]. -Just set minibuffer-eldef-shorten-default to t before enabling the mode. - +++ ** Most y-or-n prompts now allow you to scroll the selected window. Typing C-v or M-v at a y-or-n prompt scrolls forward or backward respectively, without exiting from the prompt. ---- -** In minibuffer filename prompts, `C-M-f' and `C-M-b' now move to the -next and previous path separator, respectively. - ** Mode line changes --- *** New option `mode-line-default-help-echo' specifies the help text (shown in a tooltip or in the echo area) for any part of the mode line that does not have its own specialized help text. - -*** You can now click mouse-3 in the coding system indicator to -invokes `set-buffer-file-coding-system'. ++++ +*** You can now click mouse-3 in the coding system indicator to invoke +`set-buffer-file-coding-system'. ** Help changes @@ -139,6 +132,14 @@ even after their associated libraries have been loaded (and the autoloads have been redefined as functions). +** Minibuffer changes +--- +*** In minibuffer filename prompts, `C-M-f' and `C-M-b' now move to the +next and previous path separator, respectively. + +*** minibuffer-electric-default-mode can rewrite (default ...) to [...]. +Just set minibuffer-eldef-shorten-default to t before enabling the mode. + ** ImageMagick support, if available, is automatically enabled. It is no longer necessary to call `imagemagick-register-types' explicitly to install ImageMagick image types; that function is called @@ -340,15 +341,15 @@ *** New option `compilation-always-kill'. ** Customize - +--- *** `custom-reset-button-menu' now defaults to t. - +--- *** Non-option variables are never matched in `customize-apropos' and `customize-apropos-options' (i.e. the prefix argument does nothing for these commands now). ** Desktop - +--- *** `desktop-path' no longer includes the "." directory. Desktop files are now located in ~/.emacs.d by default. @@ -402,22 +403,23 @@ *** `dired-do-async-shell-command' executes each file sequentially if the command ends in `;' (when operating on multiple files). Otherwise, it executes the command on each file in parallel. - +--- *** Typing M-n in the minibuffer of `dired-do-chmod', `dired-do-chgrp', `dired-do-chown', `dired-do-touch' pulls the file attributes of the file at point. - ++++ *** When the region is active, `m' (`dired-mark'), `u' (`dired-unmark'), `DEL' (`dired-unmark-backward'), `d' (`dired-flag-file-deletion') mark/unmark/flag all files in the active region. - ++++ *** The minibuffer default for `=' (`dired-diff) has changed. It is now the backup file for the file at point, if one exists. In Transient Mark mode the default is the file at the active mark. - ++++ *** `M-=' is no longer bound to `dired-backup-diff' in Dired buffers. The global binding for `M-=', `count-words-region' is in effect. +--- ** Ediff now uses the same color scheme as Diff mode. ** erc will look up server/channel names via auth-source and use the @@ -428,9 +430,9 @@ `flymake-warning-bitmap'. ** Follow mode - +--- *** The obsolete variable `follow-mode-off-hook' has been removed. - +--- *** Follow mode no longer works by using advice. The option `follow-intercept-processes' has been removed. @@ -673,6 +675,7 @@ * Incompatible Lisp Changes in Emacs 24.3 ++++ ** set-buffer-multibyte now signals an error in narrowed buffers. +++ @@ -772,9 +775,18 @@ ** CL-style generalized variables are now in core Elisp. `setf' is autoloaded; `push' and `pop' accept generalized variables. ++++ ** `defun' also accepts a (declare DECLS) form, like `defmacro'. The interpretation of the DECLS is determined by `defun-declarations-alist'. +** Minibuffer ++++ +*** `read-regexp' has a new argument HISTORY; the first argument PROMPT +of `read-regexp' accepts a string ending with a colon and space, and its +second argument DEFAULTS can be a list of strings accessible via M-n +in the minibuffer ahead of other hard-coded useful regexp-related values. +More commands use `read-regexp' now to read their regexp arguments. + ** Completion *** New function `completion-table-with-quoting' to handle completion @@ -797,14 +809,6 @@ *** New var `inhibit-debugger', automatically set to prevent accidental recursive invocations. -** Minibuffer - -*** `read-regexp' has a new argument HISTORY; the first argument PROMPT -of `read-regexp' accepts a string ending with a colon and space, and its -second argument DEFAULTS can be a list of strings accessible via M-n -in the minibuffer ahead of other hard-coded useful regexp-related values. -More commands use `read-regexp' now to read their regexp arguments. - ** Window changes *** The functions get-lru-window, get-mru-window and get-largest-window === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-10-24 03:48:50 +0000 +++ lisp/ChangeLog 2012-10-24 14:38:49 +0000 @@ -1,5 +1,8 @@ 2012-10-24 Chong Yidong + * dired.el (dired-mark, dired-unmark, dired-flag-file-deletion): + Doc fix. + * emacs-lisp/easymenu.el (easy-menu-define): Doc fix (Bug#12628). 2012-10-24 Stefan Monnier === modified file 'lisp/dired.el' --- lisp/dired.el 2012-10-18 03:50:15 +0000 +++ lisp/dired.el 2012-10-24 14:38:49 +0000 @@ -3107,10 +3107,11 @@ (forward-line 1)))) (defun dired-mark (arg) - "Mark the current (or next ARG) files. + "Mark the file at point in the Dired buffer. +If the region is active, mark all files in the region. +Otherwise, with a prefix arg, mark files on the next ARG lines. + If on a subdir headerline, mark all its files except `.' and `..'. -If the region is active in Transient Mark mode, mark all files -in the active region. Use \\[dired-unmark-all-files] to remove all marks and \\[dired-unmark] on a subdir to remove the marks in @@ -3136,7 +3137,10 @@ (function (lambda () (delete-char 1) (insert dired-marker-char)))))))) (defun dired-unmark (arg) - "Unmark the current (or next ARG) files. + "Unmark the file at point in the Dired buffer. +If the region is active, unmark all files in the region. +Otherwise, with a prefix arg, unmark files on the next ARG lines. + If looking at a subdir, unmark all its files except `.' and `..'. If the region is active in Transient Mark mode, unmark all files in the active region." @@ -3146,7 +3150,9 @@ (defun dired-flag-file-deletion (arg) "In Dired, flag the current line's file for deletion. -With prefix arg, repeat over several lines. +If the region is active, flag all files in the region. +Otherwise, with a prefix arg, flag files on the next ARG lines. + If on a subdir headerline, flag all its files except `.' and `..'. If the region is active in Transient Mark mode, flag all files in the active region." ------------------------------------------------------------ revno: 110649 committer: Juanma Barranquero branch nick: trunk timestamp: Wed 2012-10-24 15:46:38 +0200 message: nt/config.nt: Sync with autogen/config.in. diff: === modified file 'nt/ChangeLog' --- nt/ChangeLog 2012-10-19 19:25:18 +0000 +++ nt/ChangeLog 2012-10-24 13:46:38 +0000 @@ -1,3 +1,7 @@ +2012-10-24 Juanma Barranquero + + * config.nt: Sync with autogen/config.in. + 2012-10-17 Eli Zaretskii * inc/pwd.h (getuid, geteuid): Add prototypes. === modified file 'nt/config.nt' --- nt/config.nt 2012-10-17 19:02:44 +0000 +++ nt/config.nt 2012-10-24 13:46:38 +0000 @@ -148,7 +148,7 @@ /* Enable compile-time and run-time bounds-checking, and some warnings, without upsetting glibc 2.15+. */ - #if defined __OPTIMIZE__ && __OPTIMIZE__ + #if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__ # define _FORTIFY_SOURCE 2 #endif @@ -701,7 +701,7 @@ Mac OS X. */ #undef HAVE_NS -/* Define to use native Windows GUI. */ +/* Define to use native MS Windows GUI. */ #define HAVE_NTGUI 1 /* Define to 1 if libotf has OTF_get_variation_glyphs. */ ------------------------------------------------------------ revno: 110648 committer: Glenn Morris branch nick: trunk timestamp: Wed 2012-10-24 06:17:36 -0400 message: Auto-commit of generated files. diff: === modified file 'autogen/config.in' --- autogen/config.in 2012-10-09 10:17:32 +0000 +++ autogen/config.in 2012-10-24 10:17:36 +0000 @@ -144,7 +144,7 @@ /* Enable compile-time and run-time bounds-checking, and some warnings, without upsetting glibc 2.15+. */ - #if defined __OPTIMIZE__ && __OPTIMIZE__ + #if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__ # define _FORTIFY_SOURCE 2 #endif ------------------------------------------------------------ revno: 110647 committer: Glenn Morris branch nick: trunk timestamp: Wed 2012-10-24 00:41:11 -0700 message: Further namespace updates for cl.texi * doc/misc/cl.texi (Basic Setf, Macros, Declarations, Symbols, Numbers) (Sequences, Lists, Structures, Assertions, Efficiency Concerns) (Efficiency Concerns, Efficiency Concerns) (Common Lisp Compatibility, Old CL Compatibility): Further updates for cl-lib namespace. diff: === modified file 'doc/misc/ChangeLog' --- doc/misc/ChangeLog 2012-10-24 05:12:23 +0000 +++ doc/misc/ChangeLog 2012-10-24 07:41:11 +0000 @@ -1,3 +1,11 @@ +2012-10-24 Glenn Morris + + * cl.texi (Basic Setf, Macros, Declarations, Symbols, Numbers) + (Sequences, Lists, Structures, Assertions, Efficiency Concerns) + (Efficiency Concerns, Efficiency Concerns) + (Common Lisp Compatibility, Old CL Compatibility): + Further updates for cl-lib namespace. + 2012-10-24 Paul Eggert Update manual for new time stamp format (Bug#12706). === modified file 'doc/misc/cl.texi' --- doc/misc/cl.texi 2012-10-23 07:43:39 +0000 +++ doc/misc/cl.texi 2012-10-24 07:41:11 +0000 @@ -1047,11 +1047,11 @@ the proper left-to-right order; for example, @example -(setf (aref vec (incf i)) i) +(setf (aref vec (cl-incf i)) i) @end example @noindent -looks like it will evaluate @code{(incf i)} exactly once, before the +looks like it will evaluate @code{(cl-incf i)} exactly once, before the following access to @code{i}; the @code{setf} expander will insert temporary variables as necessary to ensure that it does in fact work this way no matter what setf-method is defined for @code{aref}. @@ -1081,7 +1081,7 @@ that operate on generalized variables. Many are interesting and useful even when the @var{place} is just a variable name. -@defspec psetf [place form]@dots{} +@defspec cl-psetf [place form]@dots{} This macro is to @code{setf} what @code{cl-psetq} is to @code{setq}: When several @var{place}s and @var{form}s are involved, the assignments take place in parallel rather than sequentially. @@ -1089,17 +1089,17 @@ all the assignments are done (in an undefined order). @end defspec -@defspec incf place &optional x +@defspec cl-incf place &optional x This macro increments the number stored in @var{place} by one, or by @var{x} if specified. The incremented value is returned. For -example, @code{(incf i)} is equivalent to @code{(setq i (1+ i))}, and -@code{(incf (car x) 2)} is equivalent to @code{(setcar x (+ (car x) 2))}. +example, @code{(cl-incf i)} is equivalent to @code{(setq i (1+ i))}, and +@code{(cl-incf (car x) 2)} is equivalent to @code{(setcar x (+ (car x) 2))}. Once again, care is taken to preserve the ``apparent'' order of evaluation. For example, @example -(incf (aref vec (incf i))) +(cl-incf (aref vec (cl-incf i))) @end example @noindent @@ -1109,27 +1109,27 @@ ``obvious'' expansion, @example -(setf (aref vec (incf i)) (1+ (aref vec (incf i)))) ; Wrong! +(setf (aref vec (cl-incf i)) (1+ (aref vec (cl-incf i)))) ; Wrong! @end example @noindent but rather to something more like @example -(let ((temp (incf i))) +(let ((temp (cl-incf i))) (setf (aref vec temp) (1+ (aref vec temp)))) @end example @noindent -Again, all of this is taken care of automatically by @code{incf} and +Again, all of this is taken care of automatically by @code{cl-incf} and the other generalized-variable macros. -As a more Emacs-specific example of @code{incf}, the expression -@code{(incf (point) @var{n})} is essentially equivalent to +As a more Emacs-specific example of @code{cl-incf}, the expression +@code{(cl-incf (point) @var{n})} is essentially equivalent to @code{(forward-char @var{n})}. @end defspec -@defspec decf place &optional x +@defspec cl-decf place &optional x This macro decrements the number stored in @var{place} by one, or by @var{x} if specified. @end defspec @@ -1256,7 +1256,7 @@ This is the ``generic'' modify macro. It calls @var{function}, which should be an unquoted function name, macro name, or lambda. It passes @var{place} and @var{args} as arguments, and assigns the -result back to @var{place}. For example, @code{(incf @var{place} +result back to @var{place}. For example, @code{(cl-incf @var{place} @var{n})} is the same as @code{(callf + @var{place} @var{n})}. Some more examples: @@ -1279,7 +1279,7 @@ @end defspec The @code{callf} and @code{callf2} macros serve as building -blocks for other macros like @code{incf}, @code{pushnew}, and +blocks for other macros like @code{cl-incf}, @code{pushnew}, and @code{define-modify-macro}. The @code{letf} and @code{letf*} macros are used in the processing of symbol macros; @pxref{Macro Bindings}. @@ -1294,7 +1294,7 @@ @defspec define-modify-macro name arglist function [doc-string] This macro defines a ``read-modify-write'' macro similar to -@code{incf} and @code{decf}. The macro @var{name} is defined +@code{cl-incf} and @code{cl-decf}. The macro @var{name} is defined to take a @var{place} argument followed by additional arguments described by @var{arglist}. The call @@ -1306,7 +1306,7 @@ will be expanded to @example -(callf @var{func} @var{place} @var{args}...) +(cl-callf @var{func} @var{place} @var{args}...) @end example @noindent @@ -1319,8 +1319,8 @@ For example: @example -(define-modify-macro incf (&optional (n 1)) +) -(define-modify-macro concatf (&rest args) concat) +(define-modify-macro cl-incf (&optional (n 1)) +) +(define-modify-macro cl-concatf (&rest args) concat) @end example Note that @code{&key} is not allowed in @var{arglist}, but @@ -1399,7 +1399,7 @@ The Lisp form that is returned can access the arguments from @var{arglist} and @var{store-var} in an unrestricted fashion; -macros like @code{setf} and @code{incf} which invoke this +macros like @code{setf} and @code{cl-incf} which invoke this setf-method will insert temporary variables as needed to make sure the apparent order of evaluation is preserved. @@ -1452,7 +1452,7 @@ @code{defsetf}, the second return value is simply the list of arguments in the place form, and the first return value is a list of a corresponding number of temporary variables generated -by @code{gensym}. Macros like @code{setf} and @code{incf} which +by @code{cl-gensym}. Macros like @code{setf} and @code{cl-incf} which use this setf-method will optimize away most temporaries that turn out to be unnecessary, so there is little reason for the setf-method itself to optimize. @@ -1463,11 +1463,12 @@ invoking the definition previously recorded by @code{defsetf} or @code{define-setf-method}. The result is a list of five values as described above. You can use this function to build -your own @code{incf}-like modify macros. (Actually, it is +your own @code{cl-incf}-like modify macros. (Actually, it is +@c FIXME? better to use the internal functions @code{cl-setf-do-modify} and @code{cl-setf-do-store}, which are a bit easier to use and which also do a number of optimizations; consult the source -code for the @code{incf} function for a simple example.) +code for the @code{cl-incf} function for a simple example.) The argument @var{env} specifies the ``environment'' to be passed on to @code{macroexpand} if @code{get-setf-method} should @@ -1504,14 +1505,14 @@ These Lisp forms make bindings to variables and function names, analogous to Lisp's built-in @code{let} form. -@xref{Modify Macros}, for the @code{letf} and @code{letf*} forms which +@xref{Modify Macros}, for the @code{letf} and @code{cl-letf*} forms which are also related to variable bindings. @menu -* Dynamic Bindings:: The @code{progv} form. +* Dynamic Bindings:: The @code{cl-progv} form. * Lexical Bindings:: @code{lexical-let} and lexical closures. * Function Bindings:: @code{flet} and @code{labels}. -* Macro Bindings:: @code{macrolet} and @code{symbol-macrolet}. +* Macro Bindings:: @code{cl-macrolet} and @code{cl-symbol-macrolet}. @end menu @node Dynamic Bindings @@ -1519,10 +1520,10 @@ @noindent The standard @code{let} form binds variables whose names are known -at compile-time. The @code{progv} form provides an easy way to +at compile-time. The @code{cl-progv} form provides an easy way to bind variables whose names are computed at run-time. -@defspec progv symbols values forms@dots{} +@defspec cl-progv symbols values forms@dots{} This form establishes @code{let}-style variable bindings on a set of variables computed at run-time. The expressions @var{symbols} and @var{values} are evaluated, and must return lists @@ -1587,7 +1588,7 @@ @example (defun make-counter () (lexical-let ((n 0)) - (function* (lambda (&optional (m 1)) (incf n m))))) + (cl-function (lambda (&optional (m 1)) (cl-incf n m))))) (setq count-1 (make-counter)) (funcall count-1 3) @result{} 3 @@ -1696,8 +1697,8 @@ fail if byte-compiled. In such cases, use @code{labels} instead. Functions defined by @code{flet} may use the full Common Lisp -argument notation supported by @code{defun*}; also, the function -body is enclosed in an implicit block as if by @code{defun*}. +argument notation supported by @code{cl-defun}; also, the function +body is enclosed in an implicit block as if by @code{cl-defun}. @xref{Program Structure}. @end defspec @@ -1730,21 +1731,21 @@ @noindent These forms create local macros and ``symbol macros.'' -@defspec macrolet (bindings@dots{}) forms@dots{} +@defspec cl-macrolet (bindings@dots{}) forms@dots{} This form is analogous to @code{flet}, but for macros instead of functions. Each @var{binding} is a list of the same form as the -arguments to @code{defmacro*} (i.e., a macro name, argument list, +arguments to @code{cl-defmacro} (i.e., a macro name, argument list, and macro-expander forms). The macro is defined accordingly for -use within the body of the @code{macrolet}. +use within the body of the @code{cl-macrolet}. -Because of the nature of macros, @code{macrolet} is lexically -scoped even in Emacs Lisp: The @code{macrolet} binding will +Because of the nature of macros, @code{cl-macrolet} is lexically +scoped even in Emacs Lisp: The @code{cl-macrolet} binding will affect only calls that appear physically within the body @var{forms}, possibly after expansion of other macros in the body. @end defspec -@defspec symbol-macrolet (bindings@dots{}) forms@dots{} +@defspec cl-symbol-macrolet (bindings@dots{}) forms@dots{} This form creates @dfn{symbol macros}, which are macros that look like variable references rather than function calls. Each @var{binding} is a list @samp{(@var{var} @var{expansion})}; @@ -1753,8 +1754,8 @@ @example (setq bar '(5 . 9)) -(symbol-macrolet ((foo (car bar))) - (incf foo)) +(cl-symbol-macrolet ((foo (car bar))) + (cl-incf foo)) bar @result{} (6 . 9) @end example @@ -1766,23 +1767,23 @@ Likewise, a @code{let} or @code{let*} binding a symbol macro is treated like a @code{letf} or @code{letf*}. This differs from true Common Lisp, where the rules of lexical scoping cause a @code{let} -binding to shadow a @code{symbol-macrolet} binding. In this package, +binding to shadow a @code{cl-symbol-macrolet} binding. In this package, only @code{lexical-let} and @code{lexical-let*} will shadow a symbol macro. There is no analogue of @code{defmacro} for symbol macros; all symbol -macros are local. A typical use of @code{symbol-macrolet} is in the +macros are local. A typical use of @code{cl-symbol-macrolet} is in the expansion of another macro: @example -(defmacro* my-dolist ((x list) &rest body) +(cl-defmacro my-dolist ((x list) &rest body) (let ((var (gensym))) - (list 'loop 'for var 'on list 'do - (list* 'symbol-macrolet (list (list x (list 'car var))) + (list 'cl-loop 'for var 'on list 'do + (cl-list* 'cl-symbol-macrolet (list (list x (list 'car var))) body)))) (setq mylist '(1 2 3 4)) -(my-dolist (x mylist) (incf x)) +(my-dolist (x mylist) (cl-incf x)) mylist @result{} (2 3 4 5) @end example @@ -1794,19 +1795,19 @@ shown here expands to @example -(loop for G1234 on mylist do - (symbol-macrolet ((x (car G1234))) - (incf x))) +(cl-loop for G1234 on mylist do + (cl-symbol-macrolet ((x (car G1234))) + (cl-incf x))) @end example @noindent which in turn expands to @example -(loop for G1234 on mylist do (incf (car G1234))) +(cl-loop for G1234 on mylist do (cl-incf (car G1234))) @end example -@xref{Loop Facility}, for a description of the @code{loop} macro. +@xref{Loop Facility}, for a description of the @code{cl-loop} macro. This package defines a nonstandard @code{in-ref} loop clause that works much like @code{my-dolist}. @end defspec @@ -1818,11 +1819,11 @@ These conditional forms augment Emacs Lisp's simple @code{if}, @code{and}, @code{or}, and @code{cond} forms. -@defspec case keyform clause@dots{} +@defspec cl-case keyform clause@dots{} This macro evaluates @var{keyform}, then compares it with the key values listed in the various @var{clause}s. Whichever clause matches the key is executed; comparison is done by @code{eql}. If no clause -matches, the @code{case} form returns @code{nil}. The clauses are +matches, the @code{cl-case} form returns @code{nil}. The clauses are of the form @example @@ -1846,7 +1847,7 @@ a @key{RET} or @kbd{C-j}, or anything else. @example -(case (read-char) +(cl-case (read-char) (?a (do-a-thing)) (?b (do-b-thing)) ((?\r ?\n) (do-ret-thing)) @@ -1854,20 +1855,20 @@ @end example @end defspec -@defspec ecase keyform clause@dots{} -This macro is just like @code{case}, except that if the key does +@defspec cl-ecase keyform clause@dots{} +This macro is just like @code{cl-case}, except that if the key does not match any of the clauses, an error is signaled rather than simply returning @code{nil}. @end defspec -@defspec typecase keyform clause@dots{} -This macro is a version of @code{case} that checks for types +@defspec cl-typecase keyform clause@dots{} +This macro is a version of @code{cl-case} that checks for types rather than values. Each @var{clause} is of the form @samp{(@var{type} @var{body}...)}. @xref{Type Predicates}, for a description of type specifiers. For example, @example -(typecase x +(cl-typecase x (integer (munch-integer x)) (float (munch-float x)) (string (munch-integer (string-to-int x))) @@ -1879,8 +1880,8 @@ several types, use an @code{(or ...)} type specifier. @end defspec -@defspec etypecase keyform clause@dots{} -This macro is just like @code{typecase}, except that if the key does +@defspec cl-etypecase keyform clause@dots{} +This macro is just like @code{cl-typecase}, except that if the key does not match any of the clauses, an error is signaled rather than simply returning @code{nil}. @end defspec @@ -1891,26 +1892,26 @@ @noindent Common Lisp @dfn{blocks} provide a non-local exit mechanism very similar to @code{catch} and @code{throw}, but lexically rather than -dynamically scoped. This package actually implements @code{block} +dynamically scoped. This package actually implements @code{cl-block} in terms of @code{catch}; however, the lexical scoping allows the optimizing byte-compiler to omit the costly @code{catch} step if the -body of the block does not actually @code{return-from} the block. +body of the block does not actually @code{cl-return-from} the block. -@defspec block name forms@dots{} +@defspec cl-block name forms@dots{} The @var{forms} are evaluated as if by a @code{progn}. However, -if any of the @var{forms} execute @code{(return-from @var{name})}, -they will jump out and return directly from the @code{block} form. -The @code{block} returns the result of the last @var{form} unless -a @code{return-from} occurs. +if any of the @var{forms} execute @code{(cl-return-from @var{name})}, +they will jump out and return directly from the @code{cl-block} form. +The @code{cl-block} returns the result of the last @var{form} unless +a @code{cl-return-from} occurs. -The @code{block}/@code{return-from} mechanism is quite similar to +The @code{cl-block}/@code{cl-return-from} mechanism is quite similar to the @code{catch}/@code{throw} mechanism. The main differences are that block @var{name}s are unevaluated symbols, rather than forms (such as quoted symbols) which evaluate to a tag at run-time; and also that blocks are lexically scoped whereas @code{catch}/@code{throw} are dynamically scoped. This means that functions called from the body of a @code{catch} can also @code{throw} to the @code{catch}, -but the @code{return-from} referring to a block name must appear +but the @code{cl-return-from} referring to a block name must appear physically within the @var{forms} that make up the body of the block. They may not appear within other called functions, although they may appear within macro expansions or @code{lambda}s in the body. Block @@ -1919,11 +1920,11 @@ In true Common Lisp, @code{defun} and @code{defmacro} surround the function or expander bodies with implicit blocks with the same name as the function or macro. This does not occur in Emacs -Lisp, but this package provides @code{defun*} and @code{defmacro*} +Lisp, but this package provides @code{cl-defun} and @code{cl-defmacro} forms which do create the implicit block. The Common Lisp looping constructs defined by this package, -such as @code{loop} and @code{dolist}, also create implicit blocks +such as @code{cl-loop} and @code{cl-dolist}, also create implicit blocks just as in Common Lisp. Because they are implemented in terms of Emacs Lisp @code{catch} @@ -1931,22 +1932,22 @@ @code{catch} constructs (roughly two function calls). However, the optimizing byte compiler will optimize away the @code{catch} if the block does -not in fact contain any @code{return} or @code{return-from} calls -that jump to it. This means that @code{do} loops and @code{defun*} -functions which don't use @code{return} don't pay the overhead to +not in fact contain any @code{cl-return} or @code{cl-return-from} calls +that jump to it. This means that @code{cl-do} loops and @code{cl-defun} +functions which don't use @code{cl-return} don't pay the overhead to support it. @end defspec -@defspec return-from name [result] +@defspec cl-return-from name [result] This macro returns from the block named @var{name}, which must be an (unevaluated) symbol. If a @var{result} form is specified, it is evaluated to produce the result returned from the @code{block}. Otherwise, @code{nil} is returned. @end defspec -@defspec return [result] -This macro is exactly like @code{(return-from nil @var{result})}. -Common Lisp loops like @code{do} and @code{dolist} implicitly enclose +@defspec cl-return [result] +This macro is exactly like @code{(cl-return-from nil @var{result})}. +Common Lisp loops like @code{cl-do} and @code{cl-dolist} implicitly enclose themselves in @code{nil} blocks. @end defspec @@ -1958,27 +1959,27 @@ looping constructs to complement Emacs Lisp's basic @code{while} loop. -@defspec loop forms@dots{} +@defspec cl-loop forms@dots{} The @code{CL} package supports both the simple, old-style meaning of @code{loop} and the extremely powerful and flexible feature known as the @dfn{Loop Facility} or @dfn{Loop Macro}. This more advanced facility is discussed in the following section; @pxref{Loop Facility}. The simple form of @code{loop} is described here. -If @code{loop} is followed by zero or more Lisp expressions, -then @code{(loop @var{exprs}@dots{})} simply creates an infinite +If @code{cl-loop} is followed by zero or more Lisp expressions, +then @code{(cl-loop @var{exprs}@dots{})} simply creates an infinite loop executing the expressions over and over. The loop is enclosed in an implicit @code{nil} block. Thus, @example -(loop (foo) (if (no-more) (return 72)) (bar)) +(cl-loop (foo) (if (no-more) (return 72)) (bar)) @end example @noindent is exactly equivalent to @example -(block nil (while t (foo) (if (no-more) (return 72)) (bar))) +(cl-block nil (while t (foo) (if (no-more) (return 72)) (bar))) @end example If any of the expressions are plain symbols, the loop is instead @@ -1988,7 +1989,7 @@ value of a variable.) @end defspec -@defspec do (spec@dots{}) (end-test [result@dots{}]) forms@dots{} +@defspec cl-do (spec@dots{}) (end-test [result@dots{}]) forms@dots{} This macro creates a general iterative loop. Each @var{spec} is of the form @@ -2006,8 +2007,8 @@ forms are evaluated (with the @var{var}s still bound to their values) to produce the result returned by @code{do}. -The entire @code{do} loop is enclosed in an implicit @code{nil} -block, so that you can use @code{(return)} to break out of the +The entire @code{cl-do} loop is enclosed in an implicit @code{nil} +block, so that you can use @code{(cl-return)} to break out of the loop at any time. If there are no @var{result} forms, the loop returns @code{nil}. @@ -2023,21 +2024,21 @@ This example (from Steele) illustrates a loop which applies the function @code{f} to successive pairs of values from the lists @code{foo} and @code{bar}; it is equivalent to the call -@code{(mapcar* 'f foo bar)}. Note that this loop has no body +@code{(cl-mapcar 'f foo bar)}. Note that this loop has no body @var{forms} at all, performing all its work as side effects of the rest of the loop. @example -(do ((x foo (cdr x)) - (y bar (cdr y)) - (z nil (cons (f (car x) (car y)) z))) - ((or (null x) (null y)) - (nreverse z))) +(cl-do ((x foo (cdr x)) + (y bar (cdr y)) + (z nil (cons (f (car x) (car y)) z))) + ((or (null x) (null y)) + (nreverse z))) @end example @end defspec -@defspec do* (spec@dots{}) (end-test [result@dots{}]) forms@dots{} -This is to @code{do} what @code{let*} is to @code{let}. In +@defspec cl-do* (spec@dots{}) (end-test [result@dots{}]) forms@dots{} +This is to @code{cl-do} what @code{let*} is to @code{let}. In particular, the initial values are bound as if by @code{let*} rather than @code{let}, and the steps are assigned as if by @code{setq} rather than @code{cl-psetq}. @@ -2045,18 +2046,18 @@ Here is another way to write the above loop: @example -(do* ((xp foo (cdr xp)) - (yp bar (cdr yp)) - (x (car xp) (car xp)) - (y (car yp) (car yp)) - z) +(cl-do* ((xp foo (cdr xp)) + (yp bar (cdr yp)) + (x (car xp) (car xp)) + (y (car yp) (car yp)) + z) ((or (null xp) (null yp)) (nreverse z)) (push (f x y) z)) @end example @end defspec -@defspec dolist (var list [result]) forms@dots{} +@defspec cl-dolist (var list [result]) forms@dots{} This is a more specialized loop which iterates across the elements of a list. @var{list} should evaluate to a list; the body @var{forms} are executed with @var{var} bound to each element of the list in @@ -2066,7 +2067,7 @@ surrounded by an implicit @code{nil} block. @end defspec -@defspec dotimes (var count [result]) forms@dots{} +@defspec cl-dotimes (var count [result]) forms@dots{} This is a more specialized loop which iterates a specified number of times. The body is executed with @var{var} bound to the integers from zero (inclusive) to @var{count} (exclusive), in turn. Then @@ -2076,7 +2077,7 @@ @code{dolist}, the loop is surrounded by an implicit @code{nil} block. @end defspec -@defspec do-symbols (var [obarray [result]]) forms@dots{} +@defspec cl-do-symbols (var [obarray [result]]) forms@dots{} This loop iterates over all interned symbols. If @var{obarray} is specified and is not @code{nil}, it loops over all symbols in that obarray. For each symbol, the body @var{forms} are evaluated @@ -2086,8 +2087,8 @@ value. The loop is surrounded by an implicit @code{nil} block. @end defspec -@defspec do-all-symbols (var [result]) forms@dots{} -This is identical to @code{do-symbols} except that the @var{obarray} +@defspec cl-do-all-symbols (var [result]) forms@dots{} +This is identical to @code{cl-do-symbols} except that the @var{obarray} argument is omitted; it always iterates over the default obarray. @end defspec @@ -2108,8 +2109,8 @@ with an easy-to-use but very powerful and expressive syntax. @menu -* Loop Basics:: @code{loop} macro, basic clause structure. -* Loop Examples:: Working examples of @code{loop} macro. +* Loop Basics:: @code{cl-loop} macro, basic clause structure. +* Loop Examples:: Working examples of @code{cl-loop} macro. * For Clauses:: Clauses introduced by @code{for} or @code{as}. * Iteration Clauses:: @code{repeat}, @code{while}, @code{thereis}, etc. * Accumulation Clauses:: @code{collect}, @code{sum}, @code{maximize}, etc. @@ -2120,19 +2121,19 @@ @subsection Loop Basics @noindent -The @code{loop} macro essentially creates a mini-language within +The @code{cl-loop} macro essentially creates a mini-language within Lisp that is specially tailored for describing loops. While this language is a little strange-looking by the standards of regular Lisp, it turns out to be very easy to learn and well-suited to its purpose. -Since @code{loop} is a macro, all parsing of the loop language -takes place at byte-compile time; compiled @code{loop}s are just +Since @code{cl-loop} is a macro, all parsing of the loop language +takes place at byte-compile time; compiled @code{cl-loop}s are just as efficient as the equivalent @code{while} loops written longhand. -@defspec loop clauses@dots{} +@defspec cl-loop clauses@dots{} A loop construct consists of a series of @var{clause}s, each introduced by a symbol like @code{for} or @code{do}. Clauses -are simply strung together in the argument list of @code{loop}, +are simply strung together in the argument list of @code{cl-loop}, with minimal extra parentheses. The various types of clauses specify initializations, such as the binding of temporary variables, actions to be taken in the loop, stepping actions, @@ -2142,9 +2143,9 @@ loop: @example -(loop @var{name-clause} - @var{var-clauses}@dots{} - @var{action-clauses}@dots{}) +(cl-loop @var{name-clause} + @var{var-clauses}@dots{} + @var{action-clauses}@dots{}) @end example The @var{name-clause} optionally gives a name to the implicit @@ -2155,7 +2156,7 @@ @var{action-clauses} are things to be done during the loop, such as computing, collecting, and returning values. -The Emacs version of the @code{loop} macro is less restrictive about +The Emacs version of the @code{cl-loop} macro is less restrictive about the order of clauses, but things will behave most predictably if you put the variable-binding clauses @code{with}, @code{for}, and @code{repeat} before the action clauses. As in Common Lisp, @@ -2180,25 +2181,25 @@ @noindent Before listing the full set of clauses that are allowed, let's -look at a few example loops just to get a feel for the @code{loop} +look at a few example loops just to get a feel for the @code{cl-loop} language. @example -(loop for buf in (buffer-list) - collect (buffer-file-name buf)) +(cl-loop for buf in (buffer-list) + collect (buffer-file-name buf)) @end example @noindent This loop iterates over all Emacs buffers, using the list returned by @code{buffer-list}. For each buffer @code{buf}, it calls @code{buffer-file-name} and collects the results into -a list, which is then returned from the @code{loop} construct. +a list, which is then returned from the @code{cl-loop} construct. The result is a list of the file names of all the buffers in Emacs's memory. The words @code{for}, @code{in}, and @code{collect} -are reserved words in the @code{loop} language. +are reserved words in the @code{cl-loop} language. @example -(loop repeat 20 do (insert "Yowsa\n")) +(cl-loop repeat 20 do (insert "Yowsa\n")) @end example @noindent @@ -2206,7 +2207,7 @@ current buffer. @example -(loop until (eobp) do (munch-line) (forward-line 1)) +(cl-loop until (eobp) do (munch-line) (forward-line 1)) @end example @noindent @@ -2215,7 +2216,7 @@ the loop exits immediately. @example -(loop do (munch-line) until (eobp) do (forward-line 1)) +(cl-loop do (munch-line) until (eobp) do (forward-line 1)) @end example @noindent @@ -2223,10 +2224,10 @@ is always called at least once. @example -(loop for x from 1 to 100 - for y = (* x x) - until (>= y 729) - finally return (list x (= y 729))) +(cl-loop for x from 1 to 100 + for y = (* x x) + until (>= y 729) + finally return (list x (= y 729))) @end example @noindent @@ -2246,7 +2247,7 @@ @code{for}s and an @code{until}) that would have been enough to define loops all by themselves, it still creates a single loop rather than some sort of triple-nested loop. You must explicitly -nest your @code{loop} constructs if you want nested loops. +nest your @code{cl-loop} constructs if you want nested loops. @node For Clauses @subsection For Clauses @@ -2272,7 +2273,7 @@ @example (setq i 'happy) -(loop for i from 1 to 10 do (do-something-with i)) +(cl-loop for i from 1 to 10 do (do-something-with i)) i @result{} happy @end example @@ -2302,10 +2303,10 @@ that they are exclusive rather than inclusive limits: @example -(loop for x to 10 collect x) - @result{} (0 1 2 3 4 5 6 7 8 9 10) -(loop for x below 10 collect x) - @result{} (0 1 2 3 4 5 6 7 8 9) +(cl-loop for x to 10 collect x) + @result{} (0 1 2 3 4 5 6 7 8 9 10) +(cl-loop for x below 10 collect x) + @result{} (0 1 2 3 4 5 6 7 8 9) @end example The @code{by} value is always positive, even for downward-counting @@ -2320,25 +2321,25 @@ function taking one argument. For example: @example -(loop for x in '(1 2 3 4 5 6) collect (* x x)) - @result{} (1 4 9 16 25 36) -(loop for x in '(1 2 3 4 5 6) by 'cddr collect (* x x)) - @result{} (1 9 25) +(cl-loop for x in '(1 2 3 4 5 6) collect (* x x)) + @result{} (1 4 9 16 25 36) +(cl-loop for x in '(1 2 3 4 5 6) by 'cddr collect (* x x)) + @result{} (1 9 25) @end example @item for @var{var} on @var{list} by @var{function} This clause iterates @var{var} over all the cons cells of @var{list}. @example -(loop for x on '(1 2 3 4) collect x) - @result{} ((1 2 3 4) (2 3 4) (3 4) (4)) +(cl-loop for x on '(1 2 3 4) collect x) + @result{} ((1 2 3 4) (2 3 4) (3 4) (4)) @end example With @code{by}, there is no real reason that the @code{on} expression must be a list. For example: @example -(loop for x on first-animal by 'next-animal collect x) +(cl-loop for x on first-animal by 'next-animal collect x) @end example @noindent @@ -2352,7 +2353,7 @@ rather than just a temporary variable. For example, @example -(loop for x in-ref my-list do (incf x)) +(cl-loop for x in-ref my-list do (cl-incf x)) @end example @noindent @@ -2364,8 +2365,8 @@ which may be a vector or a string. @example -(loop for x across "aeiou" - do (use-vowel (char-to-string x))) +(cl-loop for x across "aeiou" + do (use-vowel (char-to-string x))) @end example @item for @var{var} across-ref @var{array} @@ -2397,10 +2398,10 @@ As an example, @example -(loop for sym being the symbols - when (fboundp sym) - when (string-match "^map" (symbol-name sym)) - collect sym) +(cl-loop for sym being the symbols + when (fboundp sym) + when (string-match "^map" (symbol-name sym)) + collect sym) @end example @noindent @@ -2411,7 +2412,7 @@ Due to a minor implementation restriction, it will not work to have more than one @code{for} clause iterating over symbols, hash tables, -keymaps, overlays, or intervals in a given @code{loop}. Fortunately, +keymaps, overlays, or intervals in a given @code{cl-loop}. Fortunately, it would rarely if ever be useful to do so. It @emph{is} valid to mix one of these types of clauses with other clauses like @code{for ... to} or @code{while}. @@ -2423,10 +2424,10 @@ a second variable to the opposite part. @example -(loop for k being the hash-keys of h - using (hash-values v) - do - (message "key %S -> value %S" k v)) +(cl-loop for k being the hash-keys of h + using (hash-values v) + do + (message "key %S -> value %S" k v)) @end example @item for @var{var} being the key-codes of @var{keymap} @@ -2438,10 +2439,10 @@ together. @example -(loop for c being the key-codes of (current-local-map) - using (key-bindings b) - do - (message "key %S -> binding %S" c b)) +(cl-loop for c being the key-codes of (current-local-map) + using (key-bindings b) + do + (message "key %S -> binding %S" c b)) @end example @@ -2497,8 +2498,8 @@ these two loops are effectively the same: @example -(loop for x on my-list by 'cddr do ...) -(loop for x = my-list then (cddr x) while x do ...) +(cl-loop for x on my-list by 'cddr do ...) +(cl-loop for x = my-list then (cddr x) while x do ...) @end example Note that this type of @code{for} clause does not imply any sort @@ -2509,7 +2510,7 @@ the initial setting and for successive settings: @example -(loop for x = (random) when (> x 0) return x) +(cl-loop for x = (random) when (> x 0) return x) @end example @noindent @@ -2524,10 +2525,10 @@ and @code{cl-psetq}). @example -(loop for x below 5 for y = nil then x collect (list x y)) - @result{} ((0 nil) (1 1) (2 2) (3 3) (4 4)) -(loop for x below 5 and y = nil then x collect (list x y)) - @result{} ((0 nil) (1 0) (2 1) (3 2) (4 3)) +(cl-loop for x below 5 for y = nil then x collect (list x y)) + @result{} ((0 nil) (1 1) (2 2) (3 3) (4 4)) +(cl-loop for x below 5 and y = nil then x collect (list x y)) + @result{} ((0 nil) (1 0) (2 1) (3 2) (4 3)) @end example @noindent @@ -2537,7 +2538,7 @@ based on the value of @code{x} left over from the previous time through the loop. -Another feature of the @code{loop} macro is @dfn{destructuring}, +Another feature of the @code{cl-loop} macro is @dfn{destructuring}, similar in concept to the destructuring provided by @code{defmacro}. The @var{var} part of any @code{for} clause can be given as a list of variables instead of a single variable. The values produced @@ -2545,8 +2546,8 @@ stored in the corresponding variables. @example -(loop for (x y) in '((2 3) (4 5) (6 7)) collect (+ x y)) - @result{} (5 9 13) +(cl-loop for (x y) in '((2 3) (4 5) (6 7)) collect (+ x y)) + @result{} (5 9 13) @end example In loop destructuring, if there are more values than variables @@ -2558,9 +2559,9 @@ to process an alist @example -(loop for (key . value) in '((a . 1) (b . 2)) - collect value) - @result{} (1 2) +(cl-loop for (key . value) in '((a . 1) (b . 2)) + collect value) + @result{} (1 2) @end example @node Iteration Clauses @@ -2577,8 +2578,8 @@ internal temporary variable. The loops @example -(loop repeat (1+ n) do ...) -(loop for temp to n do ...) +(cl-loop repeat (1+ n) do ...) +(cl-loop for temp to n do ...) @end example @noindent @@ -2593,7 +2594,7 @@ @example (while @var{cond} @var{forms}@dots{}) -(loop while @var{cond} do @var{forms}@dots{}) +(cl-loop while @var{cond} do @var{forms}@dots{}) @end example @item until @var{condition} @@ -2607,7 +2608,7 @@ were non-@code{nil}, the loop returns @code{t}: @example -(if (loop for size in size-list always (> size 10)) +(if (cl-loop for size in size-list always (> size 10)) (some-big-sizes) (no-big-sizes)) @end example @@ -2684,11 +2685,11 @@ accumulate into the same place. From Steele: @example -(loop for name in '(fred sue alice joe june) - for kids in '((bob ken) () () (kris sunshine) ()) - collect name - append kids) - @result{} (fred bob ken sue alice joe kris sunshine june) +(cl-loop for name in '(fred sue alice joe june) + for kids in '((bob ken) () () (kris sunshine) ()) + collect name + append kids) + @result{} (fred bob ken sue alice joe kris sunshine june) @end example @node Other Clauses @@ -2704,17 +2705,17 @@ loops are basically equivalent: @example -(loop with x = 17 do ...) -(let ((x 17)) (loop do ...)) -(loop for x = 17 then x do ...) +(cl-loop with x = 17 do ...) +(let ((x 17)) (cl-loop do ...)) +(cl-loop for x = 17 then x do ...) @end example Naturally, the variable @var{var} might be used for some purpose in the rest of the loop. For example: @example -(loop for x in my-list with res = nil do (push x res) - finally return res) +(cl-loop for x in my-list with res = nil do (push x res) + finally return res) @end example This loop inserts the elements of @code{my-list} at the front of @@ -2749,18 +2750,18 @@ @example (setq funny-numbers '(6 13 -1)) @result{} (6 13 -1) -(loop for x below 10 - if (oddp x) - collect x into odds - and if (memq x funny-numbers) return (cdr it) end - else - collect x into evens - finally return (vector odds evens)) - @result{} [(1 3 5 7 9) (0 2 4 6 8)] +(cl-loop for x below 10 + if (oddp x) + collect x into odds + and if (memq x funny-numbers) return (cdr it) end + else + collect x into evens + finally return (vector odds evens)) + @result{} [(1 3 5 7 9) (0 2 4 6 8)] (setq funny-numbers '(6 7 13 -1)) @result{} (6 7 13 -1) -(loop <@r{same thing again}>) - @result{} (13 -1) +(cl-loop <@r{same thing again}>) + @result{} (13 -1) @end example Note the use of @code{and} to put two clauses into the ``then'' @@ -2828,7 +2829,7 @@ efficiently, though. @end table -While there is no high-level way to add user extensions to @code{loop} +While there is no high-level way to add user extensions to @code{cl-loop} (comparable to @code{defsetf} for @code{setf}, say), this package does offer two properties called @code{cl-loop-handler} and @code{cl-loop-for-handler} which are functions to be called when @@ -2836,7 +2837,7 @@ @code{for} clause, respectively. Consult the source code in file @file{cl-macs.el} for details. -This package's @code{loop} macro is compatible with that of Common +This package's @code{cl-loop} macro is compatible with that of Common Lisp, except that a few features are not implemented: @code{loop-finish} and data-type specifiers. Naturally, the @code{for} clauses which iterate over keymaps, overlays, intervals, frames, windows, and @@ -2851,14 +2852,14 @@ package makes no attempt to emulate Common Lisp multiple return values; Emacs versions of Common Lisp functions that return more than one value either return just the first value (as in -@code{compiler-macroexpand}) or return a list of values (as in +@code{cl-compiler-macroexpand}) or return a list of values (as in @code{get-setf-method}). This package @emph{does} define placeholders for the Common Lisp functions that work with multiple values, but in Emacs Lisp these functions simply operate on lists instead. The @code{values} form, for example, is a synonym for @code{list} in Emacs. -@defspec multiple-value-bind (var@dots{}) values-form forms@dots{} +@defspec cl-multiple-value-bind (var@dots{}) values-form forms@dots{} This form evaluates @var{values-form}, which must return a list of values. It then binds the @var{var}s to these respective values, as if by @code{let}, and then executes the body @var{forms}. @@ -2867,18 +2868,18 @@ values, the excess values are ignored. @end defspec -@defspec multiple-value-setq (var@dots{}) form +@defspec cl-multiple-value-setq (var@dots{}) form This form evaluates @var{form}, which must return a list of values. It then sets the @var{var}s to these respective values, as if by @code{setq}. Extra @var{var}s or values are treated the same as -in @code{multiple-value-bind}. +in @code{cl-multiple-value-bind}. @end defspec The older Quiroz package attempted a more faithful (but still imperfect) emulation of Common Lisp multiple values. The old method ``usually'' simulated true multiple values quite well, but under certain circumstances would leave spurious return -values in memory where a later, unrelated @code{multiple-value-bind} +values in memory where a later, unrelated @code{cl-multiple-value-bind} form would see them. Since a perfect emulation is not feasible in Emacs Lisp, this @@ -2897,7 +2898,7 @@ Destructuring is made available to the user by way of the following macro: -@defspec destructuring-bind arglist expr forms@dots{} +@defspec cl-destructuring-bind arglist expr forms@dots{} This macro expands to code which executes @var{forms}, with the variables in @var{arglist} bound to the list of values returned by @var{expr}. The @var{arglist} can include all @@ -2908,11 +2909,11 @@ or with incorrect keyword arguments. @end defspec -This package also includes the Common Lisp @code{define-compiler-macro} +This package also includes the Common Lisp @code{cl-define-compiler-macro} facility, which allows you to define compile-time expansions and optimizations for your functions. -@defspec define-compiler-macro name arglist forms@dots{} +@defspec cl-define-compiler-macro name arglist forms@dots{} This form is similar to @code{defmacro}, except that it only expands calls to @var{name} at compile-time; calls processed by the Lisp interpreter are not expanded, nor are they expanded by the @@ -2930,25 +2931,25 @@ appears as a standard part of this package: @example -(define-compiler-macro member* (&whole form a list &rest keys) - (if (and (null keys) - (eq (car-safe a) 'quote) - (not (floatp-safe (cadr a)))) - (list 'memq a list) - form)) +(cl-define-compiler-macro cl-member (&whole form a list &rest keys) + (if (and (null keys) + (eq (car-safe a) 'quote) + (not (floatp-safe (cadr a)))) + (list 'memq a list) + form)) @end example @noindent -This definition causes @code{(member* @var{a} @var{list})} to change +This definition causes @code{(cl-member @var{a} @var{list})} to change to a call to the faster @code{memq} in the common case where @var{a} is a non-floating-point constant; if @var{a} is anything else, or if there are any keyword arguments in the call, then the original -@code{member*} call is left intact. (The actual compiler macro -for @code{member*} optimizes a number of other cases, including +@code{cl-member} call is left intact. (The actual compiler macro +for @code{cl-member} optimizes a number of other cases, including common @code{:test} predicates.) @end defspec -@defun compiler-macroexpand form +@defun cl-compiler-macroexpand form This function is analogous to @code{macroexpand}, except that it expands compiler macros rather than regular macros. It returns @var{form} unchanged if it is not a call to a function for which @@ -2958,8 +2959,8 @@ for which no further expansion is possible. @end defun -@xref{Macro Bindings}, for descriptions of the @code{macrolet} -and @code{symbol-macrolet} forms for making ``local'' macro +@xref{Macro Bindings}, for descriptions of the @code{cl-macrolet} +and @code{cl-symbol-macrolet} forms for making ``local'' macro definitions. @node Declarations @@ -2971,8 +2972,8 @@ about the types of data that will be stored in particular variables, and about the ways those variables and functions will be used. This package defines versions of all the Common Lisp declaration forms: -@code{declare}, @code{locally}, @code{proclaim}, @code{declaim}, -and @code{the}. +@code{cl-declare}, @code{cl-locally}, @code{cl-proclaim}, @code{cl-declaim}, +and @code{cl-the}. Most of the Common Lisp declarations are not currently useful in Emacs Lisp, as the byte-code system provides little opportunity @@ -2982,53 +2983,53 @@ compiler is being used, however. Under the earlier non-optimizing compiler, these declarations will effectively be ignored. -@defun proclaim decl-spec +@defun cl-proclaim decl-spec This function records a ``global'' declaration specified by -@var{decl-spec}. Since @code{proclaim} is a function, @var{decl-spec} +@var{decl-spec}. Since @code{cl-proclaim} is a function, @var{decl-spec} is evaluated and thus should normally be quoted. @end defun -@defspec declaim decl-specs@dots{} -This macro is like @code{proclaim}, except that it takes any number +@defspec cl-declaim decl-specs@dots{} +This macro is like @code{cl-proclaim}, except that it takes any number of @var{decl-spec} arguments, and the arguments are unevaluated and -unquoted. The @code{declaim} macro also puts an @code{(eval-when +unquoted. The @code{cl-declaim} macro also puts an @code{(cl-eval-when (compile load eval) ...)} around the declarations so that they will be registered at compile-time as well as at run-time. (This is vital, since normally the declarations are meant to influence the way the -compiler treats the rest of the file that contains the @code{declaim} +compiler treats the rest of the file that contains the @code{cl-declaim} form.) @end defspec -@defspec declare decl-specs@dots{} +@defspec cl-declare decl-specs@dots{} This macro is used to make declarations within functions and other code. Common Lisp allows declarations in various locations, generally at the beginning of any of the many ``implicit @code{progn}s'' throughout Lisp syntax, such as function bodies, @code{let} bodies, -etc. Currently the only declaration understood by @code{declare} +etc. Currently the only declaration understood by @code{cl-declare} is @code{special}. @end defspec -@defspec locally declarations@dots{} forms@dots{} -In this package, @code{locally} is no different from @code{progn}. +@defspec cl-locally declarations@dots{} forms@dots{} +In this package, @code{cl-locally} is no different from @code{progn}. @end defspec -@defspec the type form -Type information provided by @code{the} is ignored in this package; -in other words, @code{(the @var{type} @var{form})} is equivalent +@defspec cl-the type form +Type information provided by @code{cl-the} is ignored in this package; +in other words, @code{(cl-the @var{type} @var{form})} is equivalent to @var{form}. Future versions of the optimizing byte-compiler may make use of this information. For example, @code{mapcar} can map over both lists and arrays. It is hard for the compiler to expand @code{mapcar} into an in-line loop unless it knows whether the sequence will be a list or an array ahead -of time. With @code{(mapcar 'car (the vector foo))}, a future +of time. With @code{(mapcar 'car (cl-the vector foo))}, a future compiler would have enough information to expand the loop in-line. For now, Emacs Lisp will treat the above code as exactly equivalent to @code{(mapcar 'car foo)}. @end defspec -Each @var{decl-spec} in a @code{proclaim}, @code{declaim}, or -@code{declare} should be a list beginning with a symbol that says +Each @var{decl-spec} in a @code{cl-proclaim}, @code{cl-declaim}, or +@code{cl-declare} should be a list beginning with a symbol that says what kind of declaration it is. This package currently understands @code{special}, @code{inline}, @code{notinline}, @code{optimize}, and @code{warn} declarations. (The @code{warn} declaration is an @@ -3045,16 +3046,16 @@ warnings for such references, since they could be typographical errors for references to local variables. -The declaration @code{(declare (special @var{var1} @var{var2}))} is +The declaration @code{(cl-declare (special @var{var1} @var{var2}))} is equivalent to @code{(defvar @var{var1}) (defvar @var{var2})} in the optimizing compiler, or to nothing at all in older compilers (which do not warn for non-local references). In top-level contexts, it is generally better to write -@code{(defvar @var{var})} than @code{(declaim (special @var{var}))}, +@code{(defvar @var{var})} than @code{(cl-declaim (special @var{var}))}, since @code{defvar} makes your intentions clearer. But the older byte compilers can not handle @code{defvar}s appearing inside of -functions, while @code{(declare (special @var{var}))} takes care +functions, while @code{(cl-declare (special @var{var}))} takes care to work correctly with all compilers. @item inline @@ -3072,8 +3073,8 @@ and declare it inline all at once. @example -(declaim (inline foo bar)) -(eval-when (compile load eval) (proclaim '(inline foo bar))) +(cl-declaim (inline foo bar)) +(cl-eval-when (compile load eval) (cl-proclaim '(inline foo bar))) (defsubst foo (...) ...) ; instead of defun @end example @@ -3083,10 +3084,10 @@ but it is impolite to use it to request inlining of an external function. -In Common Lisp, it is possible to use @code{(declare (inline @dots{}))} +In Common Lisp, it is possible to use @code{(cl-declare (inline @dots{}))} before a particular call to a function to cause just that call to be inlined; the current byte compilers provide no way to implement -this, so @code{(declare (inline @dots{}))} is currently ignored by +this, so @code{(cl-declare (inline @dots{}))} is currently ignored by this package. @item notinline @@ -3107,6 +3108,7 @@ The default level for both qualities is 1. In this package, with the optimizing compiler, the +@c FIXME does not exist? @code{speed} quality is tied to the @code{byte-compile-optimize} flag, which is set to @code{nil} for @code{(speed 0)} and to @code{t} for higher settings; and the @code{safety} quality is @@ -3125,10 +3127,10 @@ just because of an error in a fully-optimized Lisp program. The @code{optimize} declaration is normally used in a top-level -@code{proclaim} or @code{declaim} in a file; Common Lisp allows -it to be used with @code{declare} to set the level of optimization +@code{cl-proclaim} or @code{cl-declaim} in a file; Common Lisp allows +it to be used with @code{cl-declare} to set the level of optimization locally for a given form, but this will not work correctly with the -current version of the optimizing compiler. (The @code{declare} +current version of the optimizing compiler. (The @code{cl-declare} will set the new optimization level, but that level will not automatically be unset after the enclosing form is done.) @@ -3152,8 +3154,8 @@ missing from Emacs Lisp. @menu -* Property Lists:: @code{get*}, @code{remprop}, @code{getf}, @code{remf}. -* Creating Symbols:: @code{gensym}, @code{gentemp}. +* Property Lists:: @code{cl-get}, @code{cl-remprop}, @code{cl-getf}, @code{cl-remf}. +* Creating Symbols:: @code{cl-gensym}, @code{cl-gentemp}. @end menu @node Property Lists @@ -3165,18 +3167,18 @@ There are also functions for working with property lists as first-class data structures not attached to particular symbols. -@defun get* symbol property &optional default +@defun cl-get symbol property &optional default This function is like @code{get}, except that if the property is not found, the @var{default} argument provides the return value. (The Emacs Lisp @code{get} function always uses @code{nil} as -the default; this package's @code{get*} is equivalent to Common +the default; this package's @code{cl-get} is equivalent to Common Lisp's @code{get}.) -The @code{get*} function is @code{setf}-able; when used in this +The @code{cl-get} function is @code{setf}-able; when used in this fashion, the @var{default} argument is allowed but ignored. @end defun -@defun remprop symbol property +@defun cl-remprop symbol property This function removes the entry for @var{property} from the property list of @var{symbol}. It returns a true value if the property was indeed found and removed, or @code{nil} if there was no such property. @@ -3184,10 +3186,10 @@ since @code{get} did not allow a @var{default}, it was very difficult to distinguish between a missing property and a property whose value was @code{nil}; thus, setting a property to @code{nil} was close -enough to @code{remprop} for most purposes.) +enough to @code{cl-remprop} for most purposes.) @end defun -@defun getf place property &optional default +@defun cl-getf place property &optional default This function scans the list @var{place} as if it were a property list, i.e., a list of alternating property names and values. If an even-numbered element of @var{place} is found which is @code{eq} @@ -3198,7 +3200,7 @@ In particular, @example -(get sym prop) @equiv{} (getf (symbol-plist sym) prop) +(get sym prop) @equiv{} (cl-get (symbol-plist sym) prop) @end example It is valid to use @code{getf} as a @code{setf} place, in which case @@ -3209,25 +3211,26 @@ pair onto the list if the property is not yet present. @example -(put sym prop val) @equiv{} (setf (getf (symbol-plist sym) prop) val) +(put sym prop val) @equiv{} (setf (cl-get (symbol-plist sym) prop) val) @end example -The @code{get} and @code{get*} functions are also @code{setf}-able. +The @code{get} and @code{cl-get} functions are also @code{setf}-able. The fact that @code{default} is ignored can sometimes be useful: @example -(incf (get* 'foo 'usage-count 0)) +(cl-incf (cl-get 'foo 'usage-count 0)) @end example Here, symbol @code{foo}'s @code{usage-count} property is incremented if it exists, or set to 1 (an incremented 0) otherwise. +@c FIXME cl-getf? When not used as a @code{setf} form, @code{getf} is just a regular function and its @var{place} argument can actually be any Lisp expression. @end defun -@defspec remf place property +@defspec cl-remf place property This macro removes the property-value pair for @var{property} from the property list stored at @var{place}, which is any @code{setf}-able place expression. It returns true if the property was found. Note @@ -3248,7 +3251,7 @@ These functions create unique symbols, typically for use as temporary variables. -@defun gensym &optional x +@defun cl-gensym &optional x This function creates a new, uninterned symbol (using @code{make-symbol}) with a unique name. (The name of an uninterned symbol is relevant only if the symbol is printed.) By default, the name is generated @@ -3260,20 +3263,20 @@ code. @end defun -@defvar *gensym-counter* -This variable holds the counter used to generate @code{gensym} names. -It is incremented after each use by @code{gensym}. In Common Lisp +@defvar cl--gensym-counter +This variable holds the counter used to generate @code{cl-gensym} names. +It is incremented after each use by @code{cl-gensym}. In Common Lisp this is initialized with 0, but this package initializes it with a random (time-dependent) value to avoid trouble when two files that -each used @code{gensym} in their compilation are loaded together. +each used @code{cl-gensym} in their compilation are loaded together. (Uninterned symbols become interned when the compiler writes them out to a file and the Emacs loader loads them, so their names have to be treated a bit more carefully than in Common Lisp where uninterned symbols remain uninterned after loading.) @end defvar -@defun gentemp &optional x -This function is like @code{gensym}, except that it produces a new +@defun cl-gentemp &optional x +This function is like @code{cl-gensym}, except that it produces a new @emph{interned} symbol. If the symbol that is generated already exists, the function keeps incrementing the counter and trying again until a new symbol is generated. @@ -3294,10 +3297,10 @@ which were left out of Emacs Lisp. @menu -* Predicates on Numbers:: @code{plusp}, @code{oddp}, @code{floatp-safe}, etc. -* Numerical Functions:: @code{abs}, @code{floor*}, etc. -* Random Numbers:: @code{random*}, @code{make-random-state}. -* Implementation Parameters:: @code{most-positive-float}. +* Predicates on Numbers:: @code{cl-plusp}, @code{cl-oddp}, @code{cl-floatp-safe}, etc. +* Numerical Functions:: @code{abs}, @code{cl-floor}, etc. +* Random Numbers:: @code{cl-random}, @code{cl-make-random-state}. +* Implementation Parameters:: @code{cl-most-positive-float}. @end menu @iftex @@ -3311,27 +3314,27 @@ These functions return @code{t} if the specified condition is true of the numerical argument, or @code{nil} otherwise. -@defun plusp number +@defun cl-plusp number This predicate tests whether @var{number} is positive. It is an error if the argument is not a number. @end defun -@defun minusp number +@defun cl-minusp number This predicate tests whether @var{number} is negative. It is an error if the argument is not a number. @end defun -@defun oddp integer +@defun cl-oddp integer This predicate tests whether @var{integer} is odd. It is an error if the argument is not an integer. @end defun -@defun evenp integer +@defun cl-evenp integer This predicate tests whether @var{integer} is even. It is an error if the argument is not an integer. @end defun -@defun floatp-safe object +@defun cl-floatp-safe object This predicate tests whether @var{object} is a floating-point number. On systems that support floating-point, this is equivalent to @code{floatp}. On other systems, this always returns @code{nil}. @@ -3347,30 +3350,26 @@ @noindent These functions perform various arithmetic operations on numbers. -@defun gcd &rest integers +@defun cl-gcd &rest integers This function returns the Greatest Common Divisor of the arguments. For one argument, it returns the absolute value of that argument. For zero arguments, it returns zero. @end defun -@defun lcm &rest integers +@defun cl-lcm &rest integers This function returns the Least Common Multiple of the arguments. For one argument, it returns the absolute value of that argument. For zero arguments, it returns one. @end defun -@defun isqrt integer +@defun cl-isqrt integer This function computes the ``integer square root'' of its integer argument, i.e., the greatest integer less than or equal to the true square root of the argument. @end defun -@defun floor* number &optional divisor -This function implements the Common Lisp @code{floor} function. -It is called @code{floor*} to avoid name conflicts with the -simpler @code{floor} function built-in to Emacs. - -With one argument, @code{floor*} returns a list of two numbers: +@defun cl-floor number &optional divisor +With one argument, @code{cl-floor} returns a list of two numbers: The argument rounded down (toward minus infinity) to an integer, and the ``remainder'' which would have to be added back to the first return value to yield the argument again. If the argument @@ -3379,37 +3378,37 @@ result is a Lisp integer and the second is a Lisp float between 0 (inclusive) and 1 (exclusive). -With two arguments, @code{floor*} divides @var{number} by +With two arguments, @code{cl-floor} divides @var{number} by @var{divisor}, and returns the floor of the quotient and the corresponding remainder as a list of two numbers. If -@code{(floor* @var{x} @var{y})} returns @code{(@var{q} @var{r})}, +@code{(cl-floor @var{x} @var{y})} returns @code{(@var{q} @var{r})}, then @code{@var{q}*@var{y} + @var{r} = @var{x}}, with @var{r} between 0 (inclusive) and @var{r} (exclusive). Also, note -that @code{(floor* @var{x})} is exactly equivalent to -@code{(floor* @var{x} 1)}. +that @code{(cl-floor @var{x})} is exactly equivalent to +@code{(cl-floor @var{x} 1)}. This function is entirely compatible with Common Lisp's @code{floor} function, except that it returns the two results in a list since Emacs Lisp does not support multiple-valued functions. @end defun -@defun ceiling* number &optional divisor +@defun cl-ceiling number &optional divisor This function implements the Common Lisp @code{ceiling} function, which is analogous to @code{floor} except that it rounds the argument or quotient of the arguments up toward plus infinity. The remainder will be between 0 and minus @var{r}. @end defun -@defun truncate* number &optional divisor +@defun cl-truncate number &optional divisor This function implements the Common Lisp @code{truncate} function, which is analogous to @code{floor} except that it rounds the argument or quotient of the arguments toward zero. Thus it is -equivalent to @code{floor*} if the argument or quotient is -positive, or to @code{ceiling*} otherwise. The remainder has +equivalent to @code{cl-floor} if the argument or quotient is +positive, or to @code{cl-ceiling} otherwise. The remainder has the same sign as @var{number}. @end defun -@defun round* number &optional divisor +@defun cl-round number &optional divisor This function implements the Common Lisp @code{round} function, which is analogous to @code{floor} except that it rounds the argument or quotient of the arguments to the nearest integer. @@ -3417,21 +3416,22 @@ halfway between two integers), it rounds to the even integer. @end defun -@defun mod* number divisor -This function returns the same value as the second return value -of @code{floor}. -@end defun - -@defun rem* number divisor -This function returns the same value as the second return value -of @code{truncate}. -@end defun - +@defun cl-mod number divisor +This function returns the same value as the second return value +of @code{cl-floor}. +@end defun + +@defun cl-rem number divisor +This function returns the same value as the second return value +of @code{cl-truncate}. +@end defun + +@c FIXME this stuff is probably no longer of interest to anyone. These definitions are compatible with those in the Quiroz -@file{cl.el} package, except that this package appends @samp{*} -to certain function names to avoid conflicts with existing -Emacs functions, and that the mechanism for returning -multiple values is different. +@file{cl.el} package, except that +@c this package appends @samp{*} to certain function names to avoid +@c conflicts with existing Emacs functions, and that +the mechanism for returning multiple values is different. @iftex @secno=8 @@ -3447,7 +3447,7 @@ random numbers than the simple generators supplied by many operating systems. -@defun random* number &optional state +@defun cl-random number &optional state This function returns a random nonnegative number less than @var{number}, and of the same type (either integer or floating-point). The @var{state} argument should be a @code{random-state} object @@ -3458,21 +3458,21 @@ @code{random-state} object. @end defun -@defvar *random-state* +@defvar cl--random-state This variable contains the system ``default'' @code{random-state} -object, used for calls to @code{random*} that do not specify an +object, used for calls to @code{cl-random} that do not specify an alternative state object. Since any number of programs in the -Emacs process may be accessing @code{*random-state*} in interleaved +Emacs process may be accessing @code{cl--random-state} in interleaved fashion, the sequence generated from this variable will be irreproducible for all intents and purposes. @end defvar -@defun make-random-state &optional state +@defun cl-make-random-state &optional state This function creates or copies a @code{random-state} object. If @var{state} is omitted or @code{nil}, it returns a new copy of -@code{*random-state*}. This is a copy in the sense that future -sequences of calls to @code{(random* @var{n})} and -@code{(random* @var{n} @var{s})} (where @var{s} is the new +@code{cl--random-state}. This is a copy in the sense that future +sequences of calls to @code{(cl-random @var{n})} and +@code{(cl-random @var{n} @var{s})} (where @var{s} is the new random-state object) will return identical sequences of random numbers. @@ -3487,13 +3487,13 @@ It is valid to print a @code{random-state} object to a buffer or file and later read it back with @code{read}. If a program wishes to use a sequence of pseudo-random numbers which can be reproduced -later for debugging, it can call @code{(make-random-state t)} to +later for debugging, it can call @code{(cl-make-random-state t)} to get a new sequence, then print this sequence to a file. When the program is later rerun, it can read the original run's random-state from the file. @end defun -@defun random-state-p object +@defun cl-random-state-p object This predicate returns @code{t} if @var{object} is a @code{random-state} object, or @code{nil} otherwise. @end defun @@ -3512,7 +3512,7 @@ @defun cl-float-limits This function makes sure that the Common Lisp floating-point parameters -like @code{most-positive-float} have been initialized. Until it is +like @code{cl-most-positive-float} have been initialized. Until it is called, these parameters will be @code{nil}. If this version of Emacs does not support floats, the parameters will remain @code{nil}. If the parameters have already been initialized, the function returns @@ -3530,50 +3530,50 @@ floating-point precision, so this package omits the precision word from the constants' names. -@defvar most-positive-float +@defvar cl-most-positive-float This constant equals the largest value a Lisp float can hold. For those systems whose arithmetic supports infinities, this is the largest @emph{finite} value. For IEEE machines, the value is approximately @code{1.79e+308}. @end defvar -@defvar most-negative-float +@defvar cl-most-negative-float This constant equals the most-negative value a Lisp float can hold. -(It is assumed to be equal to @code{(- most-positive-float)}.) +(It is assumed to be equal to @code{(- cl-most-positive-float)}.) @end defvar -@defvar least-positive-float +@defvar cl-least-positive-float This constant equals the smallest Lisp float value greater than zero. For IEEE machines, it is about @code{4.94e-324} if denormals are supported or @code{2.22e-308} if not. @end defvar -@defvar least-positive-normalized-float +@defvar cl-least-positive-normalized-float This constant equals the smallest @emph{normalized} Lisp float greater than zero, i.e., the smallest value for which IEEE denormalization will not result in a loss of precision. For IEEE machines, this value is about @code{2.22e-308}. For machines that do not support the concept of denormalization and gradual underflow, this constant -will always equal @code{least-positive-float}. -@end defvar - -@defvar least-negative-float -This constant is the negative counterpart of @code{least-positive-float}. -@end defvar - -@defvar least-negative-normalized-float +will always equal @code{cl-least-positive-float}. +@end defvar + +@defvar cl-least-negative-float +This constant is the negative counterpart of @code{cl-least-positive-float}. +@end defvar + +@defvar cl-least-negative-normalized-float This constant is the negative counterpart of -@code{least-positive-normalized-float}. +@code{cl-least-positive-normalized-float}. @end defvar -@defvar float-epsilon +@defvar cl-float-epsilon This constant is the smallest positive Lisp float that can be added to 1.0 to produce a distinct value. Adding a smaller number to 1.0 will yield 1.0 again due to roundoff. For IEEE machines, epsilon is about @code{2.22e-16}. @end defvar -@defvar float-negative-epsilon +@defvar cl-float-negative-epsilon This is the smallest positive value that can be subtracted from 1.0 to produce a distinct value. For IEEE machines, it is about @code{1.11e-16}. @@ -3590,10 +3590,10 @@ @menu * Sequence Basics:: Arguments shared by all sequence functions. -* Mapping over Sequences:: @code{mapcar*}, @code{mapcan}, @code{map}, @code{every}, etc. -* Sequence Functions:: @code{subseq}, @code{remove*}, @code{substitute}, etc. -* Searching Sequences:: @code{find}, @code{position}, @code{count}, @code{search}, etc. -* Sorting Sequences:: @code{sort*}, @code{stable-sort}, @code{merge}. +* Mapping over Sequences:: @code{cl-mapcar}, @code{cl-mapcan}, @code{cl-map}, @code{cl-every}, etc. +* Sequence Functions:: @code{cl-subseq}, @code{cl-remove}, @code{cl-substitute}, etc. +* Searching Sequences:: @code{cl-find}, @code{cl-position}, @code{cl-count}, @code{cl-search}, etc. +* Sorting Sequences:: @code{cl-sort}, @code{cl-stable-sort}, @code{cl-merge}. @end menu @node Sequence Basics @@ -3607,7 +3607,7 @@ The @code{:key} argument should be passed either @code{nil}, or a function of one argument. This key function is used as a filter through which the elements of the sequence are seen; for example, -@code{(find x y :key 'car)} is similar to @code{(assoc* x y)}: +@code{(cl-find x y :key 'car)} is similar to @code{(cl-assoc x y)}: It searches for an element of the list whose @code{car} equals @code{x}, rather than for an element which equals @code{x} itself. If @code{:key} is omitted or @code{nil}, the filter is effectively @@ -3632,7 +3632,7 @@ (or false in the case of @code{-if-not}). For example: @example -(remove* 0 seq :test '=) @equiv{} (remove-if 'zerop seq) +(cl-remove 0 seq :test '=) @equiv{} (cl-remove-if 'zerop seq) @end example @noindent @@ -3662,14 +3662,14 @@ on side effects of these functions. For example, @code{:from-end} may cause the sequence to be scanned actually in reverse, or it may be scanned forwards but computing a result ``as if'' it were scanned -backwards. (Some functions, like @code{mapcar*} and @code{every}, +backwards. (Some functions, like @code{cl-mapcar} and @code{cl-every}, @emph{do} specify exactly the order in which the function is called so side effects are perfectly acceptable in those cases.) Strings may contain ``text properties'' as well as character data. Except as noted, it is undefined whether or not text properties are preserved by sequence functions. For -example, @code{(remove* ?A @var{str})} may or may not preserve +example, @code{(cl-remove ?A @var{str})} may or may not preserve the properties of the characters copied from @var{str} into the result. @@ -3681,7 +3681,7 @@ of lists or arrays. They are all variations on the theme of the built-in function @code{mapcar}. -@defun mapcar* function seq &rest more-seqs +@defun cl-mapcar function seq &rest more-seqs This function calls @var{function} on successive parallel sets of elements from its argument sequences. Given a single @var{seq} argument it is equivalent to @code{mapcar}; given @var{n} sequences, @@ -3694,86 +3694,87 @@ Common Lisp's @code{mapcar} accepts multiple arguments but works only on lists; Emacs Lisp's @code{mapcar} accepts a single sequence -argument. This package's @code{mapcar*} works as a compatible +argument. This package's @code{cl-mapcar} works as a compatible superset of both. @end defun -@defun map result-type function seq &rest more-seqs +@defun cl-map result-type function seq &rest more-seqs This function maps @var{function} over the argument sequences, -just like @code{mapcar*}, but it returns a sequence of type +just like @code{cl-mapcar}, but it returns a sequence of type @var{result-type} rather than a list. @var{result-type} must be one of the following symbols: @code{vector}, @code{string}, @code{list} (in which case the effect is the same as for @code{mapcar*}), or @code{nil} (in which case the results are -thrown away and @code{map} returns @code{nil}). +thrown away and @code{cl-map} returns @code{nil}). @end defun -@defun maplist function list &rest more-lists +@defun cl-maplist function list &rest more-lists This function calls @var{function} on each of its argument lists, then on the @code{cdr}s of those lists, and so on, until the shortest list runs out. The results are returned in the form -of a list. Thus, @code{maplist} is like @code{mapcar*} except +of a list. Thus, @code{cl-maplist} is like @code{cl-mapcar} except that it passes in the list pointers themselves rather than the @code{car}s of the advancing pointers. @end defun +@c FIXME does not exist? @defun cl-mapc function seq &rest more-seqs -This function is like @code{mapcar*}, except that the values returned +This function is like @code{cl-mapcar}, except that the values returned by @var{function} are ignored and thrown away rather than being collected into a list. The return value of @code{cl-mapc} is @var{seq}, the first sequence. This function is more general than the Emacs primitive @code{mapc}. @end defun -@defun mapl function list &rest more-lists -This function is like @code{maplist}, except that it throws away +@defun cl-mapl function list &rest more-lists +This function is like @code{cl-maplist}, except that it throws away the values returned by @var{function}. @end defun -@defun mapcan function seq &rest more-seqs -This function is like @code{mapcar*}, except that it concatenates +@defun cl-mapcan function seq &rest more-seqs +This function is like @code{cl-mapcar}, except that it concatenates the return values (which must be lists) using @code{nconc}, rather than simply collecting them into a list. @end defun -@defun mapcon function list &rest more-lists -This function is like @code{maplist}, except that it concatenates +@defun cl-mapcon function list &rest more-lists +This function is like @code{cl-maplist}, except that it concatenates the return values using @code{nconc}. @end defun -@defun some predicate seq &rest more-seqs +@defun cl-some predicate seq &rest more-seqs This function calls @var{predicate} on each element of @var{seq} in turn; if @var{predicate} returns a non-@code{nil} value, @code{some} returns that value, otherwise it returns @code{nil}. Given several sequence arguments, it steps through the sequences in parallel until the shortest one runs out, just as in -@code{mapcar*}. You can rely on the left-to-right order in which +@code{cl-mapcar}. You can rely on the left-to-right order in which the elements are visited, and on the fact that mapping stops immediately as soon as @var{predicate} returns non-@code{nil}. @end defun -@defun every predicate seq &rest more-seqs +@defun cl-every predicate seq &rest more-seqs This function calls @var{predicate} on each element of the sequence(s) in turn; it returns @code{nil} as soon as @var{predicate} returns @code{nil} for any element, or @code{t} if the predicate was true for all elements. @end defun -@defun notany predicate seq &rest more-seqs +@defun cl-notany predicate seq &rest more-seqs This function calls @var{predicate} on each element of the sequence(s) in turn; it returns @code{nil} as soon as @var{predicate} returns a non-@code{nil} value for any element, or @code{t} if the predicate was @code{nil} for all elements. @end defun -@defun notevery predicate seq &rest more-seqs +@defun cl-notevery predicate seq &rest more-seqs This function calls @var{predicate} on each element of the sequence(s) in turn; it returns a non-@code{nil} value as soon as @var{predicate} returns @code{nil} for any element, or @code{t} if the predicate was true for all elements. @end defun -@defun reduce function seq @t{&key :from-end :start :end :initial-value :key} +@defun cl-reduce function seq @t{&key :from-end :start :end :initial-value :key} This function combines the elements of @var{seq} using an associative binary operation. Suppose @var{function} is @code{*} and @var{seq} is the list @code{(2 3 4 5)}. The first two elements of the list are @@ -3781,16 +3782,16 @@ element, @code{(* 6 4) = 24}, and that is combined with the final element: @code{(* 24 5) = 120}. Note that the @code{*} function happens to be self-reducing, so that @code{(* 2 3 4 5)} has the same effect as -an explicit call to @code{reduce}. +an explicit call to @code{cl-reduce}. If @code{:from-end} is true, the reduction is right-associative instead of left-associative: @example -(reduce '- '(1 2 3 4)) - @equiv{} (- (- (- 1 2) 3) 4) @result{} -8 -(reduce '- '(1 2 3 4) :from-end t) - @equiv{} (- 1 (- 2 (- 3 4))) @result{} -2 +(cl-reduce '- '(1 2 3 4)) + @equiv{} (- (- (- 1 2) 3) 4) @result{} -8 +(cl-reduce '- '(1 2 3 4) :from-end t) + @equiv{} (- 1 (- 2 (- 3 4))) @result{} -2 @end example If @code{:key} is specified, it is a function of one argument which @@ -3807,7 +3808,7 @@ @end defun All of these mapping operations can be expressed conveniently in -terms of the @code{loop} macro. In compiled code, @code{loop} will +terms of the @code{cl-loop} macro. In compiled code, @code{cl-loop} will be faster since it generates the loop as in-line code with no function calls. @@ -3818,7 +3819,7 @@ This section describes a number of Common Lisp functions for operating on sequences. -@defun subseq sequence start &optional end +@defun cl-subseq sequence start &optional end This function returns a given subsequence of the argument @var{sequence}, which may be a list, string, or vector. The indices @var{start} and @var{end} must be in range, and @@ -3830,30 +3831,30 @@ As an extension to Common Lisp, @var{start} and/or @var{end} may be negative, in which case they represent a distance back from the end of the sequence. This is for compatibility with -Emacs's @code{substring} function. Note that @code{subseq} is +Emacs's @code{substring} function. Note that @code{cl-subseq} is the @emph{only} sequence function that allows negative @var{start} and @var{end}. -You can use @code{setf} on a @code{subseq} form to replace a +You can use @code{setf} on a @code{cl-subseq} form to replace a specified range of elements with elements from another sequence. -The replacement is done as if by @code{replace}, described below. +The replacement is done as if by @code{cl-replace}, described below. @end defun -@defun concatenate result-type &rest seqs +@defun cl-concatenate result-type &rest seqs This function concatenates the argument sequences together to form a result sequence of type @var{result-type}, one of the symbols @code{vector}, @code{string}, or @code{list}. The arguments are always copied, even in cases such as -@code{(concatenate 'list '(1 2 3))} where the result is +@code{(cl-concatenate 'list '(1 2 3))} where the result is identical to an argument. @end defun -@defun fill seq item @t{&key :start :end} +@defun cl-fill seq item @t{&key :start :end} This function fills the elements of the sequence (or the specified part of the sequence) with the value @var{item}. @end defun -@defun replace seq1 seq2 @t{&key :start1 :end1 :start2 :end2} +@defun cl-replace seq1 seq2 @t{&key :start1 :end1 :start2 :end2} This function copies part of @var{seq2} into part of @var{seq1}. The sequence @var{seq1} is not stretched or resized; the amount of data copied is simply the shorter of the source and destination @@ -3867,7 +3868,7 @@ is undefined. @end defun -@defun remove* item seq @t{&key :test :test-not :key :count :start :end :from-end} +@defun cl-remove item seq @t{&key :test :test-not :key :count :start :end :from-end} This returns a copy of @var{seq} with all elements matching @var{item} removed. The result may share storage with or be @code{eq} to @var{seq} in some circumstances, but the original @@ -3884,25 +3885,25 @@ if @var{count} was also specified). @end defun -@defun delete* item seq @t{&key :test :test-not :key :count :start :end :from-end} +@defun cl-delete item seq @t{&key :test :test-not :key :count :start :end :from-end} This deletes all elements of @var{seq} which match @var{item}. It is a destructive operation. Since Emacs Lisp does not support -stretchable strings or vectors, this is the same as @code{remove*} -for those sequence types. On lists, @code{remove*} will copy the +stretchable strings or vectors, this is the same as @code{cl-remove} +for those sequence types. On lists, @code{cl-remove} will copy the list if necessary to preserve the original list, whereas -@code{delete*} will splice out parts of the argument list. +@code{cl-delete} will splice out parts of the argument list. Compare @code{append} and @code{nconc}, which are analogous non-destructive and destructive list operations in Emacs Lisp. @end defun -@findex remove-if -@findex remove-if-not -@findex delete-if -@findex delete-if-not -The predicate-oriented functions @code{remove-if}, @code{remove-if-not}, -@code{delete-if}, and @code{delete-if-not} are defined similarly. +@findex cl-remove-if +@findex cl-remove-if-not +@findex cl-delete-if +@findex cl-delete-if-not +The predicate-oriented functions @code{cl-remove-if}, @code{cl-remove-if-not}, +@code{cl-delete-if}, and @code{cl-delete-if-not} are defined similarly. -@defun remove-duplicates seq @t{&key :test :test-not :key :start :end :from-end} +@defun cl-remove-duplicates seq @t{&key :test :test-not :key :start :end :from-end} This function returns a copy of @var{seq} with duplicate elements removed. Specifically, if two elements from the sequence match according to the @code{:test}, @code{:test-not}, and @code{:key} @@ -3912,30 +3913,30 @@ examined or removed. @end defun -@defun delete-duplicates seq @t{&key :test :test-not :key :start :end :from-end} +@defun cl-delete-duplicates seq @t{&key :test :test-not :key :start :end :from-end} This function deletes duplicate elements from @var{seq}. It is -a destructive version of @code{remove-duplicates}. +a destructive version of @code{cl-remove-duplicates}. @end defun -@defun substitute new old seq @t{&key :test :test-not :key :count :start :end :from-end} +@defun cl-substitute new old seq @t{&key :test :test-not :key :count :start :end :from-end} This function returns a copy of @var{seq}, with all elements matching @var{old} replaced with @var{new}. The @code{:count}, @code{:start}, @code{:end}, and @code{:from-end} arguments may be used to limit the number of substitutions made. @end defun -@defun nsubstitute new old seq @t{&key :test :test-not :key :count :start :end :from-end} -This is a destructive version of @code{substitute}; it performs +@defun cl-nsubstitute new old seq @t{&key :test :test-not :key :count :start :end :from-end} +This is a destructive version of @code{cl-substitute}; it performs the substitution using @code{setcar} or @code{aset} rather than by returning a changed copy of the sequence. @end defun -@findex substitute-if -@findex substitute-if-not -@findex nsubstitute-if -@findex nsubstitute-if-not -The @code{substitute-if}, @code{substitute-if-not}, @code{nsubstitute-if}, -and @code{nsubstitute-if-not} functions are defined similarly. For +@findex cl-substitute-if +@findex cl-substitute-if-not +@findex cl-nsubstitute-if +@findex cl-nsubstitute-if-not +The @code{cl-substitute-if}, @code{cl-substitute-if-not}, @code{cl-nsubstitute-if}, +and @code{cl-nsubstitute-if-not} functions are defined similarly. For these, a @var{predicate} is given in place of the @var{old} argument. @node Searching Sequences @@ -3943,9 +3944,9 @@ @noindent These functions search for elements or subsequences in a sequence. -(See also @code{member*} and @code{assoc*}; @pxref{Lists}.) +(See also @code{cl-member} and @code{cl-assoc}; @pxref{Lists}.) -@defun find item seq @t{&key :test :test-not :key :start :end :from-end} +@defun cl-find item seq @t{&key :test :test-not :key :start :end :from-end} This function searches @var{seq} for an element matching @var{item}. If it finds a match, it returns the matching element. Otherwise, it returns @code{nil}. It returns the leftmost match, unless @@ -3954,30 +3955,30 @@ limit the range of elements that are searched. @end defun -@defun position item seq @t{&key :test :test-not :key :start :end :from-end} -This function is like @code{find}, except that it returns the +@defun cl-position item seq @t{&key :test :test-not :key :start :end :from-end} +This function is like @code{cl-find}, except that it returns the integer position in the sequence of the matching item rather than the item itself. The position is relative to the start of the sequence as a whole, even if @code{:start} is non-zero. The function returns @code{nil} if no matching element was found. @end defun -@defun count item seq @t{&key :test :test-not :key :start :end} +@defun cl-count item seq @t{&key :test :test-not :key :start :end} This function returns the number of elements of @var{seq} which match @var{item}. The result is always a nonnegative integer. @end defun -@findex find-if -@findex find-if-not -@findex position-if -@findex position-if-not -@findex count-if -@findex count-if-not -The @code{find-if}, @code{find-if-not}, @code{position-if}, -@code{position-if-not}, @code{count-if}, and @code{count-if-not} +@findex cl-find-if +@findex cl-find-if-not +@findex cl-position-if +@findex cl-position-if-not +@findex cl-count-if +@findex cl-count-if-not +The @code{cl-find-if}, @code{cl-find-if-not}, @code{cl-position-if}, +@code{cl-position-if-not}, @code{cl-count-if}, and @code{cl-count-if-not} functions are defined similarly. -@defun mismatch seq1 seq2 @t{&key :test :test-not :key :start1 :end1 :start2 :end2 :from-end} +@defun cl-mismatch seq1 seq2 @t{&key :test :test-not :key :start1 :end1 :start2 :end2 :from-end} This function compares the specified parts of @var{seq1} and @var{seq2}. If they are the same length and the corresponding elements match (according to @code{:test}, @code{:test-not}, @@ -3992,11 +3993,11 @@ If the sequences differ, then one plus the index of the rightmost difference (relative to @var{seq1}) is returned. -An interesting example is @code{(mismatch str1 str2 :key 'upcase)}, +An interesting example is @code{(cl-mismatch str1 str2 :key 'upcase)}, which compares two strings case-insensitively. @end defun -@defun search seq1 seq2 @t{&key :test :test-not :key :from-end :start1 :end1 :start2 :end2} +@defun cl-search seq1 seq2 @t{&key :test :test-not :key :from-end :start1 :end1 :start2 :end2} This function searches @var{seq2} for a subsequence that matches @var{seq1} (or part of it specified by @code{:start1} and @code{:end1}.) Only matches which fall entirely within the region @@ -4010,7 +4011,7 @@ @node Sorting Sequences @section Sorting Sequences -@defun sort* seq predicate @t{&key :key} +@defun clsort seq predicate @t{&key :key} This function sorts @var{seq} into increasing order as determined by using @var{predicate} to compare pairs of elements. @var{predicate} should return true (non-@code{nil}) if and only if its first argument @@ -4025,7 +4026,7 @@ fed to the @var{predicate} function. For example, @example -(setq data (sort* data 'string-lessp :key 'downcase)) +(setq data (cl-sort data 'string-lessp :key 'downcase)) @end example @noindent @@ -4035,25 +4036,25 @@ simple accessor though, it's used heavily in the current implementation. -The @code{sort*} function is destructive; it sorts lists by actually +The @code{cl-sort} function is destructive; it sorts lists by actually rearranging the @code{cdr} pointers in suitable fashion. @end defun -@defun stable-sort seq predicate @t{&key :key} +@defun cl-stable-sort seq predicate @t{&key :key} This function sorts @var{seq} @dfn{stably}, meaning two elements which are equal in terms of @var{predicate} are guaranteed not to be rearranged out of their original order by the sort. -In practice, @code{sort*} and @code{stable-sort} are equivalent +In practice, @code{cl-sort} and @code{cl-stable-sort} are equivalent in Emacs Lisp because the underlying @code{sort} function is stable by default. However, this package reserves the right to -use non-stable methods for @code{sort*} in the future. +use non-stable methods for @code{cl-sort} in the future. @end defun -@defun merge type seq1 seq2 predicate @t{&key :key} +@defun cl-merge type seq1 seq2 predicate @t{&key :key} This function merges two sequences @var{seq1} and @var{seq2} by interleaving their elements. The result sequence, of type @var{type} -(in the sense of @code{concatenate}), has length equal to the sum +(in the sense of @code{cl-concatenate}), has length equal to the sum of the lengths of the two input sequences. The sequences may be modified destructively. Order of elements within @var{seq1} and @var{seq2} is preserved in the interleaving; elements of the two @@ -4073,10 +4074,10 @@ The functions described here operate on lists. @menu -* List Functions:: @code{caddr}, @code{first}, @code{list*}, etc. -* Substitution of Expressions:: @code{subst}, @code{sublis}, etc. -* Lists as Sets:: @code{member*}, @code{adjoin}, @code{union}, etc. -* Association Lists:: @code{assoc*}, @code{rassoc*}, @code{acons}, @code{pairlis}. +* List Functions:: @code{cl-caddr}, @code{cl-first}, @code{cl-list*}, etc. +* Substitution of Expressions:: @code{cl-subst}, @code{cl-sublis}, etc. +* Lists as Sets:: @code{cl-member}, @code{cl-adjoin}, @code{cl-union}, etc. +* Association Lists:: @code{cl-assoc}, @code{cl-rassoc}, @code{cl-acons}, @code{cl-pairlis}. @end menu @node List Functions @@ -4086,7 +4087,7 @@ This section describes a number of simple operations on lists, i.e., chains of cons cells. -@defun caddr x +@defun cl-caddr x This function is equivalent to @code{(car (cdr (cdr @var{x})))}. Likewise, this package defines all 28 @code{c@var{xxx}r} functions where @var{xxx} is up to four @samp{a}s and/or @samp{d}s. @@ -4094,24 +4095,24 @@ are expanded inline by the byte-compiler for maximum efficiency. @end defun -@defun first x +@defun cl-first x This function is a synonym for @code{(car @var{x})}. Likewise, -the functions @code{second}, @code{third}, @dots{}, through -@code{tenth} return the given element of the list @var{x}. +the functions @code{cl-second}, @code{cl-third}, @dots{}, through +@code{cl-tenth} return the given element of the list @var{x}. @end defun -@defun rest x +@defun cl-rest x This function is a synonym for @code{(cdr @var{x})}. @end defun -@defun endp x +@defun cl-endp x Common Lisp defines this function to act like @code{null}, but signaling an error if @code{x} is neither a @code{nil} nor a -cons cell. This package simply defines @code{endp} as a synonym +cons cell. This package simply defines @code{cl-endp} as a synonym for @code{null}. @end defun -@defun list-length x +@defun cl-list-length x This function returns the length of list @var{x}, exactly like @code{(length @var{x})}, except that if @var{x} is a circular list (where the cdr-chain forms a loop rather than terminating @@ -4119,38 +4120,35 @@ @code{length} function would get stuck if given a circular list.) @end defun -@defun list* arg &rest others +@defun cl-list* arg &rest others This function constructs a list of its arguments. The final argument becomes the @code{cdr} of the last cell constructed. -Thus, @code{(list* @var{a} @var{b} @var{c})} is equivalent to +Thus, @code{(cl-list* @var{a} @var{b} @var{c})} is equivalent to @code{(cons @var{a} (cons @var{b} @var{c}))}, and -@code{(list* @var{a} @var{b} nil)} is equivalent to +@code{(cl-list* @var{a} @var{b} nil)} is equivalent to @code{(list @var{a} @var{b})}. - -(Note that this function really is called @code{list*} in Common -Lisp; it is not a name invented for this package like @code{member*} -or @code{defun*}.) @end defun -@defun ldiff list sublist +@defun cl-ldiff list sublist If @var{sublist} is a sublist of @var{list}, i.e., is @code{eq} to one of the cons cells of @var{list}, then this function returns a copy of the part of @var{list} up to but not including -@var{sublist}. For example, @code{(ldiff x (cddr x))} returns +@var{sublist}. For example, @code{(cl-ldiff x (cddr x))} returns the first two elements of the list @code{x}. The result is a copy; the original @var{list} is not modified. If @var{sublist} is not a sublist of @var{list}, a copy of the entire @var{list} is returned. @end defun -@defun copy-list list +@defun cl-copy-list list This function returns a copy of the list @var{list}. It copies dotted lists like @code{(1 2 . 3)} correctly. @end defun @defun copy-tree x &optional vecp This function returns a copy of the tree of cons cells @var{x}. -Unlike @code{copy-sequence} (and its alias @code{copy-list}), +@c FIXME? cl-copy-list is not an alias of copy-sequence. +Unlike @code{copy-sequence} (and its alias @code{cl-copy-list}), which copies only along the @code{cdr} direction, this function copies (recursively) along both the @code{car} and the @code{cdr} directions. If @var{x} is not a cons cell, the function simply @@ -4159,7 +4157,7 @@ cons cells. @end defun -@defun tree-equal x y @t{&key :test :test-not :key} +@defun cl-tree-equal x y @t{&key :test :test-not :key} This function compares two trees of cons cells. If @var{x} and @var{y} are both cons cells, their @code{car}s and @code{cdr}s are compared recursively. If neither @var{x} nor @var{y} is a cons @@ -4177,10 +4175,10 @@ @noindent These functions substitute elements throughout a tree of cons -cells. (@xref{Sequence Functions}, for the @code{substitute} +cells. (@xref{Sequence Functions}, for the @code{cl-substitute} function, which works on just the top-level elements of a list.) -@defun subst new old tree @t{&key :test :test-not :key} +@defun cl-subst new old tree @t{&key :test :test-not :key} This function substitutes occurrences of @var{old} with @var{new} in @var{tree}, a tree of cons cells. It returns a substituted tree, which will be a copy except that it may share storage with @@ -4195,21 +4193,21 @@ but not to @var{old}. @end defun -@defun nsubst new old tree @t{&key :test :test-not :key} -This function is like @code{subst}, except that it works by +@defun cl-nsubst new old tree @t{&key :test :test-not :key} +This function is like @code{cl-subst}, except that it works by destructive modification (by @code{setcar} or @code{setcdr}) rather than copying. @end defun -@findex subst-if -@findex subst-if-not -@findex nsubst-if -@findex nsubst-if-not -The @code{subst-if}, @code{subst-if-not}, @code{nsubst-if}, and -@code{nsubst-if-not} functions are defined similarly. +@findex cl-subst-if +@findex cl-subst-if-not +@findex cl-nsubst-if +@findex cl-nsubst-if-not +The @code{cl-subst-if}, @code{cl-subst-if-not}, @code{cl-nsubst-if}, and +@code{cl-nsubst-if-not} functions are defined similarly. -@defun sublis alist tree @t{&key :test :test-not :key} -This function is like @code{subst}, except that it takes an +@defun cl-sublis alist tree @t{&key :test :test-not :key} +This function is like @code{cl-subst}, except that it takes an association list @var{alist} of @var{old}-@var{new} pairs. Each element of the tree (after applying the @code{:key} function, if any), is compared with the @code{car}s of @@ -4217,8 +4215,8 @@ @code{cdr}. @end defun -@defun nsublis alist tree @t{&key :test :test-not :key} -This is a destructive version of @code{sublis}. +@defun cl-nsublis alist tree @t{&key :test :test-not :key} +This is a destructive version of @code{cl-sublis}. @end defun @node Lists as Sets @@ -4228,7 +4226,7 @@ These functions perform operations on lists which represent sets of elements. -@defun member* item list @t{&key :test :test-not :key} +@defun cl-member item list @t{&key :test :test-not :key} This function searches @var{list} for an element matching @var{item}. If a match is found, it returns the cons cell whose @code{car} was the matching element. Otherwise, it returns @code{nil}. Elements @@ -4236,34 +4234,33 @@ @code{:test-not}, and @code{:key} arguments to modify this behavior. @xref{Sequences}. -Note that this function's name is suffixed by @samp{*} to avoid -the incompatible @code{member} function defined in Emacs. -(That function uses @code{equal} for comparisons; it is equivalent -to @code{(member* @var{item} @var{list} :test 'equal)}.) +The standard Emacs lisp function @code{member} uses @code{equal} for +comparisons; it is equivalent to @code{(cl-member @var{item} @var{list} +:test 'equal)}. @end defun -@findex member-if -@findex member-if-not -The @code{member-if} and @code{member-if-not} functions +@findex cl-member-if +@findex cl-member-if-not +The @code{cl-member-if} and @code{cl-member-if-not} functions analogously search for elements which satisfy a given predicate. -@defun tailp sublist list +@defun cl-tailp sublist list This function returns @code{t} if @var{sublist} is a sublist of @var{list}, i.e., if @var{sublist} is @code{eql} to @var{list} or to any of its @code{cdr}s. @end defun -@defun adjoin item list @t{&key :test :test-not :key} +@defun cl-adjoin item list @t{&key :test :test-not :key} This function conses @var{item} onto the front of @var{list}, like @code{(cons @var{item} @var{list})}, but only if @var{item} -is not already present on the list (as determined by @code{member*}). +is not already present on the list (as determined by @code{cl-member}). If a @code{:key} argument is specified, it is applied to @var{item} as well as to the elements of @var{list} during the search, on the reasoning that @var{item} is ``about'' to become part of the list. @end defun -@defun union list1 list2 @t{&key :test :test-not :key} +@defun cl-union list1 list2 @t{&key :test :test-not :key} This function combines two lists which represent sets of items, returning a list that represents the union of those two sets. The result list will contain all items which appear in @var{list1} @@ -4275,46 +4272,46 @@ undefined. @end defun -@defun nunion list1 list2 @t{&key :test :test-not :key} -This is a destructive version of @code{union}; rather than copying, +@defun cl-nunion list1 list2 @t{&key :test :test-not :key} +This is a destructive version of @code{cl-union}; rather than copying, it tries to reuse the storage of the argument lists if possible. @end defun -@defun intersection list1 list2 @t{&key :test :test-not :key} +@defun cl-intersection list1 list2 @t{&key :test :test-not :key} This function computes the intersection of the sets represented by @var{list1} and @var{list2}. It returns the list of items which appear in both @var{list1} and @var{list2}. @end defun -@defun nintersection list1 list2 @t{&key :test :test-not :key} -This is a destructive version of @code{intersection}. It +@defun cl-nintersection list1 list2 @t{&key :test :test-not :key} +This is a destructive version of @code{cl-intersection}. It tries to reuse storage of @var{list1} rather than copying. It does @emph{not} reuse the storage of @var{list2}. @end defun -@defun set-difference list1 list2 @t{&key :test :test-not :key} +@defun cl-set-difference list1 list2 @t{&key :test :test-not :key} This function computes the ``set difference'' of @var{list1} and @var{list2}, i.e., the set of elements that appear in @var{list1} but @emph{not} in @var{list2}. @end defun -@defun nset-difference list1 list2 @t{&key :test :test-not :key} -This is a destructive @code{set-difference}, which will try +@defun cl-nset-difference list1 list2 @t{&key :test :test-not :key} +This is a destructive @code{cl-set-difference}, which will try to reuse @var{list1} if possible. @end defun -@defun set-exclusive-or list1 list2 @t{&key :test :test-not :key} +@defun cl-set-exclusive-or list1 list2 @t{&key :test :test-not :key} This function computes the ``set exclusive or'' of @var{list1} and @var{list2}, i.e., the set of elements that appear in exactly one of @var{list1} and @var{list2}. @end defun -@defun nset-exclusive-or list1 list2 @t{&key :test :test-not :key} -This is a destructive @code{set-exclusive-or}, which will try +@defun cl-nset-exclusive-or list1 list2 @t{&key :test :test-not :key} +This is a destructive @code{cl-set-exclusive-or}, which will try to reuse @var{list1} and @var{list2} if possible. @end defun -@defun subsetp list1 list2 @t{&key :test :test-not :key} +@defun cl-subsetp list1 list2 @t{&key :test :test-not :key} This function checks whether @var{list1} represents a subset of @var{list2}, i.e., whether every element of @var{list1} also appears in @var{list2}. @@ -4328,7 +4325,7 @@ one set of values to another; any list whose elements are cons cells is an association list. -@defun assoc* item a-list @t{&key :test :test-not :key} +@defun cl-assoc item a-list @t{&key :test :test-not :key} This function searches the association list @var{a-list} for an element whose @code{car} matches (in the sense of @code{:test}, @code{:test-not}, and @code{:key}, or by comparison with @code{eql}) @@ -4340,27 +4337,27 @@ elements of @var{a-list} to be an error.) @end defun -@defun rassoc* item a-list @t{&key :test :test-not :key} +@defun cl-rassoc item a-list @t{&key :test :test-not :key} This function searches for an element whose @code{cdr} matches @var{item}. If @var{a-list} represents a mapping, this applies the inverse of the mapping to @var{item}. @end defun -@findex assoc-if -@findex assoc-if-not -@findex rassoc-if -@findex rassoc-if-not -The @code{assoc-if}, @code{assoc-if-not}, @code{rassoc-if}, -and @code{rassoc-if-not} functions are defined similarly. +@findex cl-assoc-if +@findex cl-assoc-if-not +@findex cl-rassoc-if +@findex cl-rassoc-if-not +The @code{cl-assoc-if}, @code{cl-assoc-if-not}, @code{cl-rassoc-if}, +and @code{cl-rassoc-if-not} functions are defined similarly. Two simple functions for constructing association lists are: -@defun acons key value alist +@defun cl-acons key value alist This is equivalent to @code{(cons (cons @var{key} @var{value}) @var{alist})}. @end defun -@defun pairlis keys values &optional alist -This is equivalent to @code{(nconc (mapcar* 'cons @var{keys} @var{values}) +@defun cl-pairlis keys values &optional alist +This is equivalent to @code{(nconc (cl-mapcar 'cons @var{keys} @var{values}) @var{alist})}. @end defun @@ -4382,15 +4379,15 @@ implements structures as vectors (or lists upon request) with a special ``tag'' symbol to identify them. -@defspec defstruct name slots@dots{} -The @code{defstruct} form defines a new structure type called +@defspec cl-defstruct name slots@dots{} +The @code{cl-defstruct} form defines a new structure type called @var{name}, with the specified @var{slots}. (The @var{slots} may begin with a string which documents the structure type.) In the simplest case, @var{name} and each of the @var{slots} are symbols. For example, @example -(defstruct person name age sex) +(cl-defstruct person name age sex) @end example @noindent @@ -4401,7 +4398,7 @@ using @code{setf} on any of these place forms: @example -(incf (person-age birthday-boy)) +(cl-incf (person-age birthday-boy)) @end example You can create a new @code{person} by calling @code{make-person}, @@ -4465,10 +4462,10 @@ not change afterward. @example -(defstruct person - (name nil :read-only t) - age - (sex 'unknown)) +(cl-defstruct person + (name nil :read-only t) + age + (sex 'unknown)) @end example Any slot options other than @code{:read-only} are ignored. @@ -4480,10 +4477,10 @@ enclosed in lists.) @example -(defstruct (person (:constructor create-person) - (:type list) - :named) - name age sex) +(cl-defstruct (person (:constructor create-person) + (:type list) + :named) + name age sex) @end example The following structure options are recognized. @@ -4529,15 +4526,15 @@ option. @example -(defstruct - (person - (:constructor nil) ; no default constructor - (:constructor new-person (name sex &optional (age 0))) - (:constructor new-hound (&key (name "Rover") - (dog-years 0) - &aux (age (* 7 dog-years)) - (sex 'canine)))) - name age sex) +(cl-defstruct + (person + (:constructor nil) ; no default constructor + (:constructor new-person (name sex &optional (age 0))) + (:constructor new-hound (&key (name "Rover") + (dog-years 0) + &aux (age (* 7 dog-years)) + (sex 'canine)))) + name age sex) @end example The first constructor here takes its arguments positionally rather @@ -4576,7 +4573,7 @@ @item :include This option implements a very limited form of C++-style inheritance. The argument is the name of another structure type previously -created with @code{defstruct}. The effect is to cause the new +created with @code{cl-defstruct}. The effect is to cause the new structure type to inherit all of the included structure's slots (plus, of course, any new slots described by this struct's slot descriptors). The new structure is considered a ``specialization'' @@ -4589,12 +4586,12 @@ modified default values. Borrowing an example from Steele: @example -(defstruct person name (age 0) sex) - @result{} person -(defstruct (astronaut (:include person (age 45))) - helmet-size - (favorite-beverage 'tang)) - @result{} astronaut +(cl-defstruct person name (age 0) sex) + @result{} person +(cl-defstruct (astronaut (:include person (age 45))) + helmet-size + (favorite-beverage 'tang)) + @result{} astronaut (setq joe (make-person :name "Joe")) @result{} [cl-struct-person "Joe" 0 nil] @@ -4650,9 +4647,9 @@ conjunction with @code{:type}. @example -(defstruct (person1) name age sex) -(defstruct (person2 (:type list) :named) name age sex) -(defstruct (person3 (:type list)) name age sex) +(cl-defstruct (person1) name age sex) +(cl-defstruct (person2 (:type list) :named) name age sex) +(cl-defstruct (person3 (:type list)) name age sex) (setq p1 (make-person1)) @result{} [cl-struct-person1 nil nil nil] @@ -4669,7 +4666,7 @@ @result{} error: function person3-p undefined @end example -Since unnamed structures don't have tags, @code{defstruct} is not +Since unnamed structures don't have tags, @code{cl-defstruct} is not able to make a useful predicate for recognizing them. Also, accessors like @code{person3-name} will be generated but they will not be able to do any type checking. The @code{person3-name} @@ -4691,7 +4688,7 @@ @end table @end defspec -Except as noted, the @code{defstruct} facility of this package is +Except as noted, the @code{cl-defstruct} facility of this package is entirely compatible with that of Common Lisp. @node Assertions @@ -4708,10 +4705,10 @@ away the following assertions. Because assertions might be optimized away, it is a bad idea for them to include side-effects. -@defspec assert test-form [show-args string args@dots{}] +@defspec cl-assert test-form [show-args string args@dots{}] This form verifies that @var{test-form} is true (i.e., evaluates to a non-@code{nil} value). If so, it returns @code{nil}. If the test -is not satisfied, @code{assert} signals an error. +is not satisfied, @code{cl-assert} signals an error. A default error message will be supplied which includes @var{test-form}. You can specify a different error message by including a @var{string} @@ -4724,7 +4721,7 @@ @var{form}. For example: @example -(assert (> x 10) t "x is too small: %d") +(cl-assert (> x 10) t "x is too small: %d") @end example This usage of @var{show-args} is an extension to Common Lisp. In @@ -4734,16 +4731,16 @@ makes no sense to specify @var{places}. @end defspec -@defspec check-type form type [string] +@defspec cl-check-type form type [string] This form verifies that @var{form} evaluates to a value of type -@var{type}. If so, it returns @code{nil}. If not, @code{check-type} +@var{type}. If so, it returns @code{nil}. If not, @code{cl-check-type} signals a @code{wrong-type-argument} error. The default error message lists the erroneous value along with @var{type} and @var{form} themselves. If @var{string} is specified, it is included in the error message in place of @var{type}. For example: @example -(check-type x (integer 1 *) "a positive integer") +(cl-check-type x (integer 1 *) "a positive integer") @end example @xref{Type Predicates}, for a description of the type specifiers @@ -4757,6 +4754,7 @@ The following error-related macro is also defined: +@c FIXME standard for some time. @defspec ignore-errors forms@dots{} This executes @var{forms} exactly like a @code{progn}, except that errors are ignored during the @var{forms}. More precisely, if @@ -4772,14 +4770,14 @@ @appendixsec Macros @noindent -Many of the advanced features of this package, such as @code{defun*}, -@code{loop}, and @code{setf}, are implemented as Lisp macros. In +Many of the advanced features of this package, such as @code{cl-defun}, +@code{cl-loop}, and @code{setf}, are implemented as Lisp macros. In byte-compiled code, these complex notations will be expanded into equivalent Lisp code which is simple and efficient. For example, the forms @example -(incf i n) +(cl-incf i n) (push x (car p)) @end example @@ -4794,13 +4792,13 @@ @noindent which are the most efficient ways of doing these respective operations in Lisp. Thus, there is no performance penalty for using the more -readable @code{incf} and @code{push} forms in your compiled code. +readable @code{cl-incf} and @code{push} forms in your compiled code. @emph{Interpreted} code, on the other hand, must expand these macros every time they are executed. For this reason it is strongly recommended that code making heavy use of macros be compiled. (The features labeled ``Special Form'' instead of ``Function'' in -this manual are macros.) A loop using @code{incf} a hundred times +this manual are macros.) A loop using @code{cl-incf} a hundred times will execute considerably faster if compiled, and will also garbage-collect less because the macro expansion will not have to be generated, used, and thrown away a hundred times. @@ -4824,36 +4822,36 @@ the expansion @example -(block nil - (let* ((x 0) - (G1004 nil)) - (while (< x 10) - (setq G1004 (cons x G1004)) - (setq x (+ x 1))) - (nreverse G1004))) +(cl-block nil + (let* ((x 0) + (G1004 nil)) + (while (< x 10) + (setq G1004 (cons x G1004)) + (setq x (+ x 1))) + (nreverse G1004))) @end example @noindent -will be inserted into the buffer. (The @code{block} macro is +will be inserted into the buffer. (The @code{cl-block} macro is expanded differently in the interpreter and compiler, so @code{cl-prettyexpand} just leaves it alone. The temporary -variable @code{G1004} was created by @code{gensym}.) +variable @code{G1004} was created by @code{cl-gensym}.) If the optional argument @var{full} is true, then @emph{all} -macros are expanded, including @code{block}, @code{eval-when}, +macros are expanded, including @code{cl-block}, @code{cl-eval-when}, and compiler macros. Expansion is done as if @var{form} were a top-level form in a file being compiled. For example, @example -(cl-prettyexpand '(pushnew 'x list)) - @print{} (setq list (adjoin 'x list)) -(cl-prettyexpand '(pushnew 'x list) t) +(cl-prettyexpand '(cl-pushnew 'x list)) + @print{} (setq list (cl-adjoin 'x list)) +(cl-prettyexpand '(cl-pushnew 'x list) t) @print{} (setq list (if (memq 'x list) list (cons 'x list))) -(cl-prettyexpand '(caddr (member* 'a list)) t) +(cl-prettyexpand '(caddr (cl-member 'a list)) t) @print{} (car (cdr (cdr (memq 'a list)))) @end example -Note that @code{adjoin}, @code{caddr}, and @code{member*} all +Note that @code{cl-adjoin}, @code{cl-caddr}, and @code{cl-member} all have built-in compiler macros to optimize them in common cases. @end defun @@ -4875,22 +4873,22 @@ supposed to arise in complying programs; implementations are strongly encouraged but not required to signal an error in these situations. This package sometimes omits such error checking in the interest of -compactness and efficiency. For example, @code{do} variable +compactness and efficiency. For example, @code{cl-do} variable specifiers are supposed to be lists of one, two, or three forms; extra forms are ignored by this package rather than signaling a -syntax error. The @code{endp} function is simply a synonym for +syntax error. The @code{cl-endp} function is simply a synonym for @code{null} in this package. Functions taking keyword arguments will accept an odd number of arguments, treating the trailing keyword as if it were followed by the value @code{nil}. -Argument lists (as processed by @code{defun*} and friends) +Argument lists (as processed by @code{cl-defun} and friends) @emph{are} checked rigorously except for the minor point just mentioned; in particular, keyword arguments are checked for validity, and @code{&allow-other-keys} and @code{:allow-other-keys} are fully implemented. Keyword validity checking is slightly time consuming (though not too bad in byte-compiled code); you can use @code{&allow-other-keys} to omit this check. Functions -defined in this package such as @code{find} and @code{member*} +defined in this package such as @code{cl-find} and @code{cl-member} do check their keyword arguments for validity. @ifinfo @@ -4904,10 +4902,10 @@ Use of the optimizing Emacs compiler is highly recommended; many of the Common Lisp macros emit code which can be improved by optimization. In particular, -@code{block}s (whether explicit or implicit in constructs like -@code{defun*} and @code{loop}) carry a fair run-time penalty; the -optimizing compiler removes @code{block}s which are not actually -referenced by @code{return} or @code{return-from} inside the block. +@code{cl-block}s (whether explicit or implicit in constructs like +@code{cl-defun} and @code{cl-loop}) carry a fair run-time penalty; the +optimizing compiler removes @code{cl-block}s which are not actually +referenced by @code{cl-return} or @code{cl-return-from} inside the block. @node Common Lisp Compatibility @appendix Common Lisp Compatibility @@ -4916,20 +4914,22 @@ Following is a list of all known incompatibilities between this package and Common Lisp as documented in Steele (2nd edition). +@ignore Certain function names, such as @code{member}, @code{assoc}, and @code{floor}, were already taken by (incompatible) Emacs Lisp functions; this package appends @samp{*} to the names of its Common Lisp versions of these functions. +@end ignore -The word @code{defun*} is required instead of @code{defun} in order +The word @code{cl-defun} is required instead of @code{defun} in order to use extended Common Lisp argument lists in a function. Likewise, -@code{defmacro*} and @code{function*} are versions of those forms +@code{cl-defmacro} and @code{cl-function} are versions of those forms which understand full-featured argument lists. The @code{&whole} keyword does not work in @code{defmacro} argument lists (except inside recursive argument lists). The @code{equal} predicate does not distinguish -between IEEE floating-point plus and minus zero. The @code{equalp} +between IEEE floating-point plus and minus zero. The @code{cl-equalp} predicate has several differences with Common Lisp; @pxref{Predicates}. The @code{setf} mechanism is entirely compatible, except that @@ -4937,21 +4937,21 @@ values directly. Also, the new ``@code{setf} function'' concept (typified by @code{(defun (setf foo) @dots{})}) is not implemented. -The @code{do-all-symbols} form is the same as @code{do-symbols} +The @code{cl-do-all-symbols} form is the same as @code{cl-do-symbols} with no @var{obarray} argument. In Common Lisp, this form would iterate over all symbols in all packages. Since Emacs obarrays are not a first-class package mechanism, there is no way for -@code{do-all-symbols} to locate any but the default obarray. +@code{cl-do-all-symbols} to locate any but the default obarray. -The @code{loop} macro is complete except that @code{loop-finish} +The @code{cl-loop} macro is complete except that @code{loop-finish} and type specifiers are unimplemented. The multiple-value return facility treats lists as multiple values, since Emacs Lisp cannot support multiple return values directly. The macros will be compatible with Common Lisp if @code{values} or @code{values-list} is always used to return to -a @code{multiple-value-bind} or other multiple-value receiver; -if @code{values} is used without @code{multiple-value-@dots{}} +a @code{cl-multiple-value-bind} or other multiple-value receiver; +if @code{values} is used without @code{cl-multiple-value-@dots{}} or vice-versa the effect will be different from Common Lisp. Many Common Lisp declarations are ignored, and others match @@ -4960,17 +4960,18 @@ advisory in Emacs Lisp, do not rigorously obey the scoping rules set down in Steele's book. -The variable @code{*gensym-counter*} starts out with a pseudo-random +The variable @code{cl--gensym-counter} starts out with a pseudo-random value rather than with zero. This is to cope with the fact that generated symbols become interned when they are written to and loaded back from a file. -The @code{defstruct} facility is compatible, except that structures +The @code{cl-defstruct} facility is compatible, except that structures are of type @code{:type vector :named} by default rather than some special, distinct type. Also, the @code{:type} slot option is ignored. -The second argument of @code{check-type} is treated differently. +The second argument of @code{cl-check-type} is treated differently. +@c FIXME Time to remove this? @node Old CL Compatibility @appendix Old CL Compatibility @@ -4989,6 +4990,7 @@ The @code{defkeyword} form and @code{keywordp} function are not implemented in this package. +@ignore The @code{member}, @code{floor}, @code{ceiling}, @code{truncate}, @code{round}, @code{mod}, and @code{rem} functions are suffixed by @samp{*} in this package to avoid collision with existing @@ -4998,6 +5000,7 @@ recent versions of the Quiroz package changed the names to @code{cl-member}, etc.; this package defines the latter names as aliases for @code{member*}, etc.) +@end ignore Certain functions in the old package which were buggy or inconsistent with the Common Lisp standard are incompatible with the conforming @@ -5006,9 +5009,9 @@ failed to preserve correct order of evaluation of its arguments, etc. Finally, unlike the older package, this package is careful to -prefix all of its internal names with @code{cl-}. Except for a +prefix all of its internal names with @code{cl--}. Except for a few functions which are explicitly defined as additional features -(such as @code{floatp-safe} and @code{letf}), this package does not +(such as @code{cl-floatp-safe} and @code{letf}), this package does not export any non-@samp{cl-} symbols which are not also part of Common Lisp. @@ -5267,7 +5270,7 @@ these forms: @example -(let ((total 0)) (dolist (x my-list) (incf total x)) total) +(let ((total 0)) (dolist (x my-list) (cl-incf total x)) total) (loop for x in my-list sum x) @end example ------------------------------------------------------------ revno: 110646 fixes bug: http://debbugs.gnu.org/12706 committer: Paul Eggert branch nick: trunk timestamp: Wed 2012-10-24 05:12:23 +0000 message: Update manual for new time stamp format. These instances were missed the first time around. Problem reported by Glenn Morris in . * doc/lispintro/emacs-lisp-intro.texi (Files List): * doc/lispref/buffers.texi (Modification Time): * doc/lispref/files.texi (Testing Accessibility, File Attributes): * doc/lispref/intro.texi (Version Info): * doc/lispref/os.texi (Time of Day): * doc/misc/emacs-mime.texi (time-date): Update for new time stamp format (HIGH LOW MICROSEC PICOSEC). * doc/misc/emacs-mime.texi (time-date): Also, fix bogus time stamp and modernize a bit. diff: === modified file 'doc/lispintro/ChangeLog' --- doc/lispintro/ChangeLog 2012-10-17 03:44:00 +0000 +++ doc/lispintro/ChangeLog 2012-10-24 05:12:23 +0000 @@ -1,3 +1,8 @@ +2012-10-24 Paul Eggert + + * emacs-lisp-intro.texi (Files List): + Update manual for new time stamp format (Bug#12706). + 2012-10-17 Gregor Zattler (tiny change) * emacs-lisp-intro.texi (Narrowing advantages): === modified file 'doc/lispintro/emacs-lisp-intro.texi' --- doc/lispintro/emacs-lisp-intro.texi 2012-10-23 15:06:07 +0000 +++ doc/lispintro/emacs-lisp-intro.texi 2012-10-24 05:12:23 +0000 @@ -238,7 +238,7 @@ a division of the @hfill email: @email{sales@@fsf.org}@* Free Software Foundation, Inc. @hfill Tel: +1 (617) 542-5942@* 51 Franklin Street, Fifth Floor @hfill Fax: +1 (617) 542-2652@* -Boston, MA 02110-1301 USA +Boston, MA 02110-1301 USA @end iftex @ifnottex @@ -249,7 +249,7 @@ a division of the email: sales@@fsf.org Free Software Foundation, Inc. Tel: +1 (617) 542-5942 51 Franklin Street, Fifth Floor Fax: +1 (617) 542-2652 -Boston, MA 02110-1301 USA +Boston, MA 02110-1301 USA @end example @end ifnottex @@ -15680,11 +15680,11 @@ 100 @end group @group -(17733 259) -(17491 28834) -(17596 62124) -13157 -"-rw-rw-r--" +(20615 27034 579989 697000) +(17905 55681 0 0) +(20615 26327 734791 805000) +13188 +"-rw-r--r--" @end group @group nil === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2012-10-24 03:48:50 +0000 +++ doc/lispref/ChangeLog 2012-10-24 05:12:23 +0000 @@ -1,3 +1,14 @@ +2012-10-24 Paul Eggert + + Update manual for new time stamp format (Bug#12706). + * buffers.texi (Modification Time): + * files.texi (Testing Accessibility, File Attributes): + * intro.texi (Version Info): + * os.texi (Time of Day): + Update for new time stamp format (HIGH LOW MICROSEC PICOSEC). + These instances were missed the first time around. + Problem reported by Glenn Morris in . + 2012-10-24 Chong Yidong * keymaps.texi (Toolkit Differences): Node deleted. === modified file 'doc/lispref/buffers.texi' --- doc/lispref/buffers.texi 2012-09-23 10:46:50 +0000 +++ doc/lispref/buffers.texi 2012-10-24 05:12:23 +0000 @@ -634,7 +634,8 @@ @c Emacs 19 feature @defun visited-file-modtime This function returns the current buffer's recorded last file -modification time, as a list of the form @code{(@var{high} @var{low})}. +modification time, as a list of the form @code{(@var{high} @var{low} +@var{microsec} @var{picosec})}. (This is the same format that @code{file-attributes} uses to return time values; see @ref{File Attributes}.) @@ -664,9 +665,8 @@ visited file. If @var{time} is neither @code{nil} nor zero, it should have the form -@code{(@var{high} . @var{low})} or @code{(@var{high} @var{low})}, in -either case containing two integers, each of which holds 16 bits of the -time. +@code{(@var{high} @var{low} @var{microsec} @var{picosec})}, +the format used by @code{current-time} (@pxref{Time of Day}). This function is useful if the buffer was not read from the file normally, or if the file itself has been changed for some known benign @@ -1237,4 +1237,3 @@ @defun gap-size This function returns the current gap size of the current buffer. @end defun - === modified file 'doc/lispref/files.texi' --- doc/lispref/files.texi 2012-10-23 07:57:42 +0000 +++ doc/lispref/files.texi 2012-10-24 05:12:23 +0000 @@ -938,7 +938,7 @@ @end example You can use @code{file-attributes} to get a file's last modification -time as a list of two numbers. @xref{File Attributes}. +time as a list of four integers. @xref{File Attributes}. @end defun @node Kinds of Files @@ -1228,11 +1228,11 @@ @cindex modification time of file @item -The time of last modification as a list of two integers (as above). +The time of last modification as a list of four integers (as above). This is the last time when the file's contents were modified. @item -The time of last status change as a list of two integers (as above). +The time of last status change as a list of four integers (as above). This is the time of the last change to the file's access mode bits, its owner and group, and other information recorded in the filesystem for the file, beyond the file's contents. @@ -1275,9 +1275,9 @@ @group (file-attributes "files.texi" 'string) @result{} (nil 1 "lh" "users" - (19145 42977) - (19141 59576) - (18340 17300) + (20614 64019 50040 152000) + (20000 23 0 0) + (20614 64555 902289 872000) 122295 "-rw-rw-rw-" nil (5888 2 . 43978) (15479 . 46724)) @@ -1301,14 +1301,14 @@ @item "users" is in the group with name "users". -@item (19145 42977) -was last accessed on Oct 5 2009, at 10:01:37. - -@item (19141 59576) -last had its contents modified on Oct 2 2009, at 13:49:12. - -@item (18340 17300) -last had its status changed on Feb 2 2008, at 12:19:00. +@item (20614 64019 50040 152000) +was last accessed on October 23, 2012, at 20:12:03.050040152 UTC. + +@item (20000 23 0 0) +was last modified on July 15, 2001, at 08:53:43 UTC. + +@item (20614 64555 902289 872000) +last had its status changed on October 23, 2012, at 20:20:59.902289872 UTC. @item 122295 is 122295 bytes long. (It may not contain 122295 characters, though, === modified file 'doc/lispref/intro.texi' --- doc/lispref/intro.texi 2012-10-22 02:22:27 +0000 +++ doc/lispref/intro.texi 2012-10-24 05:12:23 +0000 @@ -493,13 +493,13 @@ @defvar emacs-build-time The value of this variable indicates the time at which Emacs was -built. It is a list of three integers, like the value of +built. It is a list of four integers, like the value of @code{current-time} (@pxref{Time of Day}). @example @group emacs-build-time - @result{} (18846 52016 156039) + @result{} (20614 63694 515336 438000) @end group @end example @end defvar === modified file 'doc/lispref/os.texi' --- doc/lispref/os.texi 2012-10-22 21:57:14 +0000 +++ doc/lispref/os.texi 2012-10-24 05:12:23 +0000 @@ -1199,7 +1199,7 @@ the number of picoseconds from the start of that microsecond to the specified time. - The return value of @code{current-time} represents time using three + The return value of @code{current-time} represents time using four integers, as do the timestamps in the return value of @code{file-attributes} (@pxref{Definition of file-attributes}). In function arguments, e.g.@: the @var{time-value} === modified file 'doc/misc/ChangeLog' --- doc/misc/ChangeLog 2012-10-23 07:52:18 +0000 +++ doc/misc/ChangeLog 2012-10-24 05:12:23 +0000 @@ -1,3 +1,9 @@ +2012-10-24 Paul Eggert + + Update manual for new time stamp format (Bug#12706). + * emacs-mime.texi (time-date): Update for new format. + Also, fix bogus time stamp and modernize a bit. + 2012-10-23 Glenn Morris * cl.texi: Include emacsver.texi. Use Emacs version number rather === modified file 'doc/misc/emacs-mime.texi' --- doc/misc/emacs-mime.texi 2012-01-19 07:21:25 +0000 +++ doc/misc/emacs-mime.texi 2012-10-24 05:12:23 +0000 @@ -1516,16 +1516,16 @@ @result{} 905595714.0 (seconds-to-time 905595714.0) -@result{} (13818 19266 0) +@result{} (13818 19266 0 0) (time-to-days '(13818 19266)) @result{} 729644 (days-to-time 729644) -@result{} (961933 65536) +@result{} (961933 512) (time-since '(13818 19266)) -@result{} (0 430) +@result{} (6797 9607 984839 247000) (time-less-p '(13818 19266) '(13818 19145)) @result{} nil @@ -1546,7 +1546,7 @@ (time-to-number-of-days (time-since (date-to-time "Mon, 01 Jan 2001 02:22:26 GMT"))) -@result{} 4.146122685185185 +@result{} 4314.095589286675 @end example And finally, we have @code{safe-date-to-time}, which does the same as @@ -1561,7 +1561,7 @@ 12:21:54 1998 +0200"}. @item time -An internal Emacs time. For instance: @code{(13818 26466)}. +An internal Emacs time. For instance: @code{(13818 26466 0 0)}. @item seconds A floating point representation of the internal Emacs time. For