emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master b74c884: * lisp/emacs-lisp/cl-macs.el (cl-defstruct


From: Artur Malabarba
Subject: [Emacs-diffs] master b74c884: * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Fix a bug
Date: Sat, 07 Nov 2015 12:56:50 +0000

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

    * lisp/emacs-lisp/cl-macs.el (cl-defstruct): Fix a bug
    
    The defsubst was being created as:
        (cl-defsubst name (args) ("DOC") ...)
    
    * test/automated/cl-lib-tests.el (cl-lib-struct-constructors): Add test
---
 lisp/emacs-lisp/cl-macs.el     |    2 +-
 test/automated/cl-lib-tests.el |    8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index c42094f..80f0cd7 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -2730,7 +2730,7 @@ non-nil value, that slot cannot be set via `setf'.
                            slots defaults)))
        (push `(cl-defsubst ,cname
                    (&cl-defs (nil ,@descs) ,@args)
-                 ,(if (stringp doc) (list doc)
+                 ,(if (stringp doc) doc
                     (format "Constructor for objects of type `%s'." name))
                  ,@(if (cl--safe-expr-p `(progn ,@(mapcar #'cl-second descs)))
                        '((declare (side-effect-free t))))
diff --git a/test/automated/cl-lib-tests.el b/test/automated/cl-lib-tests.el
index 1bdc6d7..b31622f 100644
--- a/test/automated/cl-lib-tests.el
+++ b/test/automated/cl-lib-tests.el
@@ -206,7 +206,8 @@
 
 (cl-defstruct (mystruct
                (:constructor cl-lib--con-1 (&aux (abc 1)))
-               (:constructor cl-lib--con-2 (&optional def)))
+               (:constructor cl-lib--con-2 (&optional def) "Constructor 
docstring."))
+  "General docstring."
   (abc 5 :readonly t) (def nil))
 (ert-deftest cl-lib-struct-accessors ()
   (let ((x (make-mystruct :abc 1 :def 2)))
@@ -220,6 +221,11 @@
               (`((cl-tag-slot) (abc 5 :readonly t)
                  (def . ,(or `nil `(nil))))
                t)))))
+(ert-deftest cl-lib-struct-constructors ()
+  (should (equal (documentation 'cl-lib--con-2 t)
+                 "Constructor docstring."))
+  (should (mystruct-p (cl-lib--con-1)))
+  (should (mystruct-p (cl-lib--con-2))))
 
 (ert-deftest cl-lib-arglist-performance ()
   ;; An `&aux' should not cause lambda's arglist to be turned into an &rest



reply via email to

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