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

From: Juri Linkov <[email-masked]>
Date: Thu, 30 Jan 2025 09:28:15 +0200

> Feel free to improve on this if you decide to install it

Hi, Filippo.

Do you remember why we removed this condition from
'c-ts-mode--defun-name':

  (equal (treesit-node-type (treesit-node-parent node))
         "function_definition")

Without this condition outline headings are added to every single line
of function_declarator, e.g.:

  int clusterAddNode(clusterNode *node);

  int clusterLoadConfig(char *filename) {
    FILE *fp = fopen(filename,"r");
  }
=>
  (translation_unit
   (declaration type: (primitive_type)
    declarator: 
     (function_declarator declarator: (identifier)
     ...
    ;)
   (function_definition type: (primitive_type)
    declarator: 
     (function_declarator declarator: (identifier)
     ...

The first function_declarator should not be matched
because it has no function_definition parent.