Subject: bug#60047: closed (Re: bug#60047: [PATCH] Treat C++ classes as defuns in C Tree-sitter mode)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 14 Dec 2022 02:13:02 +0000

Your bug report

#60047: [PATCH] Treat C++ classes as defuns in C Tree-sitter mode

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
60047: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=60047
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#60047: [PATCH] Treat C++ classes as defuns in C Tree-sitter mode
From: Yuan Fu <[email-masked]>
To: Daniel Martín <[email-masked]>
Cc: [email-masked]
Date: Tue, 13 Dec 2022 18:12:02 -0800
List-Id: <debbugs-submit.debbugs.gnu.org>

Daniel Martín <[email-masked]> writes:

> Tags: patch
>
>
> The attached patch makes C-M-a/C-M-e inside a C++ class definition in
> c++-ts-mode go to the beginning or the end of the class, respectively.
>
> I've added it to the base mode because I think it's harmless for C, and
> it can be convenient if we implement an Obj-C mode based on Tree-sitter.
>
> Thanks.
>

Applied, thanks!

Yuan

Subject: [PATCH] Treat C++ classes as defuns in C Tree-sitter mode
From: Daniel Martín <[email-masked]>
To: [email-masked]
Date: Tue, 13 Dec 2022 21:44:28 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Tags: patch

The attached patch makes C-M-a/C-M-e inside a C++ class definition in
c++-ts-mode go to the beginning or the end of the class, respectively.

I've added it to the base mode because I think it's harmless for C, and
it can be convenient if we implement an Obj-C mode based on Tree-sitter.

Thanks.

>From 008ce6794281fd606df8161af5ed65b267be0664 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Mart=C3=ADn?= <[email-masked]>
Date: Tue, 13 Dec 2022 21:35:40 +0100
Subject: [PATCH] Treat C++ classes as defuns in C Tree-sitter mode

* lisp/progmodes/c-ts-mode.el (c-ts-base-mode): Add "class_specifier"
as a node of type "defun".
---
 lisp/progmodes/c-ts-mode.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
index 0d0a14e933..8407be3b6b 100644
--- a/lisp/progmodes/c-ts-mode.el
+++ b/lisp/progmodes/c-ts-mode.el
@@ -553,7 +553,8 @@ c-ts-base-mode
                             "type_definition"
                             "struct_specifier"
                             "enum_specifier"
-                            "union_specifier")))
+                            "union_specifier"
+                            "class_specifier")))
 
   ;; Nodes like struct/enum/union_specifier can appear in
   ;; function_definitions, so we need to find the top-level node.
-- 
2.34.1