* bug#60047: [PATCH] Treat C++ classes as defuns in C Tree-sitter mode
[not found] <m1sfhj6nkj.fsf.ref@yahoo.es>
@ 2022-12-13 20:44 ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-14 2:12 ` Yuan Fu
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-12-13 20:44 UTC (permalink / raw)
To: 60047
[-- Attachment #1: Type: text/plain, Size: 311 bytes --]
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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Treat-C-classes-as-defuns-in-C-Tree-sitter-mode.patch --]
[-- Type: text/patch, Size: 1062 bytes --]
From 008ce6794281fd606df8161af5ed65b267be0664 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Mart=C3=ADn?= <mardani29@yahoo.es>
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* bug#60047: [PATCH] Treat C++ classes as defuns in C Tree-sitter mode
2022-12-13 20:44 ` bug#60047: [PATCH] Treat C++ classes as defuns in C Tree-sitter mode Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-12-14 2:12 ` Yuan Fu
0 siblings, 0 replies; 2+ messages in thread
From: Yuan Fu @ 2022-12-14 2:12 UTC (permalink / raw)
To: Daniel Martín; +Cc: 60047-done
Daniel Martín <mardani29@yahoo.es> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-12-14 2:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <m1sfhj6nkj.fsf.ref@yahoo.es>
2022-12-13 20:44 ` bug#60047: [PATCH] Treat C++ classes as defuns in C Tree-sitter mode Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-14 2:12 ` Yuan Fu
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).