* lisp/emacs-lisp/cl-macs.el (cl-defstruct): Add docstring to accessors.

This commit is contained in:
Stefan Monnier 2016-05-27 12:34:33 -04:00
parent 84f431224c
commit 09b72fc38a

View file

@ -2672,15 +2672,17 @@ non-nil value, that slot cannot be set via `setf'.
(let ((accessor (intern (format "%s%s" conc-name slot)))) (let ((accessor (intern (format "%s%s" conc-name slot))))
(push slot slots) (push slot slots)
(push (nth 1 desc) defaults) (push (nth 1 desc) defaults)
(push `(cl-defsubst ,accessor (cl-x) (push `(cl-defsubst ,accessor (x)
,(format "Access slot \"%s\" of `%s' struct X."
slot struct)
(declare (side-effect-free t)) (declare (side-effect-free t))
,@(and pred-check ,@(and pred-check
(list `(or ,pred-check (list `(or ,pred-check
(signal 'wrong-type-argument (signal 'wrong-type-argument
(list ',name cl-x))))) (list ',name x)))))
,(if (memq type '(nil vector)) `(aref cl-x ,pos) ,(if (memq type '(nil vector)) `(aref x ,pos)
(if (= pos 0) '(car cl-x) (if (= pos 0) '(car x)
`(nth ,pos cl-x)))) `(nth ,pos x))))
forms) forms)
(if (cadr (memq :read-only (cddr desc))) (if (cadr (memq :read-only (cddr desc)))
(push `(gv-define-expander ,accessor (push `(gv-define-expander ,accessor