From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs 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 Organization: LINKOV.NET Message-ID: <87v7wge93a.fsf@mail.linkov.net> References: <875xoh9gnw.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5352"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu) Cc: 74448@debbugs.gnu.org To: Filippo Argiolas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Nov 21 19:29:33 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tEBvo-0001CS-St for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 21 Nov 2024 19:29:33 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tEBva-0007wk-1Z; Thu, 21 Nov 2024 13:29:18 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tEBvM-0007v4-N2 for bug-gnu-emacs@gnu.org; Thu, 21 Nov 2024 13:29:06 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tEBvK-0000mQ-Cu for bug-gnu-emacs@gnu.org; Thu, 21 Nov 2024 13:29:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=E9BUrvqizuwx+boI4wtM75lD60MTsrPywxppzoVm0zA=; b=DS4krVlfyfEIsBlC6mkwSrNgBHgwWnncI838I2za0O8nYPsSYrdhhWD5E5Xz3I8tR9G6MWZbvhjWHbgQPOvNgjTAbsyPtIGkvYlcMr5zgr1wfB+9OuKT3WTNhQGm6XRVd6mWfz1pmsUs+2ZYls9gY0c98UuFAP4ig6ajn6ax5eQJjZuYWbQTdiGdo37XmvnhWIuUL7zRWqxMJysQ2WPO+69Hi1sR96sk861I4Gb4iJgqOmHEz39bCvnanvo3c8j426XLiWGMeNF/VxcY7YODNHipP/T2GXJqftl8oWvYdtR5Fm1WqpeJoT/N9Xfu4FK6KS3JPWLfRFNG1tfOfcRQdQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tEBvK-0008Mq-7q for bug-gnu-emacs@gnu.org; Thu, 21 Nov 2024 13:29:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 21 Nov 2024 18:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74448 X-GNU-PR-Package: emacs Original-Received: via spool by 74448-submit@debbugs.gnu.org id=B74448.173221371932130 (code B ref 74448); Thu, 21 Nov 2024 18:29:02 +0000 Original-Received: (at 74448) by debbugs.gnu.org; 21 Nov 2024 18:28:39 +0000 Original-Received: from localhost ([127.0.0.1]:51667 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tEBux-0008MA-5k for submit@debbugs.gnu.org; Thu, 21 Nov 2024 13:28:39 -0500 Original-Received: from relay2-d.mail.gandi.net ([217.70.183.194]:42941) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tEBuv-0008Lv-F9 for 74448@debbugs.gnu.org; Thu, 21 Nov 2024 13:28:38 -0500 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id 2870440006; Thu, 21 Nov 2024 18:28:07 +0000 (UTC) In-Reply-To: (Filippo Argiolas's message of "Thu, 21 Nov 2024 10:47:35 +0100") X-GND-Sasl: juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:295739 Archived-At: > 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.