summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorArtur Malabarba <bruce.connor.am@gmail.com>2015-04-13 13:13:36 +0100
committerArtur Malabarba <bruce.connor.am@gmail.com>2015-04-13 20:51:14 +0100
commit13634dec038d613c3b618d70cd64d6d63561f2eb (patch)
tree4723e8a78972cb6bf9caaf9717b686916e2d19bd /lisp/emacs-lisp
parent84e0b7dad6f1a8e53261f9b96f5a9080fea681a4 (diff)
downloademacs-13634dec038d613c3b618d70cd64d6d63561f2eb.tar.gz
emacs-13634dec038d613c3b618d70cd64d6d63561f2eb.tar.bz2
emacs-13634dec038d613c3b618d70cd64d6d63561f2eb.zip
* lisp/emacs-lisp/cl-macs.el (cl-defstruct): Implement docstrings
Adding a string after a constructor's argument list will use that string as the constructor function docstring. If this string is absent but the struct itself was given a docstring, use that as the constructor's docstring. Fixes (bug#17284).
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/cl-macs.el6
1 files changed, 5 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 41435b8b7b1..5bab84ed312 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -2726,12 +2726,16 @@ non-nil value, that slot cannot be set via `setf'.
constrs))
(while constrs
(let* ((name (caar constrs))
- (args (cadr (pop constrs)))
+ (rest (cdr (pop constrs)))
+ (args (car rest))
+ (doc (cadr rest))
(anames (cl--arglist-args args))
(make (cl-mapcar (function (lambda (s d) (if (memq s anames) s d)))
slots defaults)))
(push `(cl-defsubst ,name
(&cl-defs (nil ,@descs) ,@args)
+ ,@(if (stringp doc) (list doc)
+ (if (stringp docstring) (list docstring)))
,@(if (cl--safe-expr-p `(progn ,@(mapcar #'cl-second descs)))
'((declare (side-effect-free t))))
(,(or type #'vector) ,@make))