summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/cl-extra.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2021-06-24 20:13:08 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2021-06-24 20:13:08 +0200
commitbf21aba533864bf0179b2e76f4bdc2e7c6cce726 (patch)
tree7d6135350ee8d0ebc660ae82869a56781f71dcbe /lisp/emacs-lisp/cl-extra.el
parent8e6d6daacf3994a68f81b92ae2ce47ccf2a7bf28 (diff)
downloademacs-bf21aba533864bf0179b2e76f4bdc2e7c6cce726.tar.gz
Fix printing of defclass documentation slots again
* 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).
Diffstat (limited to 'lisp/emacs-lisp/cl-extra.el')
-rw-r--r--lisp/emacs-lisp/cl-extra.el10
1 files changed, 8 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el
index eabba27d229..13036544825 100644
--- a/lisp/emacs-lisp/cl-extra.el
+++ b/lisp/emacs-lisp/cl-extra.el
@@ -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)))))