Function: treesit-show-paren-data

treesit-show-paren-data is a byte-compiled function defined in treesit.el.gz.

Signature

(treesit-show-paren-data)

Documentation

A function suitable for show-paren-data-function (which see).

Probably introduced at or before Emacs version 31.1.

Source Code

;; Defined in /usr/src/emacs/lisp/treesit.el.gz
(defun treesit-show-paren-data ()
  "A function suitable for `show-paren-data-function' (which see)."
  (or (treesit-show-paren-data--categorize (point))
      (unless (bobp) (treesit-show-paren-data--categorize (point) t))
      (when show-paren-when-point-in-periphery
        (let* ((ind-pos (save-excursion (back-to-indentation) (point)))
               (eol-pos
                (save-excursion
                  (end-of-line) (skip-chars-backward " \t" ind-pos) (point))))
          (cond
           ((<= (point) ind-pos)
            (or (treesit-show-paren-data--categorize ind-pos)
                (unless (bobp)
                  (treesit-show-paren-data--categorize (1- eol-pos)))))
           ((>= (point) eol-pos)
            (unless (bobp)
              (treesit-show-paren-data--categorize (1- eol-pos)))))))
      ;; Fall back for parens in e.g. 'for_statement'
      (show-paren--default)))