GNU bug report logs - #70478
30.0.50; [PATCH] Fix treesitter-font-lock-settings for built-in functions and attributes.

Previous Next

Package: emacs;

Reported by: Prateek Sharma <ps.prateek.sharma143 <at> gmail.com>

Date: Fri, 19 Apr 2024 23:06:33 UTC

Severity: normal

Tags: patch

Found in version 30.0.50

Fixed in version 30.1

Done: Yuan Fu <casouri <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


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

From: Prateek Sharma <ps.prateek.sharma143 <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Yuan Fu <casouri <at> gmail.com>, 70478 <at> debbugs.gnu.org
Subject: Re: bug#70478: 30.0.50; [PATCH] Fix treesitter-font-lock-settings for
 built-in functions and attributes.
Date: Sat, 20 Apr 2024 12:25:24 +0530
[Message part 1 (text/plain, inline)]
Also should I squash the changes of both the above commits into one and
then create a patch file?

On Sat, Apr 20, 2024 at 12:24 PM Prateek Sharma <
ps.prateek.sharma143 <at> gmail.com> wrote:

> Hey, Thanks for reviewing my changes.
>
> Here is the patch for reformatted version of the above fix. I've also
> removed the announcement in the NEWS file.
>
> On Sat, Apr 20, 2024 at 11:43 AM Eli Zaretskii <eliz <at> gnu.org> wrote:
>
>> > From: Prateek Sharma <ps.prateek.sharma143 <at> gmail.com>
>> > Date: Sat, 20 Apr 2024 02:30:17 +0530
>> >
>> > I do a lot of programming in python and have noticed that if there is a
>> > method of a class defined with the same name as a builtin function. It
>> > gets highlighted with the face for builtin functions and it looks
>> > different for all the other functions and confuses me sometimes and just
>> > looks inconsistent.
>> >
>> > I have made a simple fix to the treesitter query and it seems to have
>> > fixed the problem.
>> >
>> > Please share you thoughts on this fix. This is my first time
>> > contributing to an open-source project and to emacs. Very excited to
>> > hear from you guys!!!
>>
>> Thanks.  Yuan, any comments?
>>
>> I have a few minor comments below.
>>
>> > diff --git a/etc/NEWS b/etc/NEWS
>> > index 8ad1e78ca60..e5cd70b6106 100644
>> > --- a/etc/NEWS
>> > +++ b/etc/NEWS
>> > @@ -1319,6 +1319,15 @@ instead of:
>> >  This allows the user to specify command line arguments to the non
>> >  interactive Python interpreter specified by 'python-interpreter'.
>> >
>> > +*** Treesitter syntax highlighting for built-in functions fixed
>> > +The fix highlights only the correct built-in function calls and
>> > +attributes with font-lock-builtin-face. When some class defines
>> > +a function with the same name as a built-in function, earlier it was
>> > +being highlighted with the same font-lock-builtin-face, which was
>> > +incorrect. Now, normal user defined functions will be highlighted
>> > +with font-lock-function-call-face face and built-in functions and
>> > +attributes will be highlighted with font-lock-builtin-face.
>>
>> This part is not needed, I think: we don't document bugfixes in NEWS.
>>
>> > +   `((call function: (identifier) @font-lock-builtin-face
>> > +           (:match ,(rx-to-string `(seq bol (or
>> ,@python--treesit-builtins) eol))
>> > +                   @font-lock-builtin-face))
>> > +     (attribute attribute: (identifier) @font-lock-builtin-face
>> > +                (:match ,(rx-to-string `(seq bol (or
>> ,@python--treesit-special-attributes) eol))
>> > +                        @font-lock-builtin-face)))
>>
>> Please reformat the whitespace here to avoid exceeding 80 columns in
>> each individual line.
>>
>
[Message part 2 (text/html, inline)]

This bug report was last modified 1 year and 88 days ago.

Previous Next


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