From: kobarity <kobarity@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: andreas.roehler@easy-emacs.de, sunlin7.mail@gmail.com,
71093@debbugs.gnu.org
Subject: bug#71093: 30.0.50; python: multiple assignments not fontified
Date: Fri, 24 May 2024 22:54:46 +0900 [thread overview]
Message-ID: <eke734q71fix.wl-kobarity@gmail.com> (raw)
In-Reply-To: <864jan2x95.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 1048 bytes --]
Eli Zaretskii wrote:
> > Date: Fri, 24 May 2024 21:17:39 +0900
> > From: kobarity <kobarity@gmail.com>
> > Cc: Andreas Röhler <andreas.roehler@easy-emacs.de>, Lin
> > Sun <sunlin7.mail@gmail.com>, 71093@debbugs.gnu.org
> >
> > Eli Zaretskii wrote:
> > >
> > > > Date: Tue, 21 May 2024 12:47:57 +0200
> > > > From: Andreas Röhler <andreas.roehler@easy-emacs.de>
> > > >
> > > > a = b = c = 5
> > > >
> > > > b and c are not fontified
> > >
> > > Can someone please look into fixing this? python-ts-mode does TRT,
> > > btw.
> >
> > Sorry, this bug was introduced by my commit
> > 4915ca5dd4245a909c046e6691e8d4a1919890c8. I canceled it in commit
> > 6b2c8dc9050c5c0514fa404733ce1d4a37d00e39 due to a performance issue,
> > but the cancellation was incomplete. Attached is the patch to fix
> > this in master with an ERT. Is it better to fix in emacs-29?
>
> Thanks. If the regression was in Emacs 29, then yes, it is better to
> fix that on the emacs-29 branch.
Attached is the patch for emacs-29 branch.
[-- Attachment #2: 0001-Fix-Python-font-lock-of-chained-assignment-statement.patch --]
[-- Type: application/octet-stream, Size: 2131 bytes --]
From 1af361a25b2ecd84f6731421eb373b5f28f3b4a1 Mon Sep 17 00:00:00 2001
From: kobarity <kobarity@gmail.com>
Date: Fri, 24 May 2024 22:50:12 +0900
Subject: [PATCH] Fix Python font lock of chained assignment statement
* lisp/progmodes/python.el
(python-font-lock-keywords-maximum-decoration): Allow chaining of single
assignment statements.
* test/lisp/progmodes/python-tests.el
(python-font-lock-assignment-statement-20): New test. (Bug#71093)
---
lisp/progmodes/python.el | 3 +--
test/lisp/progmodes/python-tests.el | 10 ++++++++++
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 02588d756e9..051f198e192 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -812,8 +812,7 @@ python-font-lock-keywords-maximum-decoration
;; c: Collection = {1, 2, 3}
;; d: Mapping[int, str] = {1: 'bar', 2: 'baz'}
(,(python-font-lock-assignment-matcher
- (python-rx (or line-start ?\;) (* space)
- grouped-assignment-target (* space)
+ (python-rx grouped-assignment-target (* space)
(? ?: (* space) (+ not-simple-operator) (* space))
(group assignment-operator)))
(1 font-lock-variable-name-face)
diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el
index 95db93dd5cc..06943e22f5b 100644
--- a/test/lisp/progmodes/python-tests.el
+++ b/test/lisp/progmodes/python-tests.el
@@ -474,6 +474,16 @@ python-font-lock-assignment-statement-18
(136 . font-lock-operator-face) (137)
(144 . font-lock-keyword-face) (150))))
+(ert-deftest python-font-lock-assignment-statement-20 ()
+ (python-tests-assert-faces
+ "a = b = c = 1"
+ '((1 . font-lock-variable-name-face) (2)
+ (3 . font-lock-operator-face) (4)
+ (5 . font-lock-variable-name-face) (6)
+ (7 . font-lock-operator-face) (8)
+ (9 . font-lock-variable-name-face) (10)
+ (11 . font-lock-operator-face) (12))))
+
(ert-deftest python-font-lock-escape-sequence-string-newline ()
(python-tests-assert-faces
"'\\n'
--
2.34.1
next prev parent reply other threads:[~2024-05-24 13:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-21 10:47 bug#71093: 30.0.50; python: multiple assignments not fontified Andreas Röhler
2024-05-23 13:12 ` Eli Zaretskii
2024-05-24 12:17 ` kobarity
2024-05-24 12:46 ` Eli Zaretskii
2024-05-24 13:54 ` kobarity [this message]
2024-05-24 14:54 ` Eli Zaretskii
2024-05-26 1:10 ` kobarity
2024-05-26 8:21 ` Eli Zaretskii
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=eke734q71fix.wl-kobarity@gmail.com \
--to=kobarity@gmail.com \
--cc=71093@debbugs.gnu.org \
--cc=andreas.roehler@easy-emacs.de \
--cc=eliz@gnu.org \
--cc=sunlin7.mail@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).