unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Prateek Sharma <ps.prateek.sharma143@gmail.com>
To: Yuan Fu <casouri@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>, 70478@debbugs.gnu.org
Subject: bug#70478: 30.0.50; [PATCH] Fix treesitter-font-lock-settings for built-in functions and attributes.
Date: Mon, 22 Apr 2024 07:59:03 +0530	[thread overview]
Message-ID: <CALFrjHysp+3yTN7w4QMHC0uPgoChPrJLUG-zFMt+JSVR8WTddg@mail.gmail.com> (raw)
In-Reply-To: <BD3D25F0-9677-471A-920C-9F5C1C44D9CF@gmail.com>


[-- 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)


  reply	other threads:[~2024-04-22  2:29 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=CALFrjHysp+3yTN7w4QMHC0uPgoChPrJLUG-zFMt+JSVR8WTddg@mail.gmail.com \
    --to=ps.prateek.sharma143@gmail.com \
    --cc=70478@debbugs.gnu.org \
    --cc=casouri@gmail.com \
    --cc=eliz@gnu.org \
    /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).