Yuan Fu writes: > What’s the return value of (treesit-node-at (point)) at that point? > Probably the command_substitution node, and since it doesn’t have any > children, treesit-node-first-child-for-pos would return nil. (treesit-node-at (point) 'bash) => # I forgot to say that point is before "text2", outside of the command_substitution node. > Yuan tee << EOF text1 $var text2 $(echo cmd) text3 $var2 EOF Filling a test buffer with these contents and placing point before "text2", we get (treesit-node-at (point) 'bash) => # (treesit-node-children (treesit-node-at (point) 'bash)) => (# # #) This is now expected. (point) => 23 (treesit-node-first-child-for-pos (treesit-node-at (point) 'bash) (point)) => nil This is not expected. One would expect this to return command_substitution node, since it follows the position 23.