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

Previous Next

Package: emacs;

Reported by: Filippo Argiolas <filippo.argiolas <at> gmail.com>

Date: Wed, 20 Nov 2024 22:23:01 UTC

Severity: normal

Found in version 30.0.92

Fixed in version 31.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: Filippo Argiolas <filippo.argiolas <at> gmail.com>
Cc: 74448 <at> debbugs.gnu.org
Subject: bug#74448: 30.0.92; c-ts-mode outlines only work with GNU or emacs style
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.




This bug report was last modified 191 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.