Function: cl--describe-class
cl--describe-class is a byte-compiled function defined in
cl-extra.el.gz.
Signature
(cl--describe-class TYPE &optional CLASS)
Aliases
eieio-help-class (obsolete since 25.1)
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/cl-extra.el.gz
(defun cl--describe-class (type &optional class)
(unless class (setq class (cl--find-class type)))
(let ((location (find-lisp-object-file-name type 'define-type))
(metatype (type-of class)))
(insert (symbol-name type)
(substitute-command-keys " is a type (of kind `"))
(help-insert-xref-button (symbol-name metatype)
'help-type metatype)
(insert (substitute-command-keys "')"))
(when location
(insert (substitute-command-keys " in `"))
(help-insert-xref-button
(help-fns-short-filename location)
'cl-type-definition type location 'define-type)
(insert (substitute-quotes "'")))
(insert ".\n")
;; Parents.
(let ((pl (cl--class-parents class))
cur)
(when pl
(insert " Inherits from ")
(while (setq cur (pop pl))
(setq cur (cl--class-name cur))
(insert (substitute-quotes "`"))
(help-insert-xref-button (symbol-name cur)
'help-type cur)
(insert (substitute-command-keys (if pl "', " "'"))))
(insert ".\n")))
;; Children.
(let ((ch (cl--class-children class))
cur)
(when ch
(insert " Children ")
(while (setq cur (pop ch))
(insert (substitute-quotes "`"))
(help-insert-xref-button (symbol-name cur)
'help-type cur)
(insert (substitute-command-keys (if ch "', " "'"))))
(insert ".\n")))
;; Describe all the slots in this class.
;; Put it before the docstring, since the docstring may want
;; to refer to the slots.
(cl--describe-class-slots class)
;; Type's documentation.
(let ((doc (cl--class-docstring class)))
(when doc
(insert (if (save-excursion
(or (< (skip-chars-backward "\n") -1) (bobp)))
""
"\n")
doc "\n\n")))
;; Describe all the methods specific to this class.
(let ((generics (cl-generic-all-functions type)))
(when generics
(insert (propertize "Specialized Methods:\n\n" 'face 'bold))
(dolist (generic generics)
(insert (substitute-quotes "`"))
(help-insert-xref-button (symbol-name generic)
'help-function generic)
(insert (substitute-quotes "'"))
(pcase-dolist (`(,qualifiers ,args ,doc)
(cl--generic-method-documentation generic type))
(insert (format " %s%S\n" qualifiers args)
(or doc "")))
(insert "\n\n"))))))