From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Filippo Argiolas Newsgroups: gmane.emacs.bugs Subject: bug#74448: 30.0.92; c-ts-mode outlines only work with GNU or emacs style Date: Wed, 20 Nov 2024 23:22:19 +0100 Message-ID: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36200"; mail-complaints-to="usenet@ciao.gmane.io" To: 74448@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Nov 20 23:23: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 1tDt6a-0009HS-Pl for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 20 Nov 2024 23:23:25 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tDt6G-0003qn-1b; Wed, 20 Nov 2024 17:23:04 -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 1tDt6E-0003qb-P9 for bug-gnu-emacs@gnu.org; Wed, 20 Nov 2024 17:23: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 1tDt6E-0005r7-6q for bug-gnu-emacs@gnu.org; Wed, 20 Nov 2024 17:23: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:From:To:Subject; bh=PJTeZ1GuJnnpWrIBB9mkoo4epOfE/LHLa8UyaZ3y3i8=; b=SsuQDQbtondx134xN7vxh47WJwz+wBq3se5oZVrF5icU79NZXHLHACYnVEy9d38llusAw4i1N9IDJyL7HkJYl+K+ttxMDz2qkLGfVH50m7xxpAmtObWAQQ+W3jacaSTXiNHEd1Vt/TGlLle54uCBENgcSI6JXDtl6xz2AdnbNxmQ9W/L/0mPydZvOrFKXjWo44xIo8IDsvJrgi3XePNaODQYhQkwzgMDRigfdYTuaYIjayiRKGHESUNR6o0cZ9WZ/zbRS8OYQLiSwCewshI4dVqb2ZYx+U/3R2b8wqAtEy5EUaEvF4EpVRHqc7JMMlLr6JNpNhUpIx3/8D7Tp4qUaQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tDt6E-0003an-1B for bug-gnu-emacs@gnu.org; Wed, 20 Nov 2024 17:23:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Filippo Argiolas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 20 Nov 2024 22:23:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 74448 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.173214135413772 (code B ref -1); Wed, 20 Nov 2024 22:23:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 20 Nov 2024 22:22:34 +0000 Original-Received: from localhost ([127.0.0.1]:48105 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDt5m-0003a3-9m for submit@debbugs.gnu.org; Wed, 20 Nov 2024 17:22:34 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:52790) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tDt5h-0003Zs-Es for submit@debbugs.gnu.org; Wed, 20 Nov 2024 17:22:33 -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 1tDt5f-0003pP-Bj for bug-gnu-emacs@gnu.org; Wed, 20 Nov 2024 17:22:27 -0500 Original-Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tDt5d-0005pH-Rq for bug-gnu-emacs@gnu.org; Wed, 20 Nov 2024 17:22:27 -0500 Original-Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-382423e1f7aso115922f8f.2 for ; Wed, 20 Nov 2024 14:22:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732141342; x=1732746142; darn=gnu.org; h=mime-version:message-id:date:subject:to:from:from:to:cc:subject :date:message-id:reply-to; bh=PJTeZ1GuJnnpWrIBB9mkoo4epOfE/LHLa8UyaZ3y3i8=; b=PHDF1mRhh9KpfdcltOTDasUhEBDWleEPRR7sZ7vKezwzpb3NFP2TUPv+ZDmd3EU/Qr h8SDlfDGaACEMl1q+FlA3i+C9qXokUpI00cdbiaTWIJA/aOdN+rHOzUybkdONtyKz5ZX AtWDXQjNdv2c9IJMBCnqkiMKlUbJQOU+hEZv4FPDB1ioMNdZcERXvPOv+/fnFAcqpMLp lR+BAHA94wsdaAgI6hSNsLz9t+JjFuHMN6JdD8DTa4T5jifgInX4q2oE4+SiPGieR3qh qu5aBAH/dFFdEMANNc1RSHQZwux2fVvtn2DlU1zSXUdaU+8HYT+MdT8een+voVT2v+Zy OeWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732141342; x=1732746142; h=mime-version:message-id:date:subject:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=PJTeZ1GuJnnpWrIBB9mkoo4epOfE/LHLa8UyaZ3y3i8=; b=ZSBzbx7G2R2CMQ6zMv+PkB6k1fABDsIP0oMHbahrpu5ylVTPsqSnwfBf+/axBta5G4 8na0P5wbZWshQMshzdQQMYcPe7jtKzA1zfv+VDL0UAPbEIyRkjEuGodnHNIcKlgQqkjv CjgnX/nWy4wD3dyMr9m059HdFlno4VzHQM1N96FksWvvCZlJ1eC0rPTjHotzqK1CSHyE Kz4HA6F8aYufdEQWMGkDg4oAZJvmx7ksESkvAX0agbn4QrvbaPA66EZ0xHJ+Mhi/2QSQ /h3XQ8r5OtLPvpBrMO07KkmFvFWDosquT3NR9re1pjRYB+MyckzNqMmLbE2dFFQBNlo2 tzZQ== X-Gm-Message-State: AOJu0Yx7dRmRhbrODl0LgpehXlM1u69MNWwcEGmo9kl0Zi2ypMQvKfNW HCa/MLSEhecfG8nHGsSkheLq7XRgn1GpiMe/e3eLDvIn1ZIoTJB7l03fMv/k X-Google-Smtp-Source: AGHT+IHW1xXESf58Kv1DOjEEDPu6PsKybMmZt0u8GSu/JAl8d1CuCofjM5522g4Cxxtz8+sicuP+CA== X-Received: by 2002:a5d:64c6:0:b0:382:442c:2c54 with SMTP id ffacd0b85a97d-38254afc65fmr3262928f8f.28.1732141342437; Wed, 20 Nov 2024 14:22:22 -0800 (PST) Original-Received: from mba ([151.81.191.240]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3825490c682sm3170095f8f.31.2024.11.20.14.22.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2024 14:22:20 -0800 (PST) Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=filippo.argiolas@gmail.com; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:295704 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? Thanks, Filippo