unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Filippo Argiolas <filippo.argiolas@gmail.com>
Cc: 74448@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	[thread overview]
Message-ID: <87v7wge93a.fsf@mail.linkov.net> (raw)
In-Reply-To: <m2o7287waw.fsf@gmail.com> (Filippo Argiolas's message of "Thu, 21 Nov 2024 10:47:35 +0100")

> 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.





      reply	other threads:[~2024-11-21 18:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-20 22:22 bug#74448: 30.0.92; c-ts-mode outlines only work with GNU or emacs style Filippo Argiolas
2024-11-21  7:42 ` Juri Linkov
2024-11-21  9:47   ` Filippo Argiolas
2024-11-21 18:17     ` Juri Linkov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v7wge93a.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=74448@debbugs.gnu.org \
    --cc=filippo.argiolas@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).