diff options
| author | Chong Yidong | 2009-10-07 15:04:43 +0000 |
|---|---|---|
| committer | Chong Yidong | 2009-10-07 15:04:43 +0000 |
| commit | 09094f2893027678380b946a9cd618da4d6e4f9a (patch) | |
| tree | a2f60cfbbc386743afbe95c79d32399ea0479b81 /doc/misc | |
| parent | 5c4634c1d1f0cb9580689649e0ac5fce67ba5935 (diff) | |
| download | emacs-09094f2893027678380b946a9cd618da4d6e4f9a.tar.gz emacs-09094f2893027678380b946a9cd618da4d6e4f9a.zip | |
* cl.texi (Argument Lists): Clarify explicit keyword arguments.
Diffstat (limited to 'doc/misc')
| -rw-r--r-- | doc/misc/ChangeLog | 4 | ||||
| -rw-r--r-- | doc/misc/cl.texi | 27 |
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 @@ | |||
| 1 | 2009-10-07 Chong Yidong <cyd@stupidchicken.com> | ||
| 2 | |||
| 3 | * cl.texi (Argument Lists): Clarify explicit keyword arguments. | ||
| 4 | |||
| 1 | 2009-10-07 Juanma Barranquero <lekktu@gmail.com> | 5 | 2009-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 | ||
| 460 | If a @var{keyword} symbol is explicitly specified in the argument | 460 | You can also explicitly specify the keyword argument; it need not be |
| 461 | list as shown in the above diagram, then that keyword will be | 461 | simply the variable name prefixed with a colon. For example, |
| 462 | used instead of just the variable name prefixed with a colon. | 462 | |
| 463 | You can specify a @var{keyword} symbol which does not begin with | 463 | @example |
| 464 | a colon at all, but such symbols will not be self-quoting; you | 464 | (defun* bar (&key (a 1) ((baz b) 4))) |
| 465 | will have to quote them explicitly with an apostrophe in the | 465 | @end example |
| 466 | function call. | 466 | |
| 467 | @noindent | ||
| 468 | |||
| 469 | specifies a keyword @code{:a} that sets the variable @code{a} with | ||
| 470 | default value 1, as well as a keyword @code{baz} that sets the | ||
| 471 | variable @code{b} with default value 4. In this case, because | ||
| 472 | @code{baz} is not self-quoting, you must quote it explicitly in the | ||
| 473 | function call, like this: | ||
| 474 | |||
| 475 | @example | ||
| 476 | (bar :a 10 'baz 42) | ||
| 477 | @end example | ||
| 467 | 478 | ||
| 468 | Ordinarily it is an error to pass an unrecognized keyword to | 479 | Ordinarily, it is an error to pass an unrecognized keyword to |
| 469 | a function, e.g., @code{(foo 1 2 :c 3 :goober 4)}. You can ask | 480 | a function, e.g., @code{(foo 1 2 :c 3 :goober 4)}. You can ask |
| 470 | Lisp to ignore unrecognized keywords, either by adding the | 481 | Lisp to ignore unrecognized keywords, either by adding the |
| 471 | marker @code{&allow-other-keys} after the keyword section | 482 | marker @code{&allow-other-keys} after the keyword section |