From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jakub =?UTF-8?Q?Je=C4=8Dm=C3=ADnek?= Newsgroups: gmane.emacs.bugs Subject: bug#45897: [PATCH] 27.1; python mode font-lock confused by string concatenation Date: Fri, 19 Jan 2024 18:25:57 +0100 Message-ID: References: <875z3ydqlz.fsf@tromey.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3285"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.1 To: 45897@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jan 19 18:27:16 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 1rQseC-0000jB-6K for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 19 Jan 2024 18:27:16 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQsdy-0001pX-Vz; Fri, 19 Jan 2024 12:27:03 -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 1rQsdx-0001pO-Oa for bug-gnu-emacs@gnu.org; Fri, 19 Jan 2024 12:27:01 -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 1rQsdw-0001bF-E3 for bug-gnu-emacs@gnu.org; Fri, 19 Jan 2024 12:27:00 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rQsdy-0003f8-A0 for bug-gnu-emacs@gnu.org; Fri, 19 Jan 2024 12:27:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Jakub =?UTF-8?Q?Je=C4=8Dm=C3=ADnek?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 19 Jan 2024 17:27: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.170568517013993 (code B ref 45897); Fri, 19 Jan 2024 17:27:02 +0000 Original-Received: (at 45897) by debbugs.gnu.org; 19 Jan 2024 17:26:10 +0000 Original-Received: from localhost ([127.0.0.1]:60084 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rQsd7-0003dc-Ll for submit@debbugs.gnu.org; Fri, 19 Jan 2024 12:26:09 -0500 Original-Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]:51373) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rQsd5-0003dD-MV for 45897@debbugs.gnu.org; Fri, 19 Jan 2024 12:26:08 -0500 Original-Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-50ea8fbf261so1261938e87.2 for <45897@debbugs.gnu.org>; Fri, 19 Jan 2024 09:26:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705685158; x=1706289958; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:user-agent :references:in-reply-to:subject:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NhrupB/ouiWNSa+ELVfkXrNBTC7HIsQl8BmVPavgulQ=; b=NG8GwFJzPbOAhvVOtqXa2Zrw4GoIUg/ZHdUjl/kxcqV1gQDAdSNWFenaro64O1RN5o u6Fu0XzrBoKGASziOrwzRbt7dtTme6Erx1olhP0Got/urhBbgIew0ycOSSgaHRVHOw6E ZJDNsPPtQMbjNi7MT0VmXaSn+Pmlg4y7+l2M4XSFnEVOqVJMeV/2dYUqiHONNizM11Tg GsDMc2tKZ+HyeRK5pUBlsOU0AIf6LAOULJYp8hz2AHSXysugRQxpHilKut77XopQwt56 oV+ebaWC9WKDXY0xFQxjuwPNM+dvf/5SnUfTs8gejV9ySmgpe0bwDJYmAQ7XQnoUI5sk VL6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705685158; x=1706289958; h=content-transfer-encoding:mime-version:message-id:date:user-agent :references:in-reply-to:subject:to:from:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=NhrupB/ouiWNSa+ELVfkXrNBTC7HIsQl8BmVPavgulQ=; b=u6eEM5BeZwNevSppd+IM/wp48xAp41SHMZYL8Q51k+/ObOZ4XHEWrTNZOs4ALIm92F zhnbM/HeeN3Kss5nQaFVcLIfDu/u6QaBjKjjcqAGcQsPboU/mhjGZT5RR4r2vv2R75F/ 79AfwOLjf2OhIXWmzobjtefkwfp3dGZFGADXc98YTOg6RBLTLx3hV21sQmFM/G94DpOm 5VLIps/zm3qvaNCWcHBFuX1JfgpWvAOMkf9ATxLGal3VrESwZLTTCig6SG4GhwFBl3oV xGbyZx/G1DHw+5wnXl/hH8MAiRG/+/LvJ9KrYKDFjie6kTkJeLYhU14vUilZaKWN9cXm uekA== X-Gm-Message-State: AOJu0YyUAbFIF+cSuBDzwsKi3RLPI10gw626wkhtcZEx+AA2ZNKOwTNP NB7sIf1FaOPCT6NfNtbewOBkhOrEmDFaHo8KKzgnVk/vqrzLkihxCep+rhOC X-Google-Smtp-Source: AGHT+IEzTvK8RZQ+K+OYsVGBKaLCqrMWHXAWkCN1hOzq6gj+R/lkbOuBdhvfR1yP6TLHEI2AVazThA== X-Received: by 2002:a19:2d43:0:b0:50e:7533:5f3 with SMTP id t3-20020a192d43000000b0050e753305f3mr7176lft.72.1705685158120; Fri, 19 Jan 2024 09:25:58 -0800 (PST) Original-Received: from Jakubs-MacBook-Air.local (ip-217-030-066-058.aim-net.cz. [217.30.66.58]) by smtp.gmail.com with ESMTPSA id bt16-20020a170906b15000b00a2ada87f6a1sm10523155ejb.90.2024.01.19.09.25.57 for <45897@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 09:25:57 -0800 (PST) In-Reply-To: ("Jakub =?UTF-8?Q?Je=C4=8Dm=C3=ADnek?="'s message of "Fri, 19 Jan 2024 17:01:48 +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:278541 Archived-At: 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). >From 93d60a342c3d12b46d9fece443d63cdb4101a745 Mon Sep 17 00:00:00 2001 From: =3D?UTF-8?q?Jakub=3D20Je=3DC4=3D8Dm=3DC3=3DADnek?=3D 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-lo= ck 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-posi= tion) (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))) (n= th 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 quo= te! (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=C4=8Dm=C3=ADnek