* bug#71093: 30.0.50; python: multiple assignments not fontified
@ 2024-05-21 10:47 Andreas Röhler
2024-05-23 13:12 ` Eli Zaretskii
0 siblings, 1 reply; 8+ messages in thread
From: Andreas Röhler @ 2024-05-21 10:47 UTC (permalink / raw)
To: 71093
a = b = c = 5
b and c are not fontified
GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33,
cairo version 1.16.0) of 2024-05-21
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#71093: 30.0.50; python: multiple assignments not fontified
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
0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2024-05-23 13:12 UTC (permalink / raw)
To: Andreas Röhler, kobarity, Lin Sun; +Cc: 71093
> 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.
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#71093: 30.0.50; python: multiple assignments not fontified
2024-05-23 13:12 ` Eli Zaretskii
@ 2024-05-24 12:17 ` kobarity
2024-05-24 12:46 ` Eli Zaretskii
0 siblings, 1 reply; 8+ messages in thread
From: kobarity @ 2024-05-24 12:17 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Andreas Röhler, Lin Sun, 71093
[-- Attachment #1: Type: text/plain, Size: 590 bytes --]
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?
[-- Attachment #2: 0001-Fix-Python-font-lock-of-chained-assignment-statement.patch --]
[-- Type: application/octet-stream, Size: 2137 bytes --]
From 0476507cc1fb77217fe051f6261c9a9a1d38243c Mon Sep 17 00:00:00 2001
From: kobarity <kobarity@gmail.com>
Date: Fri, 24 May 2024 21:00:59 +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 360936c9efd..fea52b2f7d6 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -800,8 +800,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) (group (+ 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 b19c5c31f16..de6a4316758 100644
--- a/test/lisp/progmodes/python-tests.el
+++ b/test/lisp/progmodes/python-tests.el
@@ -502,6 +502,16 @@ python-font-lock-assignment-statement-19
(31 . font-lock-type-face) (40)
(43 . font-lock-operator-face) (44))))
+(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-operator-1 ()
(python-tests-assert-faces
"1 << 2 ** 3 == +4%-5|~6&7^8%9"
--
2.34.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* bug#71093: 30.0.50; python: multiple assignments not fontified
2024-05-24 12:17 ` kobarity
@ 2024-05-24 12:46 ` Eli Zaretskii
2024-05-24 13:54 ` kobarity
0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2024-05-24 12:46 UTC (permalink / raw)
To: kobarity; +Cc: andreas.roehler, sunlin7.mail, 71093
> 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.
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#71093: 30.0.50; python: multiple assignments not fontified
2024-05-24 12:46 ` Eli Zaretskii
@ 2024-05-24 13:54 ` kobarity
2024-05-24 14:54 ` Eli Zaretskii
0 siblings, 1 reply; 8+ messages in thread
From: kobarity @ 2024-05-24 13:54 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: andreas.roehler, sunlin7.mail, 71093
[-- 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
^ permalink raw reply related [flat|nested] 8+ messages in thread
* bug#71093: 30.0.50; python: multiple assignments not fontified
2024-05-24 13:54 ` kobarity
@ 2024-05-24 14:54 ` Eli Zaretskii
2024-05-26 1:10 ` kobarity
0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2024-05-24 14:54 UTC (permalink / raw)
To: kobarity; +Cc: andreas.roehler, sunlin7.mail, 71093-done
> Date: Fri, 24 May 2024 22:54:46 +0900
> From: kobarity <kobarity@gmail.com>
> Cc: andreas.roehler@easy-emacs.de,
> sunlin7.mail@gmail.com,
> 71093@debbugs.gnu.org
>
> 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.
Thanks, installed on the emacs-29 branch, and closing the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#71093: 30.0.50; python: multiple assignments not fontified
2024-05-24 14:54 ` Eli Zaretskii
@ 2024-05-26 1:10 ` kobarity
2024-05-26 8:21 ` Eli Zaretskii
0 siblings, 1 reply; 8+ messages in thread
From: kobarity @ 2024-05-26 1:10 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: andreas.roehler, sunlin7.mail, 71093-done
[-- Attachment #1: Type: text/plain, Size: 1558 bytes --]
Eli Zaretskii wrote:
>
> > Date: Fri, 24 May 2024 22:54:46 +0900
> > From: kobarity <kobarity@gmail.com>
> > Cc: andreas.roehler@easy-emacs.de,
> > sunlin7.mail@gmail.com,
> > 71093@debbugs.gnu.org
> >
> > 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.
>
> Thanks, installed on the emacs-29 branch, and closing the bug.
Thanks, but there seems to be a problem with the merge to master.
Could you apply the attached patch to master?
[-- Attachment #2: 0001-Fix-merge-error.patch --]
[-- Type: application/octet-stream, Size: 1770 bytes --]
From 65b11fb8b16aa8e87ffbd497ba3b7d0cd2dcf18c Mon Sep 17 00:00:00 2001
From: kobarity <kobarity@gmail.com>
Date: Sun, 26 May 2024 09:56:29 +0900
Subject: [PATCH] ; Fix merge error
---
lisp/progmodes/python.el | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 79e383a1c1a..fea52b2f7d6 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -800,8 +800,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) (group (+ not-simple-operator)) (* space))
(group assignment-operator)))
(1 font-lock-variable-name-face)
@@ -845,17 +844,6 @@ python-font-lock-keywords-maximum-decoration
(match-beginning 2)) ; limit the search until the assignment
nil
(1 font-lock-variable-name-face)))
- ;; single assignment with type hints, e.g.
- ;; a: int = 5
- ;; b: Tuple[Optional[int], Union[Sequence[str], str]] = (None, 'foo')
- ;; c: Collection = {1, 2, 3}
- ;; d: Mapping[int, str] = {1: 'bar', 2: 'baz'}
- (,(python-font-lock-assignment-matcher
- (python-rx grouped-assignment-target (* space)
- (? ?: (* space) (+ not-simple-operator) (* space))
- (group assignment-operator)))
- (1 font-lock-variable-name-face)
- (2 'font-lock-operator-face))
;; special cases
;; (a) = 5
;; [a] = 5,
--
2.34.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* bug#71093: 30.0.50; python: multiple assignments not fontified
2024-05-26 1:10 ` kobarity
@ 2024-05-26 8:21 ` Eli Zaretskii
0 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2024-05-26 8:21 UTC (permalink / raw)
To: kobarity; +Cc: andreas.roehler, sunlin7.mail, 71093-done
> Date: Sun, 26 May 2024 10:10:27 +0900
> From: kobarity <kobarity@gmail.com>
> Cc: andreas.roehler@easy-emacs.de,
> sunlin7.mail@gmail.com,
> 71093-done@debbugs.gnu.org
>
> > > Attached is the patch for emacs-29 branch.
> >
> > Thanks, installed on the emacs-29 branch, and closing the bug.
>
> Thanks, but there seems to be a problem with the merge to master.
> Could you apply the attached patch to master?
Thanks, done.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-05-26 8:21 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2024-05-24 14:54 ` Eli Zaretskii
2024-05-26 1:10 ` kobarity
2024-05-26 8:21 ` Eli Zaretskii
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.