Function: magit-describe-section

magit-describe-section is an interactive and byte-compiled function defined in magit-section.el.

Signature

(magit-describe-section SECTION &optional INTERACTIVE-P)

Documentation

Show information about the section at point.

The main purpose of this command is to direct the user to the function used to insert the section at point, and to the hook, from which that function is called. This information is useful, for example, if one wants to stop displaying a certain section. Or if one wants to learn about related options.

That function may also be responsible for inserting the parent and siblings of the section at point. If that is the case, this command identifies that ancestor section, not the actual section at point.

Use magit-describe-section-briefly to always identify precisely the innermost section at point.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/magit-section-20261018.807/magit-section.el
(defun magit-describe-section (section &optional interactive-p)
  "Show information about the section at point.

The main purpose of this command is to direct the user to the function
used to insert the section at point, and to the hook, from which that
function is called.  This information is useful, for example, if one
wants to stop displaying a certain section.  Or if one wants to learn
about related options.

That function may also be responsible for inserting the parent and
siblings of the section at point.  If that is the case, this command
identifies that ancestor section, not the actual section at point.

Use `magit-describe-section-briefly' to always identify precisely the
innermost section at point."
  (interactive (list (magit-current-section) t))
  (let ((inserter-section section))
    (while (and inserter-section (not (oref inserter-section inserter)))
      (setq inserter-section (oref inserter-section parent)))
    (when (and inserter-section (oref inserter-section inserter))
      (setq section inserter-section)))
  (pcase (oref section inserter)
    (`((,hook ,fun) . ,src-src)
     (help-setup-xref `(magit-describe-section ,section) interactive-p)
     (with-help-window (help-buffer)
       (with-current-buffer standard-output
         (insert (format-message
                  "%s\n  is inserted by `%s'\n  from `%s'"
                  (magit-describe-section-briefly section)
                  (make-text-button (symbol-name fun) nil
                                    :type 'help-function
                                    'help-args (list fun))
                  (make-text-button (symbol-name hook) nil
                                    :type 'help-variable
                                    'help-args (list hook))))
         (pcase-dolist (`(,hook ,fun) src-src)
           (insert (format-message
                    ",\n  called by `%s'\n  from `%s'"
                    (make-text-button (symbol-name fun) nil
                                      :type 'help-function
                                      'help-args (list fun))
                    (make-text-button (symbol-name hook) nil
                                      :type 'help-variable
                                      'help-args (list hook)))))
         (insert ".\n\n")
         (insert
          (format-message
           "`%s' is "
           (make-text-button (symbol-name fun) nil
                             :type 'help-function 'help-args (list fun))))
         (describe-function-1 fun))))
    (_ (message "%s, inserter unknown"
                (magit-describe-section-briefly section)))))