bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#43298: 27.1; Do font locking for Python 3, not 2


From: Stefan Kangas
Subject: bug#43298: 27.1; Do font locking for Python 3, not 2
Date: Mon, 11 Oct 2021 06:25:26 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.60 (gnu/linux)

close 43298 29.1
thanks

Per Starbäck <starback@cl.lingfil.uu.se> writes:

> In GNU Emacs 27.1:
>
>       $ emacs -Q -f /tmp/new.py
>         for RET print RET len RET
>
> "print" gets the same colour as "for", that is as a keyword.
> I think it should get the same as "len", that is as a builtin
> function.
>
> Python.el has a section
>
>           ;; Python 2:
>           "print" "exec"
>
> because in Python 2 these two were keywords. But in Python 3 they are built-in
> functions.

Thanks for the bug report!  Your reasoning makes sense to me, so I have
now fixed this on master (commit 9f9c9f934a).  This change will be in
Emacs 29.

Feel free to verify that this fix works for you, but for now I'm closing this
bug report.  If you see anything that is wrong, please reply to this
email (use "Reply to all" in your email client) and we can reopen the
bug report.

> I think it's overkill to try to determine if the buffer contains Python 2 or 3
> and highlight them differently. Using the same fontlocking is good enough,
> since it's not a big problem to get these in the wrong colour.
> But now when Python 2 is officially discontinued I think it's time to
> let it follow Python 3 and get the small inconvenience when editing old
> code and not when editing current code.

Agreed.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]