GNU bug report logs - #59268
[PATCH] Utilize new font-lock faces for C/C++ and Python tree-sitter use

Previous Next

Package: emacs;

Reported by: Randy Taylor <dev <at> rjt.dev>

Date: Mon, 14 Nov 2022 23:16:03 UTC

Severity: normal

Tags: patch

Done: Randy Taylor <dev <at> rjt.dev>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 59268 in the body.
You can then email your comments to 59268 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#59268; Package emacs. (Mon, 14 Nov 2022 23:16:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Randy Taylor <dev <at> rjt.dev>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 14 Nov 2022 23:16:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Randy Taylor <dev <at> rjt.dev>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: [PATCH] Utilize new font-lock faces for C/C++ and Python tree-sitter
 use
Date: Mon, 14 Nov 2022 03:27:43 +0000
[Message part 1 (text/plain, inline)]
I'm just submitting C/C++ and Python for now since some of the other files are
a little more volatile currently (there are some patches in progress).

Will probably need to update this patch after Theo's stuff is pushed.

I would also like to reorganize the features to be sorted
alphabetically, but I'll wait for things to calm down a little beforedoing that.
[Message part 2 (text/html, inline)]
[0001-Utilize-new-font-lock-faces-for-C-C-and-Python-tree-.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59268; Package emacs. (Tue, 15 Nov 2022 01:27:02 GMT) Full text and rfc822 format available.

Message #8 received at 59268 <at> debbugs.gnu.org (full text, mbox):

From: Randy Taylor <dev <at> rjt.dev>
Cc: 59268 <at> debbugs.gnu.org
Subject: Re: bug#59268: [PATCH] Utilize new font-lock faces for C/C++ and
 Python tree-sitter use
Date: Tue, 15 Nov 2022 01:26:05 +0000
[Message part 1 (text/plain, inline)]
I updated the patch to apply cleanly, since recent changes caused conflicts.
[Message part 2 (text/html, inline)]
[0001-Utilize-new-font-lock-faces-for-C-C-and-Python-tree-.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59268; Package emacs. (Wed, 16 Nov 2022 02:05:02 GMT) Full text and rfc822 format available.

Message #11 received at 59268 <at> debbugs.gnu.org (full text, mbox):

From: Randy Taylor <dev <at> rjt.dev>
To: Yuan Fu <casouri <at> gmail.com>
Cc: 59268 <at> debbugs.gnu.org
Subject: Re: bug#59268: [PATCH] Utilize new font-lock faces for C/C++ and
 Python tree-sitter use
Date: Wed, 16 Nov 2022 02:04:27 +0000
[Message part 1 (text/plain, inline)]
Updated the patch again to apply cleanly.

Also added Yuan. (Side note: perhaps emacs-devel feature should be renamed to emacs-defun?)
[Message part 2 (text/html, inline)]
[0001-Utilize-new-font-lock-faces-for-C-C-and-Python-tree-.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59268; Package emacs. (Thu, 17 Nov 2022 03:27:01 GMT) Full text and rfc822 format available.

Message #14 received at 59268 <at> debbugs.gnu.org (full text, mbox):

From: Randy Taylor <dev <at> rjt.dev>
To: Yuan Fu <casouri <at> gmail.com>
Cc: 59268 <at> debbugs.gnu.org
Subject: Re: bug#59268: [PATCH] Utilize new font-lock faces for C/C++ and
 Python tree-sitter use
Date: Thu, 17 Nov 2022 03:26:29 +0000
[Message part 1 (text/plain, inline)]
Updated the patch again to apply cleanly, as there were some more changes to c-ts-mode.el.
[Message part 2 (text/html, inline)]
[0001-Utilize-new-font-lock-faces-for-C-C-and-Python-tree-.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59268; Package emacs. (Thu, 17 Nov 2022 03:41:02 GMT) Full text and rfc822 format available.

Message #17 received at 59268 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Randy Taylor <dev <at> rjt.dev>
Cc: 59268 <at> debbugs.gnu.org
Subject: Re: bug#59268: [PATCH] Utilize new font-lock faces for C/C++ and
 Python tree-sitter use
Date: Wed, 16 Nov 2022 19:39:59 -0800

> On Nov 16, 2022, at 7:26 PM, Randy Taylor <dev <at> rjt.dev> wrote:
> 
> Updated the patch again to apply cleanly, as there were some more changes to c-ts-mode.el.
> 
> 
> <0001-Utilize-new-font-lock-faces-for-C-C-and-Python-tree-.patch>

Ah, for making you updating the patch for so many times! I just see this report. The only comment I have is that I see you removed the field rule from assignment feature:

-     (assignment_expression
-      left: (field_expression field: (_) @font-lock-property-face))

I envisioned the assignment feature to highlight “the thing being assigned to”, in which case it would highlight the field when it’s in LHS. It’s perfectly fine to have both the field rule and the assignment rule to highlight fields, I think. So if you don’t mind, I’d add it back to assignment group.

Yuan



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59268; Package emacs. (Thu, 17 Nov 2022 13:51:01 GMT) Full text and rfc822 format available.

Message #20 received at 59268 <at> debbugs.gnu.org (full text, mbox):

From: Randy Taylor <dev <at> rjt.dev>
To: Yuan Fu <casouri <at> gmail.com>
Cc: 59268 <at> debbugs.gnu.org
Subject: Re: bug#59268: [PATCH] Utilize new font-lock faces for C/C++ and
 Python tree-sitter use
Date: Thu, 17 Nov 2022 13:50:27 +0000
[Message part 1 (text/plain, inline)]
On Wednesday, November 16th, 2022 at 22:39, Yuan Fu <casouri <at> gmail.com> wrote:

> 
> Ah, for making you updating the patch for so many times! I just see this report. The only comment I have is that I see you removed the field rule from assignment feature:
> 

No worries!

>
> - (assignment_expression
> - left: (field_expression field: (_) @font-lock-property-face))
> 
> I envisioned the assignment feature to highlight “the thing being assigned to”, in which case it would highlight the field when it’s in LHS. It’s perfectly fine to have both the field rule and the assignment rule to highlight fields, I think. So if you don’t mind, I’d add it back to assignment group.
> 

I removed it because (field_identifier) @font-lock-property-face (in the property feature) highlights all fields, from what I can tell and have tested.
Can you show me an example where it won't match?

Below, when T is a struct:

  T thing;
  thing.b = thing.b;
  thing.b = 5;

b is highlighted as a field in all cases.

Also, I've attached an updated patch: it seems that the escape-sequence feature needs an override to work (probably because it's inside a string that's highlighted?).
[0001-Utilize-new-font-lock-faces-for-C-C-and-Python-tree-.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59268; Package emacs. (Thu, 17 Nov 2022 18:40:02 GMT) Full text and rfc822 format available.

Message #23 received at 59268 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Randy Taylor <dev <at> rjt.dev>
Cc: 59268 <at> debbugs.gnu.org
Subject: Re: bug#59268: [PATCH] Utilize new font-lock faces for C/C++ and
 Python tree-sitter use
Date: Thu, 17 Nov 2022 10:39:13 -0800

> On Nov 17, 2022, at 5:50 AM, Randy Taylor <dev <at> rjt.dev> wrote:
> 
> On Wednesday, November 16th, 2022 at 22:39, Yuan Fu <casouri <at> gmail.com> wrote:
> 
>> 
>> Ah, for making you updating the patch for so many times! I just see this report. The only comment I have is that I see you removed the field rule from assignment feature:
>> 
> 
> No worries!
> 
>> 
>> - (assignment_expression
>> - left: (field_expression field: (_) @font-lock-property-face))
>> 
>> I envisioned the assignment feature to highlight “the thing being assigned to”, in which case it would highlight the field when it’s in LHS. It’s perfectly fine to have both the field rule and the assignment rule to highlight fields, I think. So if you don’t mind, I’d add it back to assignment group.
>> 
> 
> I removed it because (field_identifier) @font-lock-property-face (in the property feature) highlights all fields, from what I can tell and have tested.
> Can you show me an example where it won't match?
> 
> Below, when T is a struct:
> 
>  T thing;
>  thing.b = thing.b;
>  thing.b = 5;
> 
> b is highlighted as a field in all cases.

Ah, the purpose of that rule is to highlight field names in the LHS of assignments _only_. So if I disable property and enable assignment, I should see normal field names not highlighted, but field names in LHS of assignments highlighted.

> 
> Also, I've attached an updated patch: it seems that the escape-sequence feature needs an override to work (probably because it's inside a string that's highlighted?).<0001-Utilize-new-font-lock-faces-for-C-C-and-Python-tree-.patch>

Thanks. I will add back the assignment field rule and apply, is that ok with you?

Yuan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59268; Package emacs. (Thu, 17 Nov 2022 20:03:02 GMT) Full text and rfc822 format available.

Message #26 received at 59268 <at> debbugs.gnu.org (full text, mbox):

From: Randy Taylor <dev <at> rjt.dev>
To: Yuan Fu <casouri <at> gmail.com>
Cc: 59268 <at> debbugs.gnu.org
Subject: Re: bug#59268: [PATCH] Utilize new font-lock faces for C/C++ and
 Python tree-sitter use
Date: Thu, 17 Nov 2022 20:02:17 +0000
[Message part 1 (text/plain, inline)]
On Thursday, November 17th, 2022 at 13:39, Yuan Fu <casouri <at> gmail.com> wrote:

> 
> Ah, the purpose of that rule is to highlight field names in the LHS of assignments only. So if I disable property and enable assignment, I should see normal field names not highlighted, but field names in LHS of assignments highlighted.
> 

I see - you're trying to truly cover everything in assignment on its own.

> > Also, I've attached an updated patch: it seems that the escape-sequence feature needs an override to work (probably because it's inside a string that's highlighted?).<0001-Utilize-new-font-lock-faces-for-C-C-and-Python-tree-.patch>
> 
> 
> Thanks. I will add back the assignment field rule and apply, is that ok with you?
>

Sure! I attached a patch which keeps it.
[0001-Utilize-new-font-lock-faces-for-C-C-and-Python-tree-.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59268; Package emacs. (Thu, 17 Nov 2022 20:08:01 GMT) Full text and rfc822 format available.

Message #29 received at 59268 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Randy Taylor <dev <at> rjt.dev>
Cc: 59268 <at> debbugs.gnu.org
Subject: Re: bug#59268: [PATCH] Utilize new font-lock faces for C/C++ and
 Python tree-sitter use
Date: Thu, 17 Nov 2022 12:07:43 -0800

> On Nov 17, 2022, at 12:02 PM, Randy Taylor <dev <at> rjt.dev> wrote:
> 
> On Thursday, November 17th, 2022 at 13:39, Yuan Fu <casouri <at> gmail.com> wrote:
> 
>> 
>> Ah, the purpose of that rule is to highlight field names in the LHS of assignments only. So if I disable property and enable assignment, I should see normal field names not highlighted, but field names in LHS of assignments highlighted.
>> 
> 
> I see - you're trying to truly cover everything in assignment on its own.
> 
>>> Also, I've attached an updated patch: it seems that the escape-sequence feature needs an override to work (probably because it's inside a string that's highlighted?).<0001-Utilize-new-font-lock-faces-for-C-C-and-Python-tree-.patch>
>> 
>> 
>> Thanks. I will add back the assignment field rule and apply, is that ok with you?
>> 
> 
> Sure! I attached a patch which keeps it.<0001-Utilize-new-font-lock-faces-for-C-C-and-Python-tree-.patch>

Thanks, applied :-)

Yuan



Reply sent to Randy Taylor <dev <at> rjt.dev>:
You have taken responsibility. (Thu, 17 Nov 2022 20:20:02 GMT) Full text and rfc822 format available.

Notification sent to Randy Taylor <dev <at> rjt.dev>:
bug acknowledged by developer. (Thu, 17 Nov 2022 20:20:02 GMT) Full text and rfc822 format available.

Message #34 received at 59268-done <at> debbugs.gnu.org (full text, mbox):

From: Randy Taylor <dev <at> rjt.dev>
To: Yuan Fu <casouri <at> gmail.com>
Cc: "59268-done <at> debbugs.gnu.org" <59268-done <at> debbugs.gnu.org>
Subject: Re: bug#59268: [PATCH] Utilize new font-lock faces for C/C++ and
 Python tree-sitter use
Date: Thu, 17 Nov 2022 20:19:12 +0000
On Thursday, November 17th, 2022 at 15:07, Yuan Fu <casouri <at> gmail.com> wrote:

> 
> Thanks, applied :-)
> 
> Yuan

Thanks, closing the bug (hopefully).




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 16 Dec 2022 12:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 190 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.