From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Daniel =?UTF-8?Q?Mart=C3=ADn?= via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#59966: [PATCH] [Tree-sitter] Align C++ access specifiers to their enclosing class/struct/union Date: Sun, 11 Dec 2022 16:19:13 +0100 Message-ID: References: Reply-To: Daniel =?UTF-8?Q?Mart=C3=ADn?= Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29635"; mail-complaints-to="usenet@ciao.gmane.io" To: 59966@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 11 16:20:24 2022 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 1p4O7s-0007Uz-BM for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 11 Dec 2022 16:20:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p4O7h-0004XF-RF; Sun, 11 Dec 2022 10:20:15 -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 1p4O7W-0004V9-RQ for bug-gnu-emacs@gnu.org; Sun, 11 Dec 2022 10:20:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p4O7W-0005EH-Iu for bug-gnu-emacs@gnu.org; Sun, 11 Dec 2022 10:20:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p4O7W-0005Tx-4d for bug-gnu-emacs@gnu.org; Sun, 11 Dec 2022 10:20:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Daniel =?UTF-8?Q?Mart=C3=ADn?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 11 Dec 2022 15:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 59966 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.167077196821054 (code B ref -1); Sun, 11 Dec 2022 15:20:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 11 Dec 2022 15:19:28 +0000 Original-Received: from localhost ([127.0.0.1]:46585 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p4O6y-0005TW-4L for submit@debbugs.gnu.org; Sun, 11 Dec 2022 10:19:28 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:49538) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p4O6w-0005TL-5q for submit@debbugs.gnu.org; Sun, 11 Dec 2022 10:19:26 -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 1p4O6v-0004T6-CB for bug-gnu-emacs@gnu.org; Sun, 11 Dec 2022 10:19:26 -0500 Original-Received: from sonic301-21.consmr.mail.ir2.yahoo.com ([77.238.176.98]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p4O6t-0004eP-3C for bug-gnu-emacs@gnu.org; Sun, 11 Dec 2022 10:19:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.es; s=s2048; t=1670771958; bh=sdDpDmDqwAZuH0yIEhUDmO2arRLQkPZUr0N5FreoLAA=; h=From:To:Subject:Date:References:From:Subject:Reply-To; b=NC0XYhc7IPRT3GzzElyrCg8ofAs1hFmjzFRMbNxpLO2mPBGNKknP2+bWSVtztS2w44oOzY+WZFa8PcHudZ+3xOr3y5m+ubv2+3PlrT13GUW0IQM1Cfyup3lAF4tZEW2JLXr4eeNabqJ/HbD2oOiO5MhKPR07p2eYVIQOw6wF4uVplZm/HoJ89LSq5mNdOdr8B1oH9WiQo+8jCW/45KNttQTLPZVe9kaxTbt1PebxqLk/pgmJMT5rriyEztLqSnycil9JkfcN+1F1f36BYYOaH3OV/h7Axtw8s3/WeIxnEA7GvoRav9lxqslSRsuKIXGZ5BIUoClICFfeKCSaZF8j4w== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1670771958; bh=07S2/xpp5AEwY92yy91IQVPkZMsvcYrhU+F5ASd+Hji=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=iBWSgDWpDGbTkJ0DnTV8ecoNy/NMzUf10lxZSFjUXB7G+qLLJm9iTjBx/PYKf27OT9drlZiBevkd9PlLFvYGhQWUJw8ndDdbk+LfnEYTsA+caLi7hQq28RRGofrRv2ByYAwQpAAEs4Sl1Zozx0K1k8CPF4uqZVLBDpxXwuUAg8cktxvKVxbrjucg1Jg/YqD/uc4yTH2hT/PDpDXcg6UGf6fk5NDn6JvT2XWVsNgmGXksqbZgqk12Wc72vPBtWghRssKEZc4mlUFuNYH3zfn7NMHLF4u/HwJIlaJmRcsZYQF+gxXjHP9+NxVvu640uxkGsbGj6vroKJwGvKqfwck4Cg== X-YMail-OSG: .SgISuUVM1k.ZqW1ZUnXPQYe6u5jI5mo0QWAVWdQYc6wh2hzaHJMYSgwC.0Utn8 qcqcuC.oR9.F.T7bmWVZowqyDi1uxaO4ycfQQWbjr.blMBSUPGCZrA2DrIFrhR2wdnP2Hqi2vgjW 8QG606FbKlx7UjLYxaiJAedLOWEtllYUJbLYIZPu03nYGzXAxgjqeZ3G84P4pHw3QmiLgus3czTx J5modH.3L7L_CQhAKwV21_e7og35vcv1jPk5EI_xjHYB4lENf6wUw1FH4YQWI_T0dO7_ANIPmgqB i6brXUIEjhQCbPyMeM201c.c4np85rpoA1OzSzAx5mvaSn2R9pex5smCngtJ1IJ6BXUzqeV0U.k2 i.BBOMLP99mSz3YedoDx6UZVPhvQTmq0vmVq7OGR7nsumN2jqwnyf2XUQukH4.f1E7rtr6LiR2V2 GNn7FTjSobUUl52IPRPfp_yLEl5e1VAmFLfv.y.D38v.Iz2wObXDN.cm9H49t8FJxs8ZeHcXt.qg t1EYze6RjUQLzSDjWXtWGxRJedGRSP9hHvaLRVgQR5s_kT.bMhaGzE5njXuL0t4QDyP2mgZ2le9M 3DecMD7M9cNTPucLqiuoatSl.eeNGKdW95klZNsVM3bEI4UnWmsEAGass_y0G.FfaB26hBUpYmhN HY0Ysr5rqb5mVlB3UCVWAAMeX18LAhtvpASyst.oh9McJD5kjj1yi_GqJhYn6X2VicqPCqd_fU3Q yzvEn8ZHunf.cyEkZ4KlM5P7ZQGnhRC1eQwBqDIyJn1BrMudRwhQuy55f7vVdwVfYn80TxK.ttx5 5PtpOH1WcCN9W9rHWUy9sM_awBWIUEZ9zxSAJEli3n X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic301.consmr.mail.ir2.yahoo.com with HTTP; Sun, 11 Dec 2022 15:19:18 +0000 Original-Received: by hermes--production-ir2-5795fc58c8-f848z (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID f411fa5149c15f43105d4cd55ba9e445; Sun, 11 Dec 2022 15:19:14 +0000 (UTC) X-Mailer: WebService/1.1.20926 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Received-SPF: pass client-ip=77.238.176.98; envelope-from=mardani29@yahoo.es; helo=sonic301-21.consmr.mail.ir2.yahoo.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_FILL_THIS_FORM_SHORT=0.01 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:250613 Archived-At: --=-=-= Content-Type: text/plain Tags: patch The following C++ class is indented differently in c++-mode and c++-ts-mode: class Sample { public: void sample(); private: int a; }; c++-mode indents it like class Sample { public: void sample(); private: int a; }; c++-ts-mode indents it like class Sample { public: void sample(); private: int a; }; I've attached a patch so that C++ classes are indented the same in c++-mode and c++-ts-mode when the default style is used. Thanks. --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Align-C-access-specifiers-to-their-enclosing-class-s.patch >From b1fb292835772ed6f4da4f91fa58e84ce7582a50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=ADn?= Date: Sun, 11 Dec 2022 15:57:43 +0100 Subject: [PATCH] Align C++ access specifiers to their enclosing class/struct/union The default style in c++-mode aligns access specifiers like "private", "public" or "protected" to their enclosing class, struct, or union. The "ellemtel" style indents access specifiers, but this C++ style is not supported by c++-ts-mode yet. * lisp/progmodes/c-ts-mode.el (c-ts-mode--indent-styles): Align access specifiers to their enclosing class/struct/union. --- lisp/progmodes/c-ts-mode.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 824325d83e..5dab9879dc 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -120,6 +120,8 @@ c-ts-mode--indent-styles ((query "(call_expression arguments: (_) @indent)") parent c-ts-mode-indent-offset) ((parent-is "call_expression") parent 0) ((parent-is "enumerator_list") parent-bol c-ts-mode-indent-offset) + ,@(when (eq mode 'cpp) + '(((node-is "access_specifier") parent-bol 0))) ((parent-is "field_declaration_list") parent-bol c-ts-mode-indent-offset) ((parent-is "initializer_list") parent-bol c-ts-mode-indent-offset) ((parent-is "if_statement") parent-bol c-ts-mode-indent-offset) -- 2.34.1 --=-=-=--