Function: neocaml--grand-parent-bol
neocaml--grand-parent-bol is a natively compiled function defined in
neocaml.el.
Signature
(neocaml--grand-parent-bol NODE PARENT BOL &rest _)
Documentation
Return the first non-whitespace position on PARENT's parent's line.
This is like parent-bol but goes one level up in the tree.
Useful when PARENT (like variant_declaration) starts on the same
line as its first child, causing parent-bol to shift after that
child is indented.
Source Code
;; Defined in /nix/store/ahssdx4rwzyxhyhavpn0bkznk13xrggi-emacs-packages-deps/share/emacs/site-lisp/elpa/neocaml-20260907.2015/neocaml.el
;;;; Indentation
;; Tree-sitter indentation rules for OCaml
;; Adapted from nvim indentation queries in nvim-treesitter
;;
;; The `ocaml-interface' grammar shares all node types with `ocaml',
;; so a single set of indentation rules works for both languages.
;;
;; NB: `treesit--indent-1' sets NODE to the largest node
;; whose start equals BOL. For continuation lines inside a multi-line
;; node (e.g., lines inside a comment), NODE is nil and PARENT is the
;; enclosing node. This means `node-is' won't match those lines —
;; use `parent-is' instead, and place such rules before `no-node'.
(defun neocaml--grand-parent-bol (_node parent _bol &rest _)
"Return the first non-whitespace position on PARENT's parent's line.
This is like `parent-bol' but goes one level up in the tree.
Useful when PARENT (like `variant_declaration') starts on the same
line as its first child, causing `parent-bol' to shift after that
child is indented."
(when-let* ((gp (treesit-node-parent parent)))
(save-excursion
(goto-char (treesit-node-start gp))
(back-to-indentation)
(point))))