Mercurial > emacs
changeset 105514:4c53b5211a28
* cl.texi (Argument Lists): Clarify explicit keyword arguments.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Wed, 07 Oct 2009 15:04:43 +0000 |
parents | 1bfde4a3bd05 |
children | 4adf54462047 |
files | doc/misc/ChangeLog doc/misc/cl.texi |
diffstat | 2 files changed, 24 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/misc/ChangeLog Wed Oct 07 14:33:31 2009 +0000 +++ b/doc/misc/ChangeLog Wed Oct 07 15:04:43 2009 +0000 @@ -1,3 +1,7 @@ +2009-10-07 Chong Yidong <cyd@stupidchicken.com> + + * cl.texi (Argument Lists): Clarify explicit keyword arguments. + 2009-10-07 Juanma Barranquero <lekktu@gmail.com> * makefile.w32-in (INFO_TARGETS, DVI_TARGETS, clean): Add eieio, ede.
--- a/doc/misc/cl.texi Wed Oct 07 14:33:31 2009 +0000 +++ b/doc/misc/cl.texi Wed Oct 07 15:04:43 2009 +0000 @@ -457,15 +457,26 @@ @code{b} to the keyword @code{:c}, then signal an error because @code{2} is not a valid keyword. -If a @var{keyword} symbol is explicitly specified in the argument -list as shown in the above diagram, then that keyword will be -used instead of just the variable name prefixed with a colon. -You can specify a @var{keyword} symbol which does not begin with -a colon at all, but such symbols will not be self-quoting; you -will have to quote them explicitly with an apostrophe in the -function call. - -Ordinarily it is an error to pass an unrecognized keyword to +You can also explicitly specify the keyword argument; it need not be +simply the variable name prefixed with a colon. For example, + +@example +(defun* bar (&key (a 1) ((baz b) 4))) +@end example + +@noindent + +specifies a keyword @code{:a} that sets the variable @code{a} with +default value 1, as well as a keyword @code{baz} that sets the +variable @code{b} with default value 4. In this case, because +@code{baz} is not self-quoting, you must quote it explicitly in the +function call, like this: + +@example +(bar :a 10 'baz 42) +@end example + +Ordinarily, it is an error to pass an unrecognized keyword to a function, e.g., @code{(foo 1 2 :c 3 :goober 4)}. You can ask Lisp to ignore unrecognized keywords, either by adding the marker @code{&allow-other-keys} after the keyword section