unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#70478: 30.0.50; [PATCH] Fix treesitter-font-lock-settings for built-in functions and attributes.
@ 2024-04-19 21:00 Prateek Sharma
  2024-04-20  6:13 ` Eli Zaretskii
  0 siblings, 1 reply; 22+ messages in thread
From: Prateek Sharma @ 2024-04-19 21:00 UTC (permalink / raw)
  To: 70478


[-- Attachment #1.1: Type: text/plain, Size: 580 bytes --]

Dear maintainers,

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!!!

Prateek Sharma

[-- Attachment #1.2: Type: text/html, Size: 651 bytes --]

[-- Attachment #2: 0001-Fix-treesitter-font-lock-settings-for-built-in-funct.patch --]
[-- Type: application/octet-stream, Size: 2678 bytes --]

From 3ba23aea28796b801832baf1aa5e1092cff88e6e Mon Sep 17 00:00:00 2001
From: Prateek Sharma <ps.prateek.sharma143@gmail.com>
Date: Sat, 20 Apr 2024 02:06:17 +0530
Subject: [PATCH] Fix treesitter-font-lock-settings for built-in functions and
 attributes.

* etc/NEWS: Announce the effect of the changes for the treesitter-font-lock-settings for built-in functions and attributes
* lisp/progmodes/python.el (python--treesit-settings): Change the treesitter query to fetch the correct type of node for built-in functions and attributes and highlight them with corresponding font-lock face.
---
 etc/NEWS                 |  9 +++++++++
 lisp/progmodes/python.el | 13 ++++++-------
 2 files changed, 15 insertions(+), 7 deletions(-)

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.
+
 ** Scheme mode
 Scheme mode now handles regular expression literal '#/regexp/' that is
 available in some Scheme implementations.
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 85279d3e84b..5c67d0765eb 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -1206,13 +1206,12 @@ fontified."
 
    :feature 'builtin
    :language 'python
-   `(((identifier) @font-lock-builtin-face
-      (:match ,(rx-to-string
-                `(seq bol
-                      (or ,@python--treesit-builtins
-                          ,@python--treesit-special-attributes)
-                      eol))
-              @font-lock-builtin-face)))
+   `((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)))
 
    :feature 'decorator
    :language 'python
-- 
2.39.3 (Apple Git-146)


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* bug#70478: 30.0.50; [PATCH] Fix treesitter-font-lock-settings for built-in functions and attributes.
  2024-04-19 21:00 bug#70478: 30.0.50; [PATCH] Fix treesitter-font-lock-settings for built-in functions and attributes Prateek Sharma
@ 2024-04-20  6:13 ` Eli Zaretskii
  2024-04-20  6:54   ` Prateek Sharma
  0 siblings, 1 reply; 22+ messages in thread
From: Eli Zaretskii @ 2024-04-20  6:13 UTC (permalink / raw)
  To: Prateek Sharma, Yuan Fu; +Cc: 70478

> From: Prateek Sharma <ps.prateek.sharma143@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.





^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#70478: 30.0.50; [PATCH] Fix treesitter-font-lock-settings for built-in functions and attributes.
  2024-04-20  6:13 ` Eli Zaretskii
@ 2024-04-20  6:54   ` Prateek Sharma
  2024-04-20  6:55     ` Prateek Sharma
  0 siblings, 1 reply; 22+ messages in thread
From: Prateek Sharma @ 2024-04-20  6:54 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Yuan Fu, 70478


[-- Attachment #1.1: Type: text/plain, Size: 2519 bytes --]

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@gnu.org> wrote:

> > From: Prateek Sharma <ps.prateek.sharma143@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.
>

[-- Attachment #1.2: Type: text/html, Size: 3153 bytes --]

[-- Attachment #2: 0002-Reformat-treesitter-query-for-builtins-to-not-exceed.patch --]
[-- Type: application/octet-stream, Size: 2455 bytes --]

From 867c67670b31d0adf4a16711792e2d839eb8ebd7 Mon Sep 17 00:00:00 2001
From: Prateek Sharma <ps.prateek.sharma143@gmail.com>
Date: Sat, 20 Apr 2024 12:13:48 +0530
Subject: [PATCH 2/2] Reformat treesitter query for builtins to not exceed 80
 columns

* etc/NEWS: Remove bugfix news as it's not needed
* lisp/progmodes/python.el (python--treesit-settings): Reformat the treesitter query for font-lock to not exceed 80 columns
---
 etc/NEWS                 | 9 ---------
 lisp/progmodes/python.el | 7 +++++--
 2 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index e5cd70b6106..8ad1e78ca60 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1319,15 +1319,6 @@ 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.
-
 ** Scheme mode
 Scheme mode now handles regular expression literal '#/regexp/' that is
 available in some Scheme implementations.
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 5c67d0765eb..d6c29e5ffc6 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -1207,10 +1207,13 @@ fontified."
    :feature 'builtin
    :language 'python
    `((call function: (identifier) @font-lock-builtin-face
-           (:match ,(rx-to-string `(seq bol (or ,@python--treesit-builtins) eol))
+           (: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))
+                (:match ,(rx-to-string
+                          `(seq bol
+                                (or ,@python--treesit-special-attributes) eol))
                         @font-lock-builtin-face)))
 
    :feature 'decorator
-- 
2.39.3 (Apple Git-146)


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* bug#70478: 30.0.50; [PATCH] Fix treesitter-font-lock-settings for built-in functions and attributes.
  2024-04-20  6:54   ` Prateek Sharma
@ 2024-04-20  6:55     ` Prateek Sharma
  2024-04-20  7:41       ` Eli Zaretskii
  0 siblings, 1 reply; 22+ messages in thread
From: Prateek Sharma @ 2024-04-20  6:55 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Yuan Fu, 70478

[-- Attachment #1: Type: text/plain, Size: 2781 bytes --]

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@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@gnu.org> wrote:
>
>> > From: Prateek Sharma <ps.prateek.sharma143@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.
>>
>

[-- Attachment #2: Type: text/html, Size: 3649 bytes --]

^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#70478: 30.0.50; [PATCH] Fix treesitter-font-lock-settings for built-in functions and attributes.
  2024-04-20  6:55     ` Prateek Sharma
@ 2024-04-20  7:41       ` Eli Zaretskii
  2024-04-20  7:53         ` Prateek Sharma
  0 siblings, 1 reply; 22+ messages in thread
From: Eli Zaretskii @ 2024-04-20  7:41 UTC (permalink / raw)
  To: Prateek Sharma; +Cc: casouri, 70478

> From: Prateek Sharma <ps.prateek.sharma143@gmail.com>
> Date: Sat, 20 Apr 2024 12:25:24 +0530
> Cc: Yuan Fu <casouri@gmail.com>, 70478@debbugs.gnu.org
> 
> Also should I squash the changes of both the above commits into one and then create a patch file?

You should squash, yes.  Other than that, attaching the patches as you
did is fine.

Thanks.





^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#70478: 30.0.50; [PATCH] Fix treesitter-font-lock-settings for built-in functions and attributes.
  2024-04-20  7:41       ` Eli Zaretskii
@ 2024-04-20  7:53         ` Prateek Sharma
  2024-04-21  3:47           ` Yuan Fu
  0 siblings, 1 reply; 22+ messages in thread
From: Prateek Sharma @ 2024-04-20  7:53 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: casouri, 70478


[-- Attachment #1.1: Type: text/plain, Size: 549 bytes --]

Here is the patch for the squashed commit and updated code. Thanks for
helping me out!


On Sat, Apr 20, 2024 at 1:11 PM Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Prateek Sharma <ps.prateek.sharma143@gmail.com>
> > Date: Sat, 20 Apr 2024 12:25:24 +0530
> > Cc: Yuan Fu <casouri@gmail.com>, 70478@debbugs.gnu.org
> >
> > Also should I squash the changes of both the above commits into one and
> then create a patch file?
>
> You should squash, yes.  Other than that, attaching the patches as you
> did is fine.
>
> Thanks.
>

[-- Attachment #1.2: Type: text/html, Size: 1056 bytes --]

[-- Attachment #2: 0001-Fix-treesitter-font-lock-settings-for-built-in-funct.patch --]
[-- Type: application/octet-stream, Size: 1665 bytes --]

From 6b8e155a6fc917eb644a32c06fa7383a8cbf47b9 Mon Sep 17 00:00:00 2001
From: Prateek Sharma <ps.prateek.sharma143@gmail.com>
Date: Sat, 20 Apr 2024 02:06:17 +0530
Subject: [PATCH] Fix treesitter-font-lock-settings for built-in functions and
 attributes.

* lisp/progmodes/python.el (python--treesit-settings): Change the treesitter query to fetch the correct type of node for built-in functions and attributes and highlight them with corresponding font-lock face.
---
 lisp/progmodes/python.el | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 85279d3e84b..d6c29e5ffc6 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -1206,13 +1206,15 @@ fontified."
 
    :feature 'builtin
    :language 'python
-   `(((identifier) @font-lock-builtin-face
-      (:match ,(rx-to-string
-                `(seq bol
-                      (or ,@python--treesit-builtins
-                          ,@python--treesit-special-attributes)
-                      eol))
-              @font-lock-builtin-face)))
+   `((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)))
 
    :feature 'decorator
    :language 'python
-- 
2.39.3 (Apple Git-146)


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* bug#70478: 30.0.50; [PATCH] Fix treesitter-font-lock-settings for built-in functions and attributes.
  2024-04-20  7:53         ` Prateek Sharma
@ 2024-04-21  3:47           ` Yuan Fu
  2024-04-21  5:16             ` Prateek Sharma
  2024-04-21  5:27             ` Eli Zaretskii
  0 siblings, 2 replies; 22+ messages in thread
From: Yuan Fu @ 2024-04-21  3:47 UTC (permalink / raw)
  To: Prateek Sharma; +Cc: Eli Zaretskii, 70478



> On Apr 20, 2024, at 12:53 AM, Prateek Sharma <ps.prateek.sharma143@gmail.com> wrote:
> 
> Here is the patch for the squashed commit and updated code. Thanks for helping me out!
> 
> 
> On Sat, Apr 20, 2024 at 1:11 PM Eli Zaretskii <eliz@gnu.org> wrote:
> > From: Prateek Sharma <ps.prateek.sharma143@gmail.com>
> > Date: Sat, 20 Apr 2024 12:25:24 +0530
> > Cc: Yuan Fu <casouri@gmail.com>, 70478@debbugs.gnu.org
> > 
> > Also should I squash the changes of both the above commits into one and then create a patch file?
> 
> You should squash, yes.  Other than that, attaching the patches as you
> did is fine.
> 
> Thanks.
> <0001-Fix-treesitter-font-lock-settings-for-built-in-funct.patch>

Thanks! Should I apply this to master or emacs-29? It’s a fix so I think emacs-29?

Yuan




^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#70478: 30.0.50; [PATCH] Fix treesitter-font-lock-settings for built-in functions and attributes.
  2024-04-21  3:47           ` Yuan Fu
@ 2024-04-21  5:16             ` Prateek Sharma
  2024-04-21  5:27             ` Eli Zaretskii
  1 sibling, 0 replies; 22+ messages in thread
From: Prateek Sharma @ 2024-04-21  5:16 UTC (permalink / raw)
  To: Yuan Fu; +Cc: Eli Zaretskii, 70478

[-- Attachment #1: Type: text/plain, Size: 1121 bytes --]

Well, I think emacs-29 also needs this fix.

There is one other fix with indentation in python-ts-mode that is needed in
emacs-29. But it's already fixed in emacs-30 as I've tested.

On Sun, Apr 21, 2024 at 9:17 AM Yuan Fu <casouri@gmail.com> wrote:

>
>
> > On Apr 20, 2024, at 12:53 AM, Prateek Sharma <
> ps.prateek.sharma143@gmail.com> wrote:
> >
> > Here is the patch for the squashed commit and updated code. Thanks for
> helping me out!
> >
> >
> > On Sat, Apr 20, 2024 at 1:11 PM Eli Zaretskii <eliz@gnu.org> wrote:
> > > From: Prateek Sharma <ps.prateek.sharma143@gmail.com>
> > > Date: Sat, 20 Apr 2024 12:25:24 +0530
> > > Cc: Yuan Fu <casouri@gmail.com>, 70478@debbugs.gnu.org
> > >
> > > Also should I squash the changes of both the above commits into one
> and then create a patch file?
> >
> > You should squash, yes.  Other than that, attaching the patches as you
> > did is fine.
> >
> > Thanks.
> > <0001-Fix-treesitter-font-lock-settings-for-built-in-funct.patch>
>
> Thanks! Should I apply this to master or emacs-29? It’s a fix so I think
> emacs-29?
>
> Yuan

[-- Attachment #2: Type: text/html, Size: 1857 bytes --]

^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#70478: 30.0.50; [PATCH] Fix treesitter-font-lock-settings for built-in functions and attributes.
  2024-04-21  3:47           ` Yuan Fu
  2024-04-21  5:16             ` Prateek Sharma
@ 2024-04-21  5:27             ` Eli Zaretskii
  2024-04-21 23:39               ` Yuan Fu
  1 sibling, 1 reply; 22+ messages in thread
From: Eli Zaretskii @ 2024-04-21  5:27 UTC (permalink / raw)
  To: Yuan Fu; +Cc: ps.prateek.sharma143, 70478

> From: Yuan Fu <casouri@gmail.com>
> Date: Sat, 20 Apr 2024 20:47:29 -0700
> Cc: Eli Zaretskii <eliz@gnu.org>,
>  70478@debbugs.gnu.org
> 
> > On Sat, Apr 20, 2024 at 1:11 PM Eli Zaretskii <eliz@gnu.org> wrote:
> > > From: Prateek Sharma <ps.prateek.sharma143@gmail.com>
> > > Date: Sat, 20 Apr 2024 12:25:24 +0530
> > > Cc: Yuan Fu <casouri@gmail.com>, 70478@debbugs.gnu.org
> > > 
> > > Also should I squash the changes of both the above commits into one and then create a patch file?
> > 
> > You should squash, yes.  Other than that, attaching the patches as you
> > did is fine.
> > 
> > Thanks.
> > <0001-Fix-treesitter-font-lock-settings-for-built-in-funct.patch>
> 
> Thanks! Should I apply this to master or emacs-29? It’s a fix so I think emacs-29?

Yes, emacs-29 is fine.





^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#70478: 30.0.50; [PATCH] Fix treesitter-font-lock-settings for built-in functions and attributes.
  2024-04-21  5:27             ` Eli Zaretskii
@ 2024-04-21 23:39               ` Yuan Fu
  2024-04-22  2:29                 ` Prateek Sharma
  2024-04-22  6:28                 ` Eli Zaretskii
  0 siblings, 2 replies; 22+ messages in thread
From: Yuan Fu @ 2024-04-21 23:39 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Prateek Sharma, 70478



> On Apr 20, 2024, at 10:27 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> From: Yuan Fu <casouri@gmail.com>
>> Date: Sat, 20 Apr 2024 20:47:29 -0700
>> Cc: Eli Zaretskii <eliz@gnu.org>,
>> 70478@debbugs.gnu.org
>> 
>>> On Sat, Apr 20, 2024 at 1:11 PM Eli Zaretskii <eliz@gnu.org> wrote:
>>>> From: Prateek Sharma <ps.prateek.sharma143@gmail.com>
>>>> Date: Sat, 20 Apr 2024 12:25:24 +0530
>>>> Cc: Yuan Fu <casouri@gmail.com>, 70478@debbugs.gnu.org
>>>> 
>>>> Also should I squash the changes of both the above commits into one and then create a patch file?
>>> 
>>> You should squash, yes.  Other than that, attaching the patches as you
>>> did is fine.
>>> 
>>> Thanks.
>>> <0001-Fix-treesitter-font-lock-settings-for-built-in-funct.patch>
>> 
>> Thanks! Should I apply this to master or emacs-29? It’s a fix so I think emacs-29?
> 
> Yes, emacs-29 is fine.

Merged. BTW, Prateek, make sure to wrap the title and body of the commit message, and not end the title with a period. 😊

Yuan




^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#70478: 30.0.50; [PATCH] Fix treesitter-font-lock-settings for built-in functions and attributes.
  2024-04-21 23:39               ` Yuan Fu
@ 2024-04-22  2:29                 ` Prateek Sharma
  2024-04-22  6:36                   ` Yuan Fu
  2024-04-22  6:28                 ` Eli Zaretskii
  1 sibling, 1 reply; 22+ messages in thread
From: Prateek Sharma @ 2024-04-22  2:29 UTC (permalink / raw)
  To: Yuan Fu; +Cc: Eli Zaretskii, 70478


[-- Attachment #1.1: Type: text/plain, Size: 1207 bytes --]

Yuan, do you mean like this in the attached file?

On Mon, Apr 22, 2024 at 5:09 AM Yuan Fu <casouri@gmail.com> wrote:

>
>
> > On Apr 20, 2024, at 10:27 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> >
> >> From: Yuan Fu <casouri@gmail.com>
> >> Date: Sat, 20 Apr 2024 20:47:29 -0700
> >> Cc: Eli Zaretskii <eliz@gnu.org>,
> >> 70478@debbugs.gnu.org
> >>
> >>> On Sat, Apr 20, 2024 at 1:11 PM Eli Zaretskii <eliz@gnu.org> wrote:
> >>>> From: Prateek Sharma <ps.prateek.sharma143@gmail.com>
> >>>> Date: Sat, 20 Apr 2024 12:25:24 +0530
> >>>> Cc: Yuan Fu <casouri@gmail.com>, 70478@debbugs.gnu.org
> >>>>
> >>>> Also should I squash the changes of both the above commits into one
> and then create a patch file?
> >>>
> >>> You should squash, yes.  Other than that, attaching the patches as you
> >>> did is fine.
> >>>
> >>> Thanks.
> >>> <0001-Fix-treesitter-font-lock-settings-for-built-in-funct.patch>
> >>
> >> Thanks! Should I apply this to master or emacs-29? It’s a fix so I
> think emacs-29?
> >
> > Yes, emacs-29 is fine.
>
> Merged. BTW, Prateek, make sure to wrap the title and body of the commit
> message, and not end the title with a period. 😊
>
> Yuan

[-- Attachment #1.2: Type: text/html, Size: 2200 bytes --]

[-- Attachment #2: 0001-Fix-treesitter-font-lock-settings-for-built-in-funct.patch --]
[-- Type: application/octet-stream, Size: 1670 bytes --]

From 6b8e155a6fc917eb644a32c06fa7383a8cbf47b9 Mon Sep 17 00:00:00 2001
From: Prateek Sharma <ps.prateek.sharma143@gmail.com>
Date: Sat, 20 Apr 2024 02:06:17 +0530
Subject: [PATCH] Fix treesitter-font-lock-settings for built-in
 functions and attributes

* lisp/progmodes/python.el (python--treesit-settings): Change the
  treesitter query to fetch the correct type of node for built-in
  functions and attributes and highlight them with corresponding
  font-lock face.
---
 lisp/progmodes/python.el | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 85279d3e84b..d6c29e5ffc6 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -1206,13 +1206,15 @@ fontified."
 
    :feature 'builtin
    :language 'python
-   `(((identifier) @font-lock-builtin-face
-      (:match ,(rx-to-string
-                `(seq bol
-                      (or ,@python--treesit-builtins
-                          ,@python--treesit-special-attributes)
-                      eol))
-              @font-lock-builtin-face)))
+   `((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)))
 
    :feature 'decorator
    :language 'python
-- 
2.39.3 (Apple Git-146)


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* bug#70478: 30.0.50; [PATCH] Fix treesitter-font-lock-settings for built-in functions and attributes.
  2024-04-21 23:39               ` Yuan Fu
  2024-04-22  2:29                 ` Prateek Sharma
@ 2024-04-22  6:28                 ` Eli Zaretskii
  2024-04-22  6:34                   ` Yuan Fu
  1 sibling, 1 reply; 22+ messages in thread
From: Eli Zaretskii @ 2024-04-22  6:28 UTC (permalink / raw)
  To: Yuan Fu; +Cc: ps.prateek.sharma143, 70478

> From: Yuan Fu <casouri@gmail.com>
> Date: Sun, 21 Apr 2024 16:39:40 -0700
> Cc: Prateek Sharma <ps.prateek.sharma143@gmail.com>,
>  70478@debbugs.gnu.org
> 
> > Yes, emacs-29 is fine.
> 
> Merged. BTW, Prateek, make sure to wrap the title and body of the commit message, and not end the title with a period. 😊

Did you forget to push?





^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#70478: 30.0.50; [PATCH] Fix treesitter-font-lock-settings for built-in functions and attributes.
  2024-04-22  6:28                 ` Eli Zaretskii
@ 2024-04-22  6:34                   ` Yuan Fu
  0 siblings, 0 replies; 22+ messages in thread
From: Yuan Fu @ 2024-04-22  6:34 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Prateek Sharma, 70478



> On Apr 21, 2024, at 11:28 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> From: Yuan Fu <casouri@gmail.com>
>> Date: Sun, 21 Apr 2024 16:39:40 -0700
>> Cc: Prateek Sharma <ps.prateek.sharma143@gmail.com>,
>> 70478@debbugs.gnu.org
>> 
>>> Yes, emacs-29 is fine.
>> 
>> Merged. BTW, Prateek, make sure to wrap the title and body of the commit message, and not end the title with a period. 😊
> 
> Did you forget to push?

Forgot I did, sorry about the hiccup. Pushed now.

Yuan




^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#70478: 30.0.50; [PATCH] Fix treesitter-font-lock-settings for built-in functions and attributes.
  2024-04-22  2:29                 ` Prateek Sharma
@ 2024-04-22  6:36                   ` Yuan Fu
       [not found]                     ` <CALFrjHxRZyriFw4cS-hQWZbbVbf5otnP6qGqZAY42z=Tf648Nw@mail.gmail.com>
  0 siblings, 1 reply; 22+ messages in thread
From: Yuan Fu @ 2024-04-22  6:36 UTC (permalink / raw)
  To: Prateek Sharma; +Cc: Eli Zaretskii, 70478



> On Apr 21, 2024, at 7:29 PM, Prateek Sharma <ps.prateek.sharma143@gmail.com> wrote:
> 
> Yuan, do you mean like this in the attached file?

Exactly! I already amended and merged your patch. But next time you will know how to write it ;-)

Yuan




^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#70478: 30.0.50; [PATCH] Fix treesitter-font-lock-settings for built-in functions and attributes.
       [not found]                     ` <CALFrjHxRZyriFw4cS-hQWZbbVbf5otnP6qGqZAY42z=Tf648Nw@mail.gmail.com>
@ 2024-04-22 15:50                       ` Yuan Fu
  2024-04-22 16:18                         ` Prateek Sharma
  2024-04-22 16:21                         ` Eli Zaretskii
  0 siblings, 2 replies; 22+ messages in thread
From: Yuan Fu @ 2024-04-22 15:50 UTC (permalink / raw)
  To: Prateek Sharma; +Cc: Eli Zaretskii, 70478

[Adding debbugs back to CC]

> On Apr 22, 2024, at 7:27 AM, Prateek Sharma <ps.prateek.sharma143@gmail.com> wrote:
> 
> Hi Yuan, I saw that it was merged into the emacs-29 branch but not in master. I was wondering when we usually sync with master, like is there a schedule? So that I know when to rebuild my emacs installation.
> And thanks for guiding me through this. I also submitted the form for copyright assignment to the mail id given in the CONTRIBUTE file, but didn't get any response yet.

Oops, we should’ve waited until your copyright assignment is completed. Eli, should I revert the patch for now?

Yuan




^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#70478: 30.0.50; [PATCH] Fix treesitter-font-lock-settings for built-in functions and attributes.
  2024-04-22 15:50                       ` Yuan Fu
@ 2024-04-22 16:18                         ` Prateek Sharma
  2024-04-22 16:21                         ` Eli Zaretskii
  1 sibling, 0 replies; 22+ messages in thread
From: Prateek Sharma @ 2024-04-22 16:18 UTC (permalink / raw)
  To: Yuan Fu; +Cc: Eli Zaretskii, 70478

[-- Attachment #1: Type: text/plain, Size: 970 bytes --]

Is that mandatory for a few lines of changes as well? I thought it's
required for more than 12 lines of changes.I have submitted it, but didn't
get any response yet. Is there any way that we can speed up the process?

Prateek

On Mon, Apr 22, 2024 at 9:20 PM Yuan Fu <casouri@gmail.com> wrote:

> [Adding debbugs back to CC]
>
> > On Apr 22, 2024, at 7:27 AM, Prateek Sharma <
> ps.prateek.sharma143@gmail.com> wrote:
> >
> > Hi Yuan, I saw that it was merged into the emacs-29 branch but not in
> master. I was wondering when we usually sync with master, like is there a
> schedule? So that I know when to rebuild my emacs installation.
> > And thanks for guiding me through this. I also submitted the form for
> copyright assignment to the mail id given in the CONTRIBUTE file, but
> didn't get any response yet.
>
> Oops, we should’ve waited until your copyright assignment is completed.
> Eli, should I revert the patch for now?
>
> Yuan

[-- Attachment #2: Type: text/html, Size: 1342 bytes --]

^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#70478: 30.0.50; [PATCH] Fix treesitter-font-lock-settings for built-in functions and attributes.
  2024-04-22 15:50                       ` Yuan Fu
  2024-04-22 16:18                         ` Prateek Sharma
@ 2024-04-22 16:21                         ` Eli Zaretskii
  2024-04-23  4:26                           ` Yuan Fu
  1 sibling, 1 reply; 22+ messages in thread
From: Eli Zaretskii @ 2024-04-22 16:21 UTC (permalink / raw)
  To: Yuan Fu, Prateek Sharma; +Cc: 70478

On April 22, 2024 6:50:31 PM GMT+03:00, Yuan Fu <casouri@gmail.com> wrote:
> [Adding debbugs back to CC]
> 
> > On Apr 22, 2024, at 7:27 AM, Prateek Sharma <ps.prateek.sharma143@gmail.com> wrote:
> > 
> > Hi Yuan, I saw that it was merged into the emacs-29 branch but not in master. I was wondering when we usually sync with master, like is there a schedule? So that I know when to rebuild my emacs installation.
> > And thanks for guiding me through this. I also submitted the form for copyright assignment to the mail id given in the CONTRIBUTE file, but didn't get any response yet.
> 
> Oops, we should’ve waited until your copyright assignment is completed. Eli, should I revert the patch for now?


No need to revert, as the patch was quite small, AFAIR, below the threshold.





^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#70478: 30.0.50; [PATCH] Fix treesitter-font-lock-settings for built-in functions and attributes.
  2024-04-22 16:21                         ` Eli Zaretskii
@ 2024-04-23  4:26                           ` Yuan Fu
  2024-04-23  6:14                             ` Eli Zaretskii
  0 siblings, 1 reply; 22+ messages in thread
From: Yuan Fu @ 2024-04-23  4:26 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Prateek Sharma, 70478



> On Apr 22, 2024, at 9:21 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> 
> On April 22, 2024 6:50:31 PM GMT+03:00, Yuan Fu <casouri@gmail.com> wrote:
>> [Adding debbugs back to CC]
>> 
>>> On Apr 22, 2024, at 7:27 AM, Prateek Sharma <ps.prateek.sharma143@gmail.com> wrote:
>>> 
>>> Hi Yuan, I saw that it was merged into the emacs-29 branch but not in master. I was wondering when we usually sync with master, like is there a schedule? So that I know when to rebuild my emacs installation.
>>> And thanks for guiding me through this. I also submitted the form for copyright assignment to the mail id given in the CONTRIBUTE file, but didn't get any response yet.
>> 
>> Oops, we should’ve waited until your copyright assignment is completed. Eli, should I revert the patch for now?
> 
> 
> No need to revert, as the patch was quite small, AFAIR, below the threshold.

Oh right. Somehow I thought the patch are larger than it actually it. False alarm!

Yuan




^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#70478: 30.0.50; [PATCH] Fix treesitter-font-lock-settings for built-in functions and attributes.
  2024-04-23  4:26                           ` Yuan Fu
@ 2024-04-23  6:14                             ` Eli Zaretskii
  2024-04-24 13:46                               ` Prateek Sharma
  0 siblings, 1 reply; 22+ messages in thread
From: Eli Zaretskii @ 2024-04-23  6:14 UTC (permalink / raw)
  To: Yuan Fu; +Cc: ps.prateek.sharma143, 70478

> From: Yuan Fu <casouri@gmail.com>
> Date: Mon, 22 Apr 2024 21:26:06 -0700
> Cc: Prateek Sharma <ps.prateek.sharma143@gmail.com>,
>  70478@debbugs.gnu.org
> 
> > On Apr 22, 2024, at 9:21 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> > 
> > No need to revert, as the patch was quite small, AFAIR, below the threshold.
> 
> Oh right. Somehow I thought the patch are larger than it actually it. False alarm!

Well, the commit log message should have had the
"Copyright-paperwork-exempt" cookie, but given that the paperwork is
in the works, this is not a grave problem.





^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#70478: 30.0.50; [PATCH] Fix treesitter-font-lock-settings for built-in functions and attributes.
  2024-04-23  6:14                             ` Eli Zaretskii
@ 2024-04-24 13:46                               ` Prateek Sharma
  2024-04-24 15:31                                 ` Eli Zaretskii
  0 siblings, 1 reply; 22+ messages in thread
From: Prateek Sharma @ 2024-04-24 13:46 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Yuan Fu, 70478

[-- Attachment #1: Type: text/plain, Size: 844 bytes --]

Hi Eli,
When do we merge emacs-29 to master? I noticed that the changes are not
merged in master. Do we have a schedule for syncing master with emacs-29?

On Tue, Apr 23, 2024 at 11:44 AM Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Yuan Fu <casouri@gmail.com>
> > Date: Mon, 22 Apr 2024 21:26:06 -0700
> > Cc: Prateek Sharma <ps.prateek.sharma143@gmail.com>,
> >  70478@debbugs.gnu.org
> >
> > > On Apr 22, 2024, at 9:21 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> > >
> > > No need to revert, as the patch was quite small, AFAIR, below the
> threshold.
> >
> > Oh right. Somehow I thought the patch are larger than it actually it.
> False alarm!
>
> Well, the commit log message should have had the
> "Copyright-paperwork-exempt" cookie, but given that the paperwork is
> in the works, this is not a grave problem.
>

[-- Attachment #2: Type: text/html, Size: 1447 bytes --]

^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#70478: 30.0.50; [PATCH] Fix treesitter-font-lock-settings for built-in functions and attributes.
  2024-04-24 13:46                               ` Prateek Sharma
@ 2024-04-24 15:31                                 ` Eli Zaretskii
  2024-04-24 15:33                                   ` Prateek Sharma
  0 siblings, 1 reply; 22+ messages in thread
From: Eli Zaretskii @ 2024-04-24 15:31 UTC (permalink / raw)
  To: Prateek Sharma; +Cc: casouri, 70478

> From: Prateek Sharma <ps.prateek.sharma143@gmail.com>
> Date: Wed, 24 Apr 2024 19:16:08 +0530
> Cc: Yuan Fu <casouri@gmail.com>, 70478@debbugs.gnu.org
> 
> When do we merge emacs-29 to master? I noticed that the changes are not merged in master. Do we have a
> schedule for syncing master with emacs-29?

I usually merge once a week, so it will happen in a couple of days.





^ permalink raw reply	[flat|nested] 22+ messages in thread

* bug#70478: 30.0.50; [PATCH] Fix treesitter-font-lock-settings for built-in functions and attributes.
  2024-04-24 15:31                                 ` Eli Zaretskii
@ 2024-04-24 15:33                                   ` Prateek Sharma
  0 siblings, 0 replies; 22+ messages in thread
From: Prateek Sharma @ 2024-04-24 15:33 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Yuan Fu, 70478

[-- Attachment #1: Type: text/plain, Size: 492 bytes --]

Okay, Thanks!

On Wed, 24 Apr, 2024, 9:01 pm Eli Zaretskii, <eliz@gnu.org> wrote:

> > From: Prateek Sharma <ps.prateek.sharma143@gmail.com>
> > Date: Wed, 24 Apr 2024 19:16:08 +0530
> > Cc: Yuan Fu <casouri@gmail.com>, 70478@debbugs.gnu.org
> >
> > When do we merge emacs-29 to master? I noticed that the changes are not
> merged in master. Do we have a
> > schedule for syncing master with emacs-29?
>
> I usually merge once a week, so it will happen in a couple of days.
>

[-- Attachment #2: Type: text/html, Size: 1017 bytes --]

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2024-04-24 15:33 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-19 21:00 bug#70478: 30.0.50; [PATCH] Fix treesitter-font-lock-settings for built-in functions and attributes Prateek Sharma
2024-04-20  6:13 ` Eli Zaretskii
2024-04-20  6:54   ` Prateek Sharma
2024-04-20  6:55     ` Prateek Sharma
2024-04-20  7:41       ` Eli Zaretskii
2024-04-20  7:53         ` Prateek Sharma
2024-04-21  3:47           ` Yuan Fu
2024-04-21  5:16             ` Prateek Sharma
2024-04-21  5:27             ` Eli Zaretskii
2024-04-21 23:39               ` Yuan Fu
2024-04-22  2:29                 ` Prateek Sharma
2024-04-22  6:36                   ` Yuan Fu
     [not found]                     ` <CALFrjHxRZyriFw4cS-hQWZbbVbf5otnP6qGqZAY42z=Tf648Nw@mail.gmail.com>
2024-04-22 15:50                       ` Yuan Fu
2024-04-22 16:18                         ` Prateek Sharma
2024-04-22 16:21                         ` Eli Zaretskii
2024-04-23  4:26                           ` Yuan Fu
2024-04-23  6:14                             ` Eli Zaretskii
2024-04-24 13:46                               ` Prateek Sharma
2024-04-24 15:31                                 ` Eli Zaretskii
2024-04-24 15:33                                   ` Prateek Sharma
2024-04-22  6:28                 ` Eli Zaretskii
2024-04-22  6:34                   ` 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).