GNU bug report logs -
#15031
24.3.50; doc for `(cl-)defstruct' and its generated functions
Previous Next
Reported by: Drew Adams <drew.adams <at> oracle.com>
Date: Tue, 6 Aug 2013 00:08:02 UTC
Severity: minor
Merged with 13572
Found in version 24.3.50
Done: Artur Malabarba <bruce.connor.am <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
The following patch should implement bug#15031. It passes make check
and seems to work as intended for me. Should I apply?
From 4cac6c23214e8d1a5300dffef78b853954d79e71 Mon Sep 17 00:00:00 2001
From: Artur Malabarba <bruce.connor.am <at> gmail.com>
Date: Mon, 13 Apr 2015 13:13:36 +0100
Subject: [PATCH] * 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
---
lisp/emacs-lisp/cl-macs.el | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 41435b8..b91a310 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 doc (list doc)
+ (if docstring (list docstring)))
,@(if (cl--safe-expr-p `(progn ,@(mapcar #'cl-second descs)))
'((declare (side-effect-free t))))
(,(or type #'vector) ,@make))
--
2.3.5
This bug report was last modified 10 years and 37 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.