emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 13634de 1/2: * lisp/emacs-lisp/cl-macs.el (cl-defst


From: Artur Malabarba
Subject: [Emacs-diffs] master 13634de 1/2: * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Implement docstrings
Date: Mon, 13 Apr 2015 19:54:26 +0000

branch: master
commit 13634dec038d613c3b618d70cd64d6d63561f2eb
Author: Artur Malabarba <address@hidden>
Commit: Artur Malabarba <address@hidden>

    * 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).
---
 lisp/emacs-lisp/cl-macs.el |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 41435b8..5bab84e 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))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]