Function: treesit-node-prev-sibling

treesit-node-prev-sibling is a function defined in treesit.c.

Signature

(treesit-node-prev-sibling NODE &optional NAMED)

Documentation

Return the previous sibling of NODE.

Return nil if there is no previous sibling. If NAMED is non-nil, look for named siblings only. NAMED defaults to nil. If NODE is nil, return nil.

Other relevant functions are documented in the treesit group.

View in manual

Shortdoc

;; treesit
(treesit-node-prev-sibling node)
    e.g. => #<treesit-node (primitive_type) in 1-4>

Source Code

// Defined in /usr/src/emacs/src/treesit.c
{
  if (NILP (node)) return Qnil;
  treesit_check_node (node);
  treesit_initialize ();

  TSNode treesit_node = XTS_NODE (node)->node;
  TSNode sibling;

  if (NILP (named))
    sibling = ts_node_prev_sibling (treesit_node);
  else
    sibling = ts_node_prev_named_sibling (treesit_node);

  if (ts_node_is_null (sibling))
    return Qnil;

  return make_treesit_node (XTS_NODE (node)->parser, sibling);
}