all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Artur Malabarba <bruce.connor.am@gmail.com>
To: "bug#15031" <15031@debbugs.gnu.org>
Subject: bug#15031: Status: 24.3.50; doc for `(cl-)defstruct' and its generated functions
Date: Mon, 13 Apr 2015 13:19:16 +0100	[thread overview]
Message-ID: <CAAdUY-J1e=LcXsKVwymnA_+2xJakX9Wu5pNjx8ec7ZaumEXGAA@mail.gmail.com> (raw)
In-Reply-To: <dca353e2-f669-47ef-9f24-2d43e40ef742@default>

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@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





  reply	other threads:[~2015-04-13 12:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-06  0:06 bug#15031: 24.3.50; doc for `(cl-)defstruct' and its generated functions Drew Adams
2015-04-13 12:19 ` Artur Malabarba [this message]
2015-04-13 14:08   ` bug#15031: Status: " Stefan Monnier
2015-04-13 19:56     ` Artur Malabarba
2015-04-13 20:29       ` Eli Zaretskii
2015-04-13 21:09         ` Artur Malabarba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAAdUY-J1e=LcXsKVwymnA_+2xJakX9Wu5pNjx8ec7ZaumEXGAA@mail.gmail.com' \
    --to=bruce.connor.am@gmail.com \
    --cc=15031@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.