unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#38318: [PATCH] Highlight Python special attributes.
@ 2019-11-22  0:29 Hong Xu
  2019-11-22 13:35 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: Hong Xu @ 2019-11-22  0:29 UTC (permalink / raw)
  To: 38318

* 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






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

* bug#38318: [PATCH] Highlight Python special attributes.
  2019-11-22  0:29 bug#38318: [PATCH] Highlight Python special attributes Hong Xu
@ 2019-11-22 13:35 ` Lars Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2019-11-22 13:35 UTC (permalink / raw)
  To: Hong Xu; +Cc: 38318

Hong Xu <hong@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





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

end of thread, other threads:[~2019-11-22 13:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-22  0:29 bug#38318: [PATCH] Highlight Python special attributes Hong Xu
2019-11-22 13:35 ` Lars Ingebrigtsen

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