Mercurial > emacs
comparison lisp/emacs-lisp/cl-macs.el @ 106936:d8549f97592e
Merge from mainline.
author | Katsumi Yamaoka <yamaoka@jpl.org> |
---|---|
date | Sun, 17 Jan 2010 21:57:00 +0000 |
parents | f364eaefe2b4 |
children | 893b1b725ad5 |
comparison
equal
deleted
inserted
replaced
106935:ff8134865c63 | 106936:d8549f97592e |
---|---|
2189 ;;; Structures. | 2189 ;;; Structures. |
2190 | 2190 |
2191 ;;;###autoload | 2191 ;;;###autoload |
2192 (defmacro defstruct (struct &rest descs) | 2192 (defmacro defstruct (struct &rest descs) |
2193 "Define a struct type. | 2193 "Define a struct type. |
2194 This macro defines a new Lisp data type called NAME, which contains data | 2194 This macro defines a new data type called NAME that stores data |
2195 stored in SLOTs. This defines a `make-NAME' constructor, a `copy-NAME' | 2195 in SLOTs. It defines a `make-NAME' constructor, a `copy-NAME' |
2196 copier, a `NAME-p' predicate, and setf-able `NAME-SLOT' accessors. | 2196 copier, a `NAME-p' predicate, and slot accessors named `NAME-SLOT'. |
2197 | 2197 You can use the accessors to set the corresponding slots, via `setf'. |
2198 \(fn (NAME OPTIONS...) (SLOT SLOT-OPTS...)...)" | 2198 |
2199 NAME may instead take the form (NAME OPTIONS...), where each | |
2200 OPTION is either a single keyword or (KEYWORD VALUE). | |
2201 See Info node `(cl)Structures' for a list of valid keywords. | |
2202 | |
2203 Each SLOT may instead take the form (SLOT SLOT-OPTS...), where | |
2204 SLOT-OPTS are keyword-value pairs for that slot. Currently, only | |
2205 one keyword is supported, `:read-only'. If this has a non-nil | |
2206 value, that slot cannot be set via `setf'. | |
2207 | |
2208 \(fn NAME SLOTS...)" | |
2199 (let* ((name (if (consp struct) (car struct) struct)) | 2209 (let* ((name (if (consp struct) (car struct) struct)) |
2200 (opts (cdr-safe struct)) | 2210 (opts (cdr-safe struct)) |
2201 (slots nil) | 2211 (slots nil) |
2202 (defaults nil) | 2212 (defaults nil) |
2203 (conc-name (concat (symbol-name name) "-")) | 2213 (conc-name (concat (symbol-name name) "-")) |