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 09:42:27 +0200 Organization: LINKOV.NET Message-ID: <875xoh9gnw.fsf@mail.linkov.net> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31342"; 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 08:46:26 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 1tE1tQ-000805-L6 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 21 Nov 2024 08:46:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tE1t7-0000U3-5G; Thu, 21 Nov 2024 02:46:05 -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 1tE1t4-0000TH-LX for bug-gnu-emacs@gnu.org; Thu, 21 Nov 2024 02:46:02 -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 1tE1t4-0000uT-CZ for bug-gnu-emacs@gnu.org; Thu, 21 Nov 2024 02:46:02 -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=PEP8pj+Nz4POPeLb2dRjG+21JJ/qRT6G0kIY0to1kI8=; b=rFM/VeIxweXWe5R7soqiXKQtlLszraIleTXc4UxovoULxFQIUl8r7G3vJMXEmKwS50qNKfokQ7SSLxINowiXRAL7Xj+0Wbc+r5XA0SizAoo81K5pITCrBbLojXefo5nhWfz1+bXGQbWik7vJl2GRhiXfyvBq3Sb3B2Xs0vpU2S1WowkRhiEdTi5/SVjm7RCnv97elVFYyt97IlMOhU9Ywg3U6B04P6+db8qpcsmGW0diONdsZVH4EKNuLnGnDlMYWLZIUhFgTqs2uSnlpX4QUONpvUrsjuyATjeOog+mPtf5KxZqGuoLaRnWe4EDD0XDoznyMIg9NmaP3FCaYRkGPQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tE1t4-0003j8-6w for bug-gnu-emacs@gnu.org; Thu, 21 Nov 2024 02:46: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 07:46: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.173217513014274 (code B ref 74448); Thu, 21 Nov 2024 07:46:02 +0000 Original-Received: (at 74448) by debbugs.gnu.org; 21 Nov 2024 07:45:30 +0000 Original-Received: from localhost ([127.0.0.1]:48933 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tE1sY-0003iA-8c for submit@debbugs.gnu.org; Thu, 21 Nov 2024 02:45:30 -0500 Original-Received: from relay3-d.mail.gandi.net ([217.70.183.195]:57527) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tE1sW-0003hp-D3 for 74448@debbugs.gnu.org; Thu, 21 Nov 2024 02:45:28 -0500 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id F419F60007; Thu, 21 Nov 2024 07:44:57 +0000 (UTC) In-Reply-To: (Filippo Argiolas's message of "Wed, 20 Nov 2024 23:22:19 +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:295712 Archived-At: > Hi, I've been playing with the new treesitter based outline minor mode > and c-ts-mode. > > It seems that `outline-hide-subtree' is only working properly when code > is formatted with either GNU or emacs style. > > To test try it with a function where the function declarator is preceded on the > same line by either type or storage class and type. It will fold the > function heading instead of the function body. > > Problem seems `c-ts-mode--outline-predicate' only checks for > function_declarator nodes at the beginning of line (like in GNU coding > style) but other coding style will start the function line with either > storage class (e.g. static) or type. > > Something like this seems to work a little better: > > (defun c-ts-mode--outline-predicate (node) > "Match outlines on lines with function names." > (or (and (or (equal (treesit-node-type node) "function_declarator") > (equal (treesit-node-type node) "storage_class_specifier") > (equal (treesit-node-type node) "primitive_type") > (equal (treesit-node-type node) "type_identifier")) > (equal (treesit-node-type (treesit-node-parent node)) > "function_definition")) > ;; DEFUNs in Emacs sources. > (and c-ts-mode-emacs-sources-support > (c-ts-mode--emacs-defun-p node)))) > > But it kind of breaks GNU style by adding two outlines per function > definition. Also it seems a bit ugly to enumerate all the node types by > hand, there probably is a nicer way to detect a line with a > function_declarator not at bol. > > Any better idea? Could you please send a few of short examples of each style. This would help to make a better decision. And later these examples could be added to tests.