Function: treesit-beginning-of-thing

treesit-beginning-of-thing is a byte-compiled function defined in treesit.el.gz.

Signature

(treesit-beginning-of-thing PATTERN &optional ARG)

Documentation

Like beginning-of-defun, but generalized into things.

PATTERN is like treesit-defun-type-regexp, ARG is the same as in beginning-of-defun.

Return non-nil if successfully moved, nil otherwise.

Source Code

;; Defined in /usr/src/emacs/lisp/treesit.el.gz
(defun treesit-beginning-of-thing (pattern &optional arg)
  "Like `beginning-of-defun', but generalized into things.

PATTERN is like `treesit-defun-type-regexp', ARG
is the same as in `beginning-of-defun'.

Return non-nil if successfully moved, nil otherwise."
  (pcase-let* ((arg (or arg 1))
               (`(,regexp . ,pred) (treesit--thing-unpack-pattern
                                    pattern))
               (dest (treesit--navigate-thing
                      (point) (- arg) 'beg regexp pred)))
    (when dest
      (goto-char dest))))