Subject: bug#74448: 30.0.92; c-ts-mode outlines only work with GNU or emacs style

From: Juri Linkov <[email-masked]>
Date: Thu, 21 Nov 2024 20:17:05 +0200

> At the moment I am experimenting with this solution (DEFUN part omitted
> for brevity) but it's probably missing some edge case I am not aware of:
>
> (defun c-ts-mode--outline-predicate (node)
>   "Match outlines on lines with function names."
>   (when-let* ((decl (treesit-node-child-by-field-name
>                      (treesit-node-parent node) "declarator"))
>               (node-pos (treesit-node-start node))
>               (decl-pos (treesit-node-start decl))
>               (eol (save-excursion (goto-char node-pos) (line-end-position))))
>     (and (equal (treesit-node-type decl) "function_declarator")
>          (<= node-pos decl-pos)
>          (< decl-pos eol))))
>
> Idea is to match a function declarator in the same line as `node' no
> matter what node is at bol.

Thanks, I confirm your solution is better than the current state.
Hope you could find a common denominator that covers all possible cases.