From ec7090231e105d63b4c132233686ec2d8a3ac00a Mon Sep 17 00:00:00 2001 From: Konstantin Kharlamov Date: Wed, 29 Jan 2025 08:35:31 +0300 Subject: [PATCH v3] Stop highlighting Python2 keywords. Many of the keywords may appear as an identifier in Python 3 code, and it's an odd user experience to see one being highlighted as a keyword. Since Python 2 EOL has happened 5 years ago, this commit removes Python 2 keywords from the highlight to improve user experience of the modern Python users. This patch is result of a discussion on emacs-devel. * etc/NEWS: Announce "keywords removal. * lisp/progmodes/python.el (python-font-lock-keywords-level-2): Remove Python 2 keywords from the list. --- etc/NEWS | 8 ++++++++ lisp/progmodes/python.el | 4 ---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index f7e9f283709..0e0856dfcb9 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -807,6 +807,14 @@ exist. If "python" points to Python 2 on your system, you now have to customize these variables to "python3" if you want to use Python 3 instead. +--- +*** Remove Python 2 keywords from 'python-mode'. +Many of the keywords may appear as an identifier in Python 3 code, and +it's an odd user experience to see one being highlighted as a keyword. +Since Python 2 EOL has happened 5 years ago, this release removes Python +2 keywords from the highlight to improve user experience of the modern +Python users. + --- *** Support of 'electric-layout-mode' added. diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index c00de2d6a8d..e4588b4ac09 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -714,10 +714,6 @@ python-font-lock-keywords-level-2 "range" "repr" "reversed" "round" "set" "setattr" "slice" "sorted" "staticmethod" "str" "sum" "super" "tuple" "type" "vars" "zip" "__import__" - ;; Python 2: - "basestring" "cmp" "execfile" "file" "long" "raw_input" "reduce" - "reload" "unichr" "unicode" "xrange" "apply" "buffer" "coerce" - "intern" ;; Python 3: "aiter" "anext" "ascii" "breakpoint" "bytearray" "bytes" "exec" ;; Special attributes: -- 2.48.1