]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix printing of defclass documentation slots again
authorLars Ingebrigtsen <larsi@gnus.org>
Thu, 24 Jun 2021 18:13:08 +0000 (20:13 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Thu, 24 Jun 2021 18:13:08 +0000 (20:13 +0200)
* lisp/emacs-lisp/cl-extra.el (cl--describe-class-slots): Fix
printing defclass slots, and retain printing of defstruct slots
(bug#30998 and bug#46662).

lisp/emacs-lisp/cl-extra.el

index eabba27d2298356958f81a9c7a63b269213e0550..13036544825e88dea2d1d8a052b1bad2dbd09c97 100644 (file)
@@ -897,8 +897,14 @@ Outputs to the current buffer."
                (list (cl-prin1-to-string (cl--slot-descriptor-name slot))
                      (cl-prin1-to-string (cl--slot-descriptor-type slot))
                      (cl-prin1-to-string (cl--slot-descriptor-initform slot))
-                     (let ((doc (plist-get (cl--slot-descriptor-props slot)
-                                           :documentation)))
+                     (let ((doc
+                            ;; The props are an alist in a `defclass',
+                            ;; but a plist when describing a `cl-defstruct'.
+                            (if (consp (car (cl--slot-descriptor-props slot)))
+                                (alist-get :documentation
+                                           (cl--slot-descriptor-props slot))
+                              (plist-get (cl--slot-descriptor-props slot)
+                                         :documentation))))
                        (if (not doc) ""
                          (setq has-doc t)
                          (substitute-command-keys doc)))))