From unknown Sat Sep 13 04:55:00 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#45341 <45341@debbugs.gnu.org> To: bug#45341 <45341@debbugs.gnu.org> Subject: Status: [PATCH] Make python-mode fontify more assignment statements Reply-To: bug#45341 <45341@debbugs.gnu.org> Date: Sat, 13 Sep 2025 11:55:00 +0000 retitle 45341 [PATCH] Make python-mode fontify more assignment statements reassign 45341 emacs submitter 45341 Dario Gjorgjevski severity 45341 normal tag 45341 fixed patch thanks From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 20 11:25:29 2020 Received: (at submit) by debbugs.gnu.org; 20 Dec 2020 16:25:29 +0000 Received: from localhost ([127.0.0.1]:45439 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kr1WT-0000J3-Dd for submit@debbugs.gnu.org; Sun, 20 Dec 2020 11:25:29 -0500 Received: from lists.gnu.org ([209.51.188.17]:56734) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kr1WS-0000Iw-GG for submit@debbugs.gnu.org; Sun, 20 Dec 2020 11:25:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47614) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kr1WS-0006YR-5i for bug-gnu-emacs@gnu.org; Sun, 20 Dec 2020 11:25:28 -0500 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]:44926) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kr1WN-0005iX-TG for bug-gnu-emacs@gnu.org; Sun, 20 Dec 2020 11:25:27 -0500 Received: by mail-ej1-x635.google.com with SMTP id w1so10157071ejf.11 for ; Sun, 20 Dec 2020 08:25:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=DXfsJF8xE2HtMYpfcIewZkILwmXwJAaMDAwi3v79d20=; b=kujO/U8qbS5O8mWoHGY6S/ohJJWYxyCzygfgMa4ZqF3r+qqRIlNLMXVvTFccaMi5Zv TsQ34SYHVUvh+xGc/Q70mn1k0s6D+BwFpuya07QhtsBUY8zj24JlxY4ORy/PaRTPa4CW Ubi73vAJQie3Z6Gs9vlO2EaXejHLibYuvnzk8at25zGPlZWCXHQNqSDsKJ5+o/lN+ApU 2Ra5izs1OB1WaDTIacGSHuE41+xWPMPTjw05hsjk4ejRwyPIl9T807p7hAXIKfHicnoe WGhs78lhZ8HkXPjFU5JNcBnEoBxoZko6fcIFso55m/tXJW6LAmMAuhfyueqKADezD7lc nO2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=DXfsJF8xE2HtMYpfcIewZkILwmXwJAaMDAwi3v79d20=; b=t+3Hc78U/QzD+xhbxEZFVEWoBGvISSND3n5sMYgd8eHkxTHn1FofG6OuBl9yecY3SJ 1ZIobqZ4aNgISU4AcjLtMr/7gHxX2hKRPEgi7z+vu4jsxAF2nC56RfFbpPaWnmKC/DC7 2xTDk5t0OXFc/iXdYSDEyP+rw3ep+Eq+jnzC1QQ79kY0N1ZCTjJ86+d5OMr6XXQ94fMj WJA4EZuO/R/21v/ThRdlTkuvWjMpA+ZdtaPAZiopyYU5kRau5RbE2bgdFQC7tLJUW5MX M8oaRH1A/D0ik8ui4ckTScvPuVJwwFtRU65vlZv8df2GGlJJp7idYfIMPBse8eFDsi0m PQvw== X-Gm-Message-State: AOAM531nDdqI5K7FGonELxYPAVSUExnzRtwSHZveAKB/omEEYYpuL1KR CQgIZnivLXdloII+S9caVRNng0DYAYo= X-Google-Smtp-Source: ABdhPJyh303KbewYxuKEgEiDmShqzI8ivP3gWn09ZvbC630/6LCXrGSsogjhUOoSfGQCcJv1I8vrQw== X-Received: by 2002:a17:906:4e50:: with SMTP id g16mr12548726ejw.191.1608481518705; Sun, 20 Dec 2020 08:25:18 -0800 (PST) Received: from ZALANDO-31298 (p200300e97721508c246000c1866e550b.dip0.t-ipconnect.de. [2003:e9:7721:508c:2460:c1:866e:550b]) by smtp.gmail.com with ESMTPSA id ho12sm7844868ejc.45.2020.12.20.08.25.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 20 Dec 2020 08:25:17 -0800 (PST) From: Dario Gjorgjevski To: bug-gnu-emacs@gnu.org Subject: [PATCH] Make python-mode fontify more assignment statements Date: Sun, 20 Dec 2020 17:25:16 +0100 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2a00:1450:4864:20::635; envelope-from=dario.gjorgjevski@gmail.com; helo=mail-ej1-x635.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --=-=-= Content-Type: text/plain The current implementation in python-mode fontifies only basic assignment statements. It makes mistakes on or entirely misses more complex ones such as [a, b, c] = 1, 2, 3 a, *b, c = range(10) inst.a, inst.b, inst.c = 'foo', 'bar', 'baz' (a, b, *c, d) = x, *y = 5, 6, 7, 8, 9 The patch attached below extends the fontification to work correctly with all these cases. I tested things as well as I could, but would appreciate further testing. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Make-python-mode-fontify-more-assignment-statements.patch Content-Description: Patch to make python-mode fontify more assignment statements >From 5881c2e98d9457e04f6502921ab1cbe7a8e74ef5 Mon Sep 17 00:00:00 2001 From: Dario Gjorgjevski Date: Sun, 20 Dec 2020 17:12:01 +0100 Subject: [PATCH] Make python-mode fontify more assignment statements The current implementation in python-mode fontifies only basic assignment statements. It makes mistakes on or entirely misses more complex ones such as [a, b, c] = 1, 2, 3 a, *b, c = range(10) inst.a, inst.b, inst.c = 'foo', 'bar', 'baz' (a, b, *c, d) = x, *y = 5, 6, 7, 8, 9 This commit extends the fontification to work correctly with all these cases. * lisp/progmodes/python.el (python-font-lock-assignment-matcher): New function to match assignment statements. (python-rx): Add `assignment-target' and `grouped-assignment-target'. (python-font-lock-keywords-maximum-decoration): Add new matchers. --- lisp/progmodes/python.el | 96 +++++++++++++++++++++++++++++----------- 1 file changed, 69 insertions(+), 27 deletions(-) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index d58b32f3c3..50bb841111 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -394,6 +394,12 @@ python-rx (any ?' ?\") "__main__" (any ?' ?\") (* space) ?:)) (symbol-name (seq (any letter ?_) (* (any word ?_)))) + (assignment-target (seq (? ?*) + (* symbol-name ?.) symbol-name + (? ?\[ (+ (not ?\])) ?\]))) + (grouped-assignment-target (seq (? ?*) + (* symbol-name ?.) (group symbol-name) + (? ?\[ (+ (not ?\])) ?\]))) (open-paren (or "{" "[" "(")) (close-paren (or "}" "]" ")")) (simple-operator (any ?+ ?- ?/ ?& ?^ ?~ ?| ?* ?< ?> ?= ?%)) @@ -605,6 +611,18 @@ python-font-lock-keywords-level-2 `python-font-lock-keywords-level-1', as well as keywords and builtins.") +(defun python-font-lock-assignment-matcher (regexp) + "Font lock matcher for assignments based on REGEXP. +Return nil if REGEXP matched within a `paren' context (to avoid, +e.g., default values for arguments or passing arguments by name +being treated as assignments) or is followed by an '=' sign (to +avoid '==' being treated as an assignment." + (lambda (limit) + (let ((res (re-search-forward regexp limit t))) + (unless (or (python-syntax-context 'paren) + (equal (char-after (point)) ?=)) + res)))) + (defvar python-font-lock-keywords-maximum-decoration `((python--font-lock-f-strings) ,@python-font-lock-keywords-level-2 @@ -652,33 +670,57 @@ python-font-lock-keywords-maximum-decoration ) symbol-end) . font-lock-type-face) - ;; assignments - ;; support for a = b = c = 5 - (,(lambda (limit) - (let ((re (python-rx (group symbol-name) - ;; subscript, like "[5]" - (? ?\[ (+ (not ?\])) ?\]) (* space) - ;; type hint, like ": int" or ": Mapping[int, str]" - (? ?: (* space) (+ not-simple-operator) (* space)) - assignment-operator)) - (res nil)) - (while (and (setq res (re-search-forward re limit t)) - (or (python-syntax-context 'paren) - (equal (char-after (point)) ?=)))) - res)) - (1 font-lock-variable-name-face nil nil)) - ;; support for a, b, c = (1, 2, 3) - (,(lambda (limit) - (let ((re (python-rx (group symbol-name) (* space) - (* ?, (* space) symbol-name (* space)) - ?, (* space) symbol-name (* space) - assignment-operator)) - (res nil)) - (while (and (setq res (re-search-forward re limit t)) - (goto-char (match-end 1)) - (python-syntax-context 'paren))) - res)) - (1 font-lock-variable-name-face nil nil))) + ;; multiple assignment + ;; (note that type hints are not allowed for multiple assignments) + ;; a, b, c = 1, 2, 3 + ;; a, *b, c = 1, 2, 3, 4, 5 + ;; [a, b] = (1, 2) + ;; (l[1], l[2]) = (10, 11) + ;; (a, b, c, *d) = *x, y = 5, 6, 7, 8, 9 + ;; (a,) = 'foo' + ;; (*a,) = ['foo', 'bar', 'baz'] + ;; d.x, d.y[0], *d.z = 'a', 'b', 'c', 'd', 'e' + ;; and variants thereof + ;; the cases + ;; (a) = 5 + ;; [a] = 5 + ;; [*a] = 5, 6 + ;; are handled separately below + (,(python-font-lock-assignment-matcher + (python-rx (? (or "[" "(") (* space)) + grouped-assignment-target (* space) ?, (* space) + (* assignment-target (* space) ?, (* space)) + (? assignment-target (* space)) + (? ?, (* space)) + (? (or ")" "]") (* space)) + (group assignment-operator))) + (1 font-lock-variable-name-face) + (,(python-rx grouped-assignment-target) + (progn + (goto-char (match-end 1)) ; go back after the first symbol + (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)) + assignment-operator)) + (1 font-lock-variable-name-face)) + ;; special cases + ;; (a) = 5 + ;; [a] = 5 + ;; [*a] = 5, 6 + (,(python-font-lock-assignment-matcher + (python-rx (or "[" "(") (* space) + grouped-assignment-target (* space) + (or ")" "]") (* space) + assignment-operator)) + (1 font-lock-variable-name-face))) "Font lock keywords to use in python-mode for maximum decoration. This decoration level includes everything in -- 2.28.0 --=-=-= Content-Type: text/plain Best regards, Dario -- $ keyserver=hkps://hkps.pool.sks-keyservers.net $ keyid=744A4F0B4F1C9371 $ gpg --keyserver $keyserver --search-keys $keyid --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 20 13:05:11 2020 Received: (at 45341) by debbugs.gnu.org; 20 Dec 2020 18:05:11 +0000 Received: from localhost ([127.0.0.1]:45580 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kr34x-0006y7-Cs for submit@debbugs.gnu.org; Sun, 20 Dec 2020 13:05:11 -0500 Received: from mail-wr1-f52.google.com ([209.85.221.52]:41270) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kr34t-0006xc-5p for 45341@debbugs.gnu.org; Sun, 20 Dec 2020 13:05:07 -0500 Received: by mail-wr1-f52.google.com with SMTP id a12so8488338wrv.8 for <45341@debbugs.gnu.org>; Sun, 20 Dec 2020 10:05:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=tvW99f7Rv+tuRljaDOGNV14V1PmiKXzBbwgc/Qq0+cc=; b=rRlNR49wLub0Tc4Q0XQoNfHuYSnUDEVxGXiEUKBzQ38BJlaZDXbCTF4prtf6+XzqCp JP65ZM+LLAkVOW9W+nMTrP+rtt4t8THLjkexjF18kmwqYJUvqnwQgtvkudAWicQwmcG4 HNrKtRsqPuen+96FvtmHP2DS6EAmc2zb3eQhiI2yMIJp8ADKphhDKzXVQ4YucTpTOdge RWI1s+UcHQwBwhX8eEttRKuYsEsWyKAqnkf0WDXhcAAPyiKrJU4jhzlHebucmJoqmFu8 UkrMKomEbGW/NCDN2LX7+VFAAARkw0LJKwNgVK/JsNx4PnFz5CrGOA8Q1b0TCc4F8P+M qvOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=tvW99f7Rv+tuRljaDOGNV14V1PmiKXzBbwgc/Qq0+cc=; b=mItgtSwLC+uNfJvsN/zkOFMWIMlL2rZlKGSq82clLPYe0E57MTlg1sFyJsvouaZeZ+ 8xMq+ks/EA67dBHXFRokjKR9FWGJHWYckiz4Lt85xBvs5WfpMp7xug7DLZcHsI7WaYBE qyqtDOFZavBsOVNQ9RpHuV6N6J20w/YIeaIAUsJEbX3GqnANaCP8GgNs5n8cksl3cE6f yp9x9Sw5qbyDzns7iSaJrWRwmjBLBxh+hQ4DvWu41oq9ohGbdEB/VTSlAY80LzaUhoKa BIPKzbaHS5dmXMUTzLsDuWP9/XWpLz0dA9Q6Z+U0dXHbfdv6dSfU+Jt3ZSurhE0Na3rG RiUw== X-Gm-Message-State: AOAM530QXfiztg4wit9ovZn2nH97Y9uhjuluCmz7WRdFURfg6UaJC8LX 9qctXOuqzlXm6UsXxklZLmJ4Og== X-Google-Smtp-Source: ABdhPJwTeRwczTZ1+IEqcsCDyb3LZothG/GLa6yKmHkhkWvVe78v+48TYe3HsRihIH9246EB3VssEA== X-Received: by 2002:a5d:6289:: with SMTP id k9mr15140617wru.200.1608487501276; Sun, 20 Dec 2020 10:05:01 -0800 (PST) Received: from localhost ([2a02:8084:20e2:c380:92bd:1bfd:38fc:fae2]) by smtp.gmail.com with ESMTPSA id u26sm19937028wmm.24.2020.12.20.10.05.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Dec 2020 10:05:00 -0800 (PST) From: "Basil L. Contovounesios" To: Dario Gjorgjevski Subject: Re: bug#45341: [PATCH] Make python-mode fontify more assignment statements References: Date: Sun, 20 Dec 2020 18:04:59 +0000 In-Reply-To: (Dario Gjorgjevski's message of "Sun, 20 Dec 2020 17:25:16 +0100") Message-ID: <87sg80gxpw.fsf@tcd.ie> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 45341 Cc: 45341@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Dario Gjorgjevski writes: > +(defun python-font-lock-assignment-matcher (regexp) > + "Font lock matcher for assignments based on REGEXP. > +Return nil if REGEXP matched within a `paren' context (to avoid, > +e.g., default values for arguments or passing arguments by name > +being treated as assignments) or is followed by an '=' sign (to > +avoid '==' being treated as an assignment." > + (lambda (limit) > + (let ((res (re-search-forward regexp limit t))) > + (unless (or (python-syntax-context 'paren) > + (equal (char-after (point)) ?=)) Nit: char-after already defaults to looking at point, but you could also use following-char which always returns a natnum. -- Basil From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 20 23:42:05 2020 Received: (at 45341) by debbugs.gnu.org; 21 Dec 2020 04:42:05 +0000 Received: from localhost ([127.0.0.1]:45925 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1krD1J-0007AT-AQ for submit@debbugs.gnu.org; Sun, 20 Dec 2020 23:42:05 -0500 Received: from quimby.gnus.org ([95.216.78.240]:36948) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1krD1G-00079s-QI for 45341@debbugs.gnu.org; Sun, 20 Dec 2020 23:42:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=2ShTw9zuT/KYH/8KWcXlUBxxkt6+HyEfxgDggStHbgA=; b=bHjMR7vSWRmEGnMdOPyYjdsBOe W0TbcTJw/Hak8yYOoWXi7rzfz0+D3dBUtpZDypctlAS9KjhmTeZjsOylx5dCtqymmnUvxsGqTvUlX 0cKXGUUCBp+aHtAMMI8F85f1O/GKxYZDnjBoMV3NyVYuLkcKoM3A35q5WauFdINJvcdI=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1krD17-00015l-8e; Mon, 21 Dec 2020 05:41:56 +0100 From: Lars Ingebrigtsen To: Dario Gjorgjevski Subject: Re: bug#45341: [PATCH] Make python-mode fontify more assignment statements References: X-Now-Playing: Steven Brown's _Music for Film & Theatre (2)_: "The Flight" Date: Mon, 21 Dec 2020 05:41:52 +0100 In-Reply-To: (Dario Gjorgjevski's message of "Sun, 20 Dec 2020 17:25:16 +0100") Message-ID: <87h7ofhisv.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Dario Gjorgjevski writes: > The patch attached below extends the fontification to work correctly > with all these cases. I tested things as well as I could, but would > appreciate further testing. Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 45341 Cc: 45341@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Dario Gjorgjevski writes: > The patch attached below extends the fontification to work correctly > with all these cases. I tested things as well as I could, but would > appreciate further testing. I did some cursory testing, and it seemed to work well for me, so I've applied your patch to Emacs 28. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 20 23:43:38 2020 Received: (at 45341) by debbugs.gnu.org; 21 Dec 2020 04:43:39 +0000 Received: from localhost ([127.0.0.1]:45929 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1krD2o-0007Cx-LC for submit@debbugs.gnu.org; Sun, 20 Dec 2020 23:43:38 -0500 Received: from quimby.gnus.org ([95.216.78.240]:36972) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1krD2m-0007Cd-3h for 45341@debbugs.gnu.org; Sun, 20 Dec 2020 23:43:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=ipjrdt0JcB6CWMtaTDxDBGtOjMfpZuXEGUMp7edXoDE=; b=NNq4RldFiaTqr0giObIHTfliWo kbtTnm2O7hNcuqRY/I0E0W4ucimslcAKhrSai7Ekgee19M3YjbpyCir/XOXmwMmJnbFTV31/fJ8Kz yh8jLhXagK3l9lR8lqUpTvPzSd0B1wEjQ4NNEiEXc213AnnngTlMfrPx2SnM82rePzT4=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1krD2a-00016U-9l; Mon, 21 Dec 2020 05:43:30 +0100 From: Lars Ingebrigtsen To: "Basil L. Contovounesios" Subject: Re: bug#45341: [PATCH] Make python-mode fontify more assignment statements References: <87sg80gxpw.fsf@tcd.ie> X-Now-Playing: Steven Brown's _Music for Film & Theatre (2)_: "The Flight" Date: Mon, 21 Dec 2020 05:43:22 +0100 In-Reply-To: <87sg80gxpw.fsf@tcd.ie> (Basil L. Contovounesios's message of "Sun, 20 Dec 2020 18:04:59 +0000") Message-ID: <87czz3hiqd.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: "Basil L. Contovounesios" writes: >> + (let ((res (re-search-forward regexp limit t))) >> + (unless (or (python-syntax-context 'paren) >> + (equal (char-after (point)) ?=)) > > Nit: char-after already defaults to looking at point, but [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 45341 Cc: Dario Gjorgjevski , 45341@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) "Basil L. Contovounesios" writes: >> + (let ((res (re-search-forward regexp limit t))) >> + (unless (or (python-syntax-context 'paren) >> + (equal (char-after (point)) ?=)) > > Nit: char-after already defaults to looking at point, but you could also > use following-char which always returns a natnum. The old code also used this idiom, so I didn't rewrite it before applying. python.el mostly uses (eq (char-after) ?x) throughout its code, though. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 20 23:43:44 2020 Received: (at control) by debbugs.gnu.org; 21 Dec 2020 04:43:44 +0000 Received: from localhost ([127.0.0.1]:45932 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1krD2t-0007DJ-UM for submit@debbugs.gnu.org; Sun, 20 Dec 2020 23:43:44 -0500 Received: from quimby.gnus.org ([95.216.78.240]:36988) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1krD2s-0007Cv-Aa for control@debbugs.gnu.org; Sun, 20 Dec 2020 23:43:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=iSrx2/2FovlFy3SZigkWyXghBh5DrPsNwI7V5nwH7P4=; b=qZLtuoxm5jHIO1njq5Y7vbkufE WfnEskaJE+WT1GxOdwxdiUPsLCM+8XjtJVThuLFnHba6R656Hf1cxmQoSuiq9i1QLiRlpBOCITxaB IVg/wT281Kn9IdGOZ6cxzIjhRnhtcUqgsOUNkqeUXhVsedPy4ToxrzVg+Isd+r6nQ7NI=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1krD2k-00016e-O9 for control@debbugs.gnu.org; Mon, 21 Dec 2020 05:43:36 +0100 Date: Mon, 21 Dec 2020 05:43:33 +0100 Message-Id: <87blenhiq2.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #45341 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: tags 45341 fixed close 45341 28.1 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 45341 fixed close 45341 28.1 quit From unknown Sat Sep 13 04:55:00 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 18 Jan 2021 12:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator