From: Eli Zaretskii <eliz@gnu.org>
To: Prateek Sharma <ps.prateek.sharma143@gmail.com>,
Yuan Fu <casouri@gmail.com>
Cc: 70478@debbugs.gnu.org
Subject: bug#70478: 30.0.50; [PATCH] Fix treesitter-font-lock-settings for built-in functions and attributes.
Date: Sat, 20 Apr 2024 09:13:48 +0300 [thread overview]
Message-ID: <86le58a7dv.fsf@gnu.org> (raw)
In-Reply-To: <CALFrjHzHr=T3S7UsCBzrLoQ34y5hqGBYkqaXTx04ooAo9qz1LQ@mail.gmail.com> (message from Prateek Sharma on Sat, 20 Apr 2024 02:30:17 +0530)
> 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.
next prev parent reply other threads:[~2024-04-20 6:13 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 [this message]
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
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=86le58a7dv.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=70478@debbugs.gnu.org \
--cc=casouri@gmail.com \
--cc=ps.prateek.sharma143@gmail.com \
/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).