Function: treesit-fold-summary--get

treesit-fold-summary--get is a natively compiled function defined in treesit-fold-summary.el.

Signature

(treesit-fold-summary--get DOC-STR)

Documentation

Extract summary from DOC-STR in order to display ontop of the overlay.

Source Code

;; Defined in /nix/store/mpy1l6b4hlzpp59l4vbahq83hqa821ci-emacs-packages-deps/share/emacs/site-lisp/elpa/treesit-fold-0.2.1/treesit-fold-summary.el
(defun treesit-fold-summary--get (doc-str)
  "Extract summary from DOC-STR in order to display ontop of the overlay."
  (let ((parser (cdr (treesit-fold-summary--parser))) summary
        (map (make-sparse-keymap)))
    (keymap-set map "<mouse-1>" #'treesit-fold-open)
    (when parser
      (setq summary (funcall parser doc-str))
      (when (integerp treesit-fold-summary-max-length)
        (setq summary (treesit-fold-summary--keep-length summary)))
      (when summary
        (setq summary (treesit-fold-summary--apply-format summary)
              summary (propertize summary 'face 'treesit-fold-replacement-face
                                  'mouse-face 'treesit-fold-replacement-mouse-face
                                  'keymap map))))
    summary))