From: "Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 60047@debbugs.gnu.org
Subject: bug#60047: [PATCH] Treat C++ classes as defuns in C Tree-sitter mode
Date: Tue, 13 Dec 2022 21:44:28 +0100 [thread overview]
Message-ID: <m1sfhj6nkj.fsf@yahoo.es> (raw)
In-Reply-To: m1sfhj6nkj.fsf.ref@yahoo.es
[-- 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
next parent reply other threads:[~2022-12-13 20:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[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 [this message]
2022-12-14 2:12 ` bug#60047: [PATCH] Treat C++ classes as defuns in C Tree-sitter mode Yuan Fu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m1sfhj6nkj.fsf@yahoo.es \
--to=bug-gnu-emacs@gnu.org \
--cc=60047@debbugs.gnu.org \
--cc=mardani29@yahoo.es \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.