Function: elisp-scope-describe-symbol-role

elisp-scope-describe-symbol-role is an autoloaded, interactive and byte-compiled function defined in elisp-scope.el.gz.

Signature

(elisp-scope-describe-symbol-role ROLE &rest _)

Documentation

Describe ROLE of a symbol.

Interactively, prompt for ROLE.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/elisp-scope.el.gz
;;;###autoload
(defun elisp-scope-describe-symbol-role (role &rest _)
  "Describe ROLE of a symbol.
Interactively, prompt for ROLE."
  (interactive (list (elisp-scope-read-symbol-role
                      "Describe symbol role"
                      (when-let* ((def (symbol-at-point))
                                  ((elisp-scope-symbol-role-p def)))
                        def))))
  (when (stringp role) (setq role (intern role)))
  (let ((help-buffer-under-preparation t))
    (help-setup-xref (list #'elisp-scope-describe-symbol-role role)
                     (called-interactively-p 'interactive))
    (with-help-window (help-buffer)
      (with-current-buffer standard-output
        (insert "Symbol role "
                (substitute-quotes (concat "`" (symbol-name role) "'"))
                ":\n\n"
                (substitute-quotes
                 (or (elisp-scope-get-symbol-role-property role :doc)
                     "Undocumented.")))
        (when-let* ((parents (get role 'elisp-scope-parent-roles)))
          (insert "\n\nParent roles: "
                  (mapconcat (lambda (parent)
                               (let ((name (symbol-name parent)))
                                 (substitute-quotes
                                  (concat
                                   "`"
                                   (buttonize
                                    name #'elisp-scope-describe-symbol-role name
                                    "mouse-2, RET: describe this symbol role")
                                   "'"))))
                             parents ", ")))
        ;; Return the text we displayed for `describe-symbol-backends'.
        (buffer-string)))))