From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Artur Malabarba Newsgroups: gmane.emacs.bugs Subject: bug#15031: Status: 24.3.50; doc for `(cl-)defstruct' and its generated functions Date: Mon, 13 Apr 2015 13:19:16 +0100 Message-ID: References: Reply-To: bruce.connor.am@gmail.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1428927627 21243 80.91.229.3 (13 Apr 2015 12:20:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 13 Apr 2015 12:20:27 +0000 (UTC) To: "bug#15031" <15031@debbugs.gnu.org> Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Apr 13 14:20:19 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YhdLc-0007n2-6S for geb-bug-gnu-emacs@m.gmane.org; Mon, 13 Apr 2015 14:20:16 +0200 Original-Received: from localhost ([::1]:51446 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YhdLb-0002Bs-Gd for geb-bug-gnu-emacs@m.gmane.org; Mon, 13 Apr 2015 08:20:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53821) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YhdLT-0002AS-Th for bug-gnu-emacs@gnu.org; Mon, 13 Apr 2015 08:20:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YhdLQ-0000RG-LA for bug-gnu-emacs@gnu.org; Mon, 13 Apr 2015 08:20:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:36838) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YhdLQ-0000Q4-H8 for bug-gnu-emacs@gnu.org; Mon, 13 Apr 2015 08:20:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YhdLP-0000mj-Jk for bug-gnu-emacs@gnu.org; Mon, 13 Apr 2015 08:20:03 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Artur Malabarba Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 13 Apr 2015 12:20:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15031 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 15031-submit@debbugs.gnu.org id=B15031.14289275762976 (code B ref 15031); Mon, 13 Apr 2015 12:20:03 +0000 Original-Received: (at 15031) by debbugs.gnu.org; 13 Apr 2015 12:19:36 +0000 Original-Received: from localhost ([127.0.0.1]:54847 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YhdKm-0000lk-8Q for submit@debbugs.gnu.org; Mon, 13 Apr 2015 08:19:36 -0400 Original-Received: from mail-lb0-f171.google.com ([209.85.217.171]:34711) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YhdKk-0000lX-EW for 15031@debbugs.gnu.org; Mon, 13 Apr 2015 08:19:23 -0400 Original-Received: by lbcga7 with SMTP id ga7so57055436lbc.1 for <15031@debbugs.gnu.org>; Mon, 13 Apr 2015 05:19:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:date:message-id:subject:from:to :content-type; bh=xm5IdJHO6rD9IF73XLjKjEz4yPo3xHmxwTWWsjmp0ro=; b=oE1bb5yrQ86EHeyW5ARrjXCLEf2cLS9eNEfirTEebcm4TD9K+fHsSVg2lY0kvRQLux ptNq1nz7XyMn+Ab8yOtGWpQi+zixKKCOtFoLlJ3sJD0wtwygVd5EDHvQ1zktktdSM9qm aWXUqVOK4hXIq42oDyYDhJ/HcFe6ceSPFvDswpdHRKVhCCbWkJeC/mkBwy9eDZsv/xpF CRUSAIwa28aQlva30wkth4W/KNrdhmw8lYTnP/3527cgIS1ucpuqZB9HMZY3go7ojaNe kMAdBe3AjNGqH+fkij2DsMQuxGj1D2nWsfHQR1+f1qXb1fwYkXBV6w+Bn6pLAqHtN4Vc lJNg== X-Received: by 10.152.43.110 with SMTP id v14mr12983762lal.4.1428927556373; Mon, 13 Apr 2015 05:19:16 -0700 (PDT) Original-Received: by 10.25.150.131 with HTTP; Mon, 13 Apr 2015 05:19:16 -0700 (PDT) X-Google-Sender-Auth: pc-SgajxCUKZCo5k0CWkFSQmp0E X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:101468 Archived-At: 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 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