From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: kobarity Newsgroups: gmane.emacs.bugs Subject: bug#71093: 30.0.50; python: multiple assignments not fontified Date: Fri, 24 May 2024 21:17:39 +0900 Message-ID: References: <86h6eo4qp2.fsf@gnu.org> Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: multipart/mixed; boundary="Multipart_Fri_May_24_21:17:38_2024-1" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12919"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?Q?Goj=C5=8D?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.0.50 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) Cc: Andreas =?UTF-8?Q?R=C3=B6hler?= , Lin Sun , 71093@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri May 24 14:20:24 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sATuJ-00038R-Dt for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 24 May 2024 14:20:23 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sATtw-0008RJ-J4; Fri, 24 May 2024 08:20:02 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sATtv-0008R6-2K for bug-gnu-emacs@gnu.org; Fri, 24 May 2024 08:19:59 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sATts-0000AN-U6 for bug-gnu-emacs@gnu.org; Fri, 24 May 2024 08:19:58 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sATty-0004bb-EC for bug-gnu-emacs@gnu.org; Fri, 24 May 2024 08:20:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: kobarity Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 24 May 2024 12:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71093 X-GNU-PR-Package: emacs Original-Received: via spool by 71093-submit@debbugs.gnu.org id=B71093.171655316317683 (code B ref 71093); Fri, 24 May 2024 12:20:02 +0000 Original-Received: (at 71093) by debbugs.gnu.org; 24 May 2024 12:19:23 +0000 Original-Received: from localhost ([127.0.0.1]:36853 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sATtI-0004b9-Vi for submit@debbugs.gnu.org; Fri, 24 May 2024 08:19:23 -0400 Original-Received: from mail-il1-f180.google.com ([209.85.166.180]:56341) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sATtG-0004az-7X for 71093@debbugs.gnu.org; Fri, 24 May 2024 08:19:20 -0400 Original-Received: by mail-il1-f180.google.com with SMTP id e9e14a558f8ab-36dd6110186so27266365ab.0 for <71093@debbugs.gnu.org>; Fri, 24 May 2024 05:19:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716553085; x=1717157885; darn=debbugs.gnu.org; h=mime-version:user-agent:references:in-reply-to:subject:cc:to:from :message-id:date:from:to:cc:subject:date:message-id:reply-to; bh=IpNwvQtF0h+iVeZWjIMjB7jfoCSEcgzhcHBbVP2Q8po=; b=DtE6qkwl0eHQjkw36Tf6LTE/e1u7hP7jRDCxNDQOWamQlxdY5/R2MZS1JfntGkSQTq x8ZPuY1m3aXC/nii15kBKpFnLjUMjSzmhoU2JYO45tBdvQ1Ki6eg824pFzpkg88QHEpm QZXehCqDrwkuy/+W2nVVMWWQgQVdmrOzRnTlnwdc6PuTDv0lW8ePDj+NsOj8Pn1Kery+ SE2nGwSWpWc5yTCVqj3iHuTadH5Qm8L8B7fWYvqVPM3+tpQgEJRuBEgvIcQlNJMtc0uu sUA/mqGADGiFOHPEtVI4LJtRKn1um+Z8THe80IXuK5c744D35/DJCLoILdec0ZfYE0Ab 2SWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716553085; x=1717157885; h=mime-version:user-agent:references:in-reply-to:subject:cc:to:from :message-id:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=IpNwvQtF0h+iVeZWjIMjB7jfoCSEcgzhcHBbVP2Q8po=; b=vwufsFnOiv1OkLScQCixgmGgfjZ4PO+eQw07di41lbsiudUZDRgcSRwMG31DU2kNq+ i9o2sZJPqHl7Pt+hSO4nRaXI17Pj/itT43cods4+WLA3A/t24Q3DYxsWxb3E2DvqYlJT 2988WSoFdK7jKaFZ1yXcNjJTE4ZLKDHMFkY0d4BrflT0JoGDsgN4MPFR4G6FiEdp+kTq 0ivb0kfkdXGg5qOtnCQsAVjNwzoQERSkKxc6VhZQa/Pkn4ONdIPLHHEvILDu0OO7FnUX EPdnJhF8hINT8WaLo3/kFVzjzvEpzFMcM6VRwhGzdFlTrtCPuVP8RuuGqPNz5O8RynNU PCYQ== X-Forwarded-Encrypted: i=1; AJvYcCWxMk5gLPmo0xLvRm1RpW8t5TnDyQzdOhIPeeBiH7dVYkeVs7MsNon+5OOsQEZhSfyQr3uvC3ih5bF9HxN/Wy7mbNoMmDI= X-Gm-Message-State: AOJu0YxvLL5I+hLNLFDVvSwgjW/UEp5RJU995SUDCK+7gXofplvI2mgW BaJGMTWwarZYRLhRcWVTGhOs6+AmDJud7gg9kLVZg9rYH1FqIEUQ X-Google-Smtp-Source: AGHT+IHhnuGfL1fPdXNrpIA4W11DuanrhpfuuqgFwWjoHQsMr96VeGGIznYc0p5O4kTxbCyj0vVk2w== X-Received: by 2002:a92:c561:0:b0:36c:4aba:10be with SMTP id e9e14a558f8ab-3737b2c588fmr25150555ab.10.1716553085446; Fri, 24 May 2024 05:18:05 -0700 (PDT) Original-Received: from localhost (58x12x133x161.ap58.ftth.ucom.ne.jp. [58.12.133.161]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-6822073fbf4sm1028808a12.6.2024.05.24.05.18.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 05:18:04 -0700 (PDT) In-Reply-To: <86h6eo4qp2.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:285766 Archived-At: --Multipart_Fri_May_24_21:17:38_2024-1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Eli Zaretskii wrote: >=20 > > Date: Tue, 21 May 2024 12:47:57 +0200 > > From: Andreas R=F6hler > >=20 > > a =3D b =3D c =3D 5 > >=20 > > b and c are not fontified >=20 > 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? --Multipart_Fri_May_24_21:17:38_2024-1 Content-Type: application/octet-stream; type=patch; name="0001-Fix-Python-font-lock-of-chained-assignment-statement.patch" Content-Disposition: attachment; filename="0001-Fix-Python-font-lock-of-chained-assignment-statement.patch" Content-Transfer-Encoding: 7bit >From 0476507cc1fb77217fe051f6261c9a9a1d38243c Mon Sep 17 00:00:00 2001 From: kobarity 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 --Multipart_Fri_May_24_21:17:38_2024-1--