From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#45897: [PATCH] 27.1; python mode font-lock confused by string concatenation Date: Sat, 20 Jan 2024 12:09:50 +0200 Message-ID: <83bk9gtixd.fsf@gnu.org> References: <875z3ydqlz.fsf@tromey.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26548"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 45897@debbugs.gnu.org To: Jakub =?UTF-8?Q?Je=C4=8Dm=C3=ADnek?= , kobarity Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 20 11:11: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 1rR8Jv-0006k9-SP for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 20 Jan 2024 11:11:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rR8Ja-0005Al-1b; Sat, 20 Jan 2024 05:11:02 -0500 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 1rR8JY-0005AP-Ea for bug-gnu-emacs@gnu.org; Sat, 20 Jan 2024 05:11:00 -0500 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 1rR8JY-0006FG-5u for bug-gnu-emacs@gnu.org; Sat, 20 Jan 2024 05:11:00 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rR8Ja-0008Gk-HQ for bug-gnu-emacs@gnu.org; Sat, 20 Jan 2024 05:11:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 20 Jan 2024 10:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45897 X-GNU-PR-Package: emacs Original-Received: via spool by 45897-submit@debbugs.gnu.org id=B45897.170574542231729 (code B ref 45897); Sat, 20 Jan 2024 10:11:02 +0000 Original-Received: (at 45897) by debbugs.gnu.org; 20 Jan 2024 10:10:22 +0000 Original-Received: from localhost ([127.0.0.1]:32908 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rR8Iw-0008Fh-2Y for submit@debbugs.gnu.org; Sat, 20 Jan 2024 05:10:22 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47438) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rR8Iu-0008FT-F5 for 45897@debbugs.gnu.org; Sat, 20 Jan 2024 05:10:21 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rR8Im-00066C-22; Sat, 20 Jan 2024 05:10:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=WQRwYg+yfmaMCg68NWr/gTbYhHDw4qbLXabqmBXV0R4=; b=grE9MJu+FEPjrufGAGW7 g53ILS7btVrgmmGPbEcG1uQXSkhfgeg/p9pE5T17sbUDIVAJCisgvNDQVsernHIqzk0TyhP2Hi1iD Y/KgxbUzP3ef47+bK43O1msIeLLTVCxfXkvED+W+SbYoB7QngunCUGBCMUkAa59WpjyS6rPXExvJa BFowK/0FVSm7X0u6gPG1XGmS1cPQaMdIjqWLyGhOcQlQeGpDGoYq+KJjjz6cK3xip8nnlbwsZfLBE 827uFgyIiYBbLNd9DVPypOyqBDp/wts/nmLeHk62JMIqlON6fhp5ZXnnFGe8s9EyRVckOsrlyuHg4 7vlS8hgRyMO3mw==; In-Reply-To: (message from Jakub =?UTF-8?Q?Je=C4=8Dm=C3=ADnek?= on Fri, 19 Jan 2024 18:25:57 +0100) 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:278587 Archived-At: > From: Jakub Ječmínek > Date: Fri, 19 Jan 2024 18:25:57 +0100 > > Tags: patch > > I'm sending the patch once again with correct indentation and patch tag > (I'm still figuring out how the bug tracker works). Thanks. Kobarity, any comments? > >From 93d60a342c3d12b46d9fece443d63cdb4101a745 Mon Sep 17 00:00:00 2001 > From: =?UTF-8?q?Jakub=20Je=C4=8Dm=C3=ADnek?= > Date: Fri, 19 Jan 2024 16:38:21 +0100 > Subject: [PATCH] Fix syntax highlighting after string literal concatenation in > python-mode > > * lisp/progmodes/python.el (python-syntax-stringify): Fix incorrect font-lock after string > literal concatenation. > --- > lisp/progmodes/python.el | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el > index e2f614f52c2..ca014469952 100644 > --- a/lisp/progmodes/python.el > +++ b/lisp/progmodes/python.el > @@ -908,7 +908,11 @@ is used to limit the scan." > (defun python-syntax-stringify () > "Put `syntax-table' property correctly on single/triple quotes." > (let* ((ppss (save-excursion (backward-char 3) (syntax-ppss))) > + (line-ppss (save-excursion (backward-char 3) (parse-partial-sexp > + (line-beginning-position) (point)))) > (string-start (and (eq t (nth 3 ppss)) (nth 8 ppss))) > + (string-literal-concat (and (null string-start) > + (and (not (null (nth 3 line-ppss))) (nth 8 line-ppss)))) > (quote-starting-pos (- (point) 3)) > (quote-ending-pos (point))) > (cond ((or (nth 4 ppss) ;Inside a comment > @@ -921,6 +925,8 @@ is used to limit the scan." > ((nth 5 ppss) > ;; The first quote is escaped, so it's not part of a triple quote! > (goto-char (1+ quote-starting-pos))) > + ;; Handle string literal concatenation (bug#45897) > + (string-literal-concat nil) > ((null string-start) > ;; This set of quotes delimit the start of a string. Put > ;; string fence syntax on last quote. (bug#49518) > -- > 2.39.3 (Apple Git-145) > > I'm more than happy to make further changes if need be. > > Best, > > Jakub Ječmínek > > > >