Function: treesit-default-defun-skipper

treesit-default-defun-skipper is a byte-compiled function defined in treesit.el.gz.

Signature

(treesit-default-defun-skipper)

Documentation

Skips spaces after navigating a defun.

This function tries to move to the beginning of a line, either by moving to the empty newline after a defun, or to the beginning of the current line if the beginning of the defun is indented.

Source Code

;; Defined in /usr/src/emacs/lisp/treesit.el.gz
(defun treesit-default-defun-skipper ()
  "Skips spaces after navigating a defun.
This function tries to move to the beginning of a line, either by
moving to the empty newline after a defun, or to the beginning of
the current line if the beginning of the defun is indented."
  ;; Moving forward, point at the end of a line and not already on an
  ;; empty line: go to BOL of the next line (which hopefully is an
  ;; empty line).
  (cond ((and (looking-at (rx (* (or " " "\t")) "\n"))
              (not (bolp)))
         (forward-line 1))
        ;; Moving backward, but there are some whitespace (and only
        ;; whitespace) between point and BOL: go back to BOL.
        ((looking-back (rx bol (+ (or " " "\t")))
                       (line-beginning-position))
         (beginning-of-line))))