aboutsummaryrefslogtreecommitdiffstats
path: root/doc/misc
diff options
context:
space:
mode:
authorChong Yidong2009-10-07 15:04:43 +0000
committerChong Yidong2009-10-07 15:04:43 +0000
commit09094f2893027678380b946a9cd618da4d6e4f9a (patch)
treea2f60cfbbc386743afbe95c79d32399ea0479b81 /doc/misc
parent5c4634c1d1f0cb9580689649e0ac5fce67ba5935 (diff)
downloademacs-09094f2893027678380b946a9cd618da4d6e4f9a.tar.gz
emacs-09094f2893027678380b946a9cd618da4d6e4f9a.zip
* cl.texi (Argument Lists): Clarify explicit keyword arguments.
Diffstat (limited to 'doc/misc')
-rw-r--r--doc/misc/ChangeLog4
-rw-r--r--doc/misc/cl.texi27
2 files changed, 23 insertions, 8 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog
index 80108f7a7b9..703319269d2 100644
--- a/doc/misc/ChangeLog
+++ b/doc/misc/ChangeLog
@@ -1,3 +1,7 @@
12009-10-07 Chong Yidong <cyd@stupidchicken.com>
2
3 * cl.texi (Argument Lists): Clarify explicit keyword arguments.
4
12009-10-07 Juanma Barranquero <lekktu@gmail.com> 52009-10-07 Juanma Barranquero <lekktu@gmail.com>
2 6
3 * makefile.w32-in (INFO_TARGETS, DVI_TARGETS, clean): Add eieio, ede. 7 * makefile.w32-in (INFO_TARGETS, DVI_TARGETS, clean): Add eieio, ede.
diff --git a/doc/misc/cl.texi b/doc/misc/cl.texi
index fb1aace9bc6..2000cd6818e 100644
--- a/doc/misc/cl.texi
+++ b/doc/misc/cl.texi
@@ -457,15 +457,26 @@ argument @code{b} as well, since @code{(foo 1 :c 2)} would bind
457@code{b} to the keyword @code{:c}, then signal an error because 457@code{b} to the keyword @code{:c}, then signal an error because
458@code{2} is not a valid keyword. 458@code{2} is not a valid keyword.
459 459
460If a @var{keyword} symbol is explicitly specified in the argument 460You can also explicitly specify the keyword argument; it need not be
461list as shown in the above diagram, then that keyword will be 461simply the variable name prefixed with a colon. For example,
462used instead of just the variable name prefixed with a colon. 462
463You can specify a @var{keyword} symbol which does not begin with 463@example
464a colon at all, but such symbols will not be self-quoting; you 464(defun* bar (&key (a 1) ((baz b) 4)))
465will have to quote them explicitly with an apostrophe in the 465@end example
466function call. 466
467@noindent
468
469specifies a keyword @code{:a} that sets the variable @code{a} with
470default value 1, as well as a keyword @code{baz} that sets the
471variable @code{b} with default value 4. In this case, because
472@code{baz} is not self-quoting, you must quote it explicitly in the
473function call, like this:
474
475@example
476(bar :a 10 'baz 42)
477@end example
467 478
468Ordinarily it is an error to pass an unrecognized keyword to 479Ordinarily, it is an error to pass an unrecognized keyword to
469a function, e.g., @code{(foo 1 2 :c 3 :goober 4)}. You can ask 480a function, e.g., @code{(foo 1 2 :c 3 :goober 4)}. You can ask
470Lisp to ignore unrecognized keywords, either by adding the 481Lisp to ignore unrecognized keywords, either by adding the
471marker @code{&allow-other-keys} after the keyword section 482marker @code{&allow-other-keys} after the keyword section