diff options
| author | Glenn Morris | 2012-11-07 00:56:16 -0800 |
|---|---|---|
| committer | Glenn Morris | 2012-11-07 00:56:16 -0800 |
| commit | 031b2ea7f5cefc53885d469c3c37ef68103d49aa (patch) | |
| tree | 848ff6c93f4637a231cce418c226779c1f3078eb /doc/misc | |
| parent | 9512f8201149fd69b01f8f3f84c64dde995ca12a (diff) | |
| download | emacs-031b2ea7f5cefc53885d469c3c37ef68103d49aa.tar.gz emacs-031b2ea7f5cefc53885d469c3c37ef68103d49aa.zip | |
More cl-lib and gv doc updates
* lisp/emacs-lisp/cl.el (define-setf-expander, defsetf)
(define-modify-macro): Doc fixes.
* doc/misc/cl.texi (Obsolete Setf Customization):
Give defsetf gv.el replacements.
* etc/NEWS: Related edit.
Diffstat (limited to 'doc/misc')
| -rw-r--r-- | doc/misc/ChangeLog | 2 | ||||
| -rw-r--r-- | doc/misc/cl.texi | 29 |
2 files changed, 20 insertions, 11 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 93a2971f8c6..6951f2df79d 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | * cl.texi (Obsolete Setf Customization): | 3 | * cl.texi (Obsolete Setf Customization): |
| 4 | Revert defsetf example to the more correct let rather than prog1. | 4 | Revert defsetf example to the more correct let rather than prog1. |
| 5 | Give define-modify-macro gv.el replacement. | 5 | Give define-modify-macro and defsetf gv.el replacements. |
| 6 | 6 | ||
| 7 | 2012-11-06 Glenn Morris <rgm@gnu.org> | 7 | 2012-11-06 Glenn Morris <rgm@gnu.org> |
| 8 | 8 | ||
diff --git a/doc/misc/cl.texi b/doc/misc/cl.texi index 21750b79c93..d3c9ad6aedf 100644 --- a/doc/misc/cl.texi +++ b/doc/misc/cl.texi | |||
| @@ -5019,14 +5019,16 @@ These translate directly to @code{gv-define-simple-setter}: | |||
| 5019 | @end defmac | 5019 | @end defmac |
| 5020 | 5020 | ||
| 5021 | @defmac defsetf access-fn arglist (store-var) forms@dots{} | 5021 | @defmac defsetf access-fn arglist (store-var) forms@dots{} |
| 5022 | This is the second, more complex, form of @code{defsetf}. It is | 5022 | This is the second, more complex, form of @code{defsetf}. |
| 5023 | rather like @code{defmacro} except for the additional @var{store-var} | 5023 | It can be replaced by @code{gv-define-setter}. |
| 5024 | argument. The @var{forms} should return a Lisp form that stores | 5024 | |
| 5025 | the value of @var{store-var} into the generalized variable formed | 5025 | This form of @code{defsetf} is rather like @code{defmacro} except for |
| 5026 | by a call to @var{access-fn} with arguments described by @var{arglist}. | 5026 | the additional @var{store-var} argument. The @var{forms} should |
| 5027 | The @var{forms} may begin with a string which documents the @code{setf} | 5027 | return a Lisp form that stores the value of @var{store-var} into the |
| 5028 | method (analogous to the doc string that appears at the front of a | 5028 | generalized variable formed by a call to @var{access-fn} with |
| 5029 | function). | 5029 | arguments described by @var{arglist}. The @var{forms} may begin with |
| 5030 | a string which documents the @code{setf} method (analogous to the doc | ||
| 5031 | string that appears at the front of a function). | ||
| 5030 | 5032 | ||
| 5031 | For example, the simple form of @code{defsetf} is shorthand for | 5033 | For example, the simple form of @code{defsetf} is shorthand for |
| 5032 | 5034 | ||
| @@ -5041,11 +5043,18 @@ macros like @code{cl-incf} that invoke this | |||
| 5041 | setf-method will insert temporary variables as needed to make | 5043 | setf-method will insert temporary variables as needed to make |
| 5042 | sure the apparent order of evaluation is preserved. | 5044 | sure the apparent order of evaluation is preserved. |
| 5043 | 5045 | ||
| 5044 | Another example drawn from the standard package: | 5046 | Another standard example: |
| 5045 | 5047 | ||
| 5046 | @example | 5048 | @example |
| 5047 | (defsetf nth (n x) (store) | 5049 | (defsetf nth (n x) (store) |
| 5048 | (list 'setcar (list 'nthcdr n x) store)) | 5050 | `(setcar (nthcdr ,n ,x) ,store)) |
| 5051 | @end example | ||
| 5052 | |||
| 5053 | You could write this using @code{gv-define-setter} as: | ||
| 5054 | |||
| 5055 | @example | ||
| 5056 | (gv-define-setter nth (store n x) | ||
| 5057 | `(setcar (nthcdr ,n ,x) ,store)) | ||
| 5049 | @end example | 5058 | @end example |
| 5050 | @end defmac | 5059 | @end defmac |
| 5051 | 5060 | ||