GNU bug report logs - #38318
[PATCH] Highlight Python special attributes.

Previous Next

Package: emacs;

Reported by: Hong Xu <hong <at> topbug.net>

Date: Fri, 22 Nov 2019 00:30:02 UTC

Severity: normal

Tags: fixed, patch

Fixed in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 38318 in the body.
You can then email your comments to 38318 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#38318; Package emacs. (Fri, 22 Nov 2019 00:30:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Hong Xu <hong <at> topbug.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 22 Nov 2019 00:30:02 GMT) Full text and rfc822 format available.

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

From: Hong Xu <hong <at> topbug.net>
To: "bug-gnu-emacs" <bug-gnu-emacs <at> gnu.org>
Subject: [PATCH] Highlight Python special attributes.
Date: Thu, 21 Nov 2019 16:29:38 -0800
* lisp/progmodes/python.el (python-font-lock-keywords-level-2): Add
special attributes
---
 lisp/progmodes/python.el | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 37e0ccf71987..aa7252e156d9 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -567,8 +567,14 @@ python-font-lock-keywords-level-2
            "intern"
            ;; Python 3:
            "ascii" "breakpoint" "bytearray" "bytes" "exec"
-           ;; Extra:
-           "__all__" "__doc__" "__name__" "__package__")
+           ;; Special attributes:
+           ;; https://docs.python.org/3/reference/datamodel.html
+           "__annotations__" "__closure__" "__code__"
+           "__defaults__" "__dict__" "__doc__" "__globals__"
+           "__kwdefaults__" "__name__" "__module__" "__package__"
+           "__qualname__"
+           ;; Extras:
+           "__all__")
           symbol-end) . font-lock-builtin-face))
   "Font lock keywords to use in python-mode for level 2 decoration.
 
-- 
2.18.1





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#38318; Package emacs. (Fri, 22 Nov 2019 13:36:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Hong Xu <hong <at> topbug.net>
Cc: 38318 <at> debbugs.gnu.org
Subject: Re: bug#38318: [PATCH] Highlight Python special attributes.
Date: Fri, 22 Nov 2019 14:35:47 +0100
Hong Xu <hong <at> topbug.net> writes:

> * lisp/progmodes/python.el (python-font-lock-keywords-level-2): Add
> special attributes

[...]

> -           ;; Extra:
> -           "__all__" "__doc__" "__name__" "__package__")
> +           ;; Special attributes:
> +           ;; https://docs.python.org/3/reference/datamodel.html
> +           "__annotations__" "__closure__" "__code__"
> +           "__defaults__" "__dict__" "__doc__" "__globals__"
> +           "__kwdefaults__" "__name__" "__module__" "__package__"
> +           "__qualname__"
> +           ;; Extras:
> +           "__all__")

I'm no (ahem) Python expert, but this makes sense to me, so I've applied
the patch to Emacs 27.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 22 Nov 2019 13:37:01 GMT) Full text and rfc822 format available.

bug marked as fixed in version 27.1, send any further explanations to 38318 <at> debbugs.gnu.org and Hong Xu <hong <at> topbug.net> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 22 Nov 2019 13:37:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 21 Dec 2019 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 177 days ago.

Previous Next


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