Function: c-ts-mode--standalone-parent
c-ts-mode--standalone-parent is a byte-compiled function defined in
c-ts-mode.el.gz.
Signature
(c-ts-mode--standalone-parent N PARENT &rest _)
Documentation
Like the standalone-parent anchor but skips preproc nodes and labels.
PARENT is the parent of the current node.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/c-ts-mode.el.gz
(defun c-ts-mode--standalone-parent (_n parent &rest _)
"Like the standalone-parent anchor but skips preproc nodes and labels.
PARENT is the parent of the current node."
(save-excursion
(treesit-node-start
(treesit-parent-until
;; Use PARENT rather than NODE, to handle the case where NODE is
;; nil.
parent (lambda (node)
(and node
(not (treesit-node-match-p
node (rx (or "preproc" "labeled_statement"))))
(progn
(goto-char (treesit-node-start node))
(looking-back (rx bol (* whitespace))
(line-beginning-position)))))
t))))