From: "Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 60441@debbugs.gnu.org
Subject: bug#60441: [PATCH] Fontification of function declarators with reference return types is incorrect in c++-ts-mode
Date: Sat, 31 Dec 2022 01:51:02 +0100 [thread overview]
Message-ID: <m14jtc8kg9.fsf@yahoo.es> (raw)
In-Reply-To: m14jtc8kg9.fsf.ref@yahoo.es
[-- Attachment #1: Type: text/plain, Size: 288 bytes --]
Given the following valid C++ code:
class Foo {
public:
Bar& getBar();
};
c++-ts-mode does not fontify getBar with the
font-lock-function-name-face face.
I've attached a fix to treat reference declarators in
c-ts-mode--declarator-identifier similarly to pointer_declarators.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-fontification-of-C-functions-with-reference-retu.patch --]
[-- Type: text/x-patch, Size: 1159 bytes --]
From 19182746e53ca66dc94aea4a7cd91f67cc7e0aaa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Mart=C3=ADn?= <mardani29@yahoo.es>
Date: Sat, 31 Dec 2022 01:45:27 +0100
Subject: [PATCH] Fix fontification of C++ functions with reference return
types
* lisp/progmodes/c-ts-mode.el (c-ts-fontify-error): Treat
reference_declarator nodes the same as pointer_declarator nodes when
calculating the identifier to fontify.
---
lisp/progmodes/c-ts-mode.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
index 82a13e9762..3cb671f4c5 100644
--- a/lisp/progmodes/c-ts-mode.el
+++ b/lisp/progmodes/c-ts-mode.el
@@ -425,7 +425,7 @@ c-ts-mode--declarator-identifier
;; Recurse.
((or "attributed_declarator" "parenthesized_declarator")
(c-ts-mode--declarator-identifier (treesit-node-child node 0 t)))
- ("pointer_declarator"
+ ((or "pointer_declarator" "reference_declarator")
(c-ts-mode--declarator-identifier (treesit-node-child node -1)))
((or "function_declarator" "array_declarator" "init_declarator")
(c-ts-mode--declarator-identifier
--
2.34.1
next parent reply other threads:[~2022-12-31 0:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <m14jtc8kg9.fsf.ref@yahoo.es>
2022-12-31 0:51 ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-01-02 0:26 ` bug#60441: [PATCH] Fontification of function declarators with reference return types is incorrect in c++-ts-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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m14jtc8kg9.fsf@yahoo.es \
--to=bug-gnu-emacs@gnu.org \
--cc=60441@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 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).