From unknown Fri Aug 15 15:37:34 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45897: 27.1; python mode font-lock confused by string concatenation Resent-From: Tom Tromey Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 15 Jan 2021 18:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 45897 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 45897@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16107338577948 (code B ref -1); Fri, 15 Jan 2021 18:05:02 +0000 Received: (at submit) by debbugs.gnu.org; 15 Jan 2021 18:04:17 +0000 Received: from localhost ([127.0.0.1]:41676 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l0TSK-000247-EL for submit@debbugs.gnu.org; Fri, 15 Jan 2021 13:04:16 -0500 Received: from lists.gnu.org ([209.51.188.17]:52190) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l0TSI-00023z-AU for submit@debbugs.gnu.org; Fri, 15 Jan 2021 13:04:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49936) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l0TSI-0006TH-5n for bug-gnu-emacs@gnu.org; Fri, 15 Jan 2021 13:04:14 -0500 Received: from gateway22.websitewelcome.com ([192.185.47.129]:14029) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l0TSE-0000W8-0Y for bug-gnu-emacs@gnu.org; Fri, 15 Jan 2021 13:04:13 -0500 Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway22.websitewelcome.com (Postfix) with ESMTP id AB97F9931 for ; Fri, 15 Jan 2021 12:03:53 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id 0TRxlHTwVHPnU0TRxl0alq; Fri, 15 Jan 2021 12:03:53 -0600 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID: Date:Subject:To:From:Sender:Reply-To:Cc: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=ukIB08clO2qvBdxaVXNauOdjC/RL53xIUXIAVmN+DOw=; b=Zk42hxfT8jednTQ/IzFTVOG/PD hTZY0a039ZtHt8vX7/aQd22DeckO3P0uFN0ILlX5zo/DcJOpl0o66zZV4g/x0V+MS5f6uaY1TITp+ fPmCfs48DnGSW/3zT008QOMH/; Received: from 97-122-65-38.hlrn.qwest.net ([97.122.65.38]:60260 helo=murgatroyd) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1l0TRx-000RGY-Dk; Fri, 15 Jan 2021 11:03:53 -0700 From: Tom Tromey X-Attribution: Tom Date: Fri, 15 Jan 2021 11:03:52 -0700 Message-ID: <875z3ydqlz.fsf@tromey.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.65.38 X-Source-L: No X-Exim-ID: 1l0TRx-000RGY-Dk X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-65-38.hlrn.qwest.net (murgatroyd) [97.122.65.38]:60260 X-Source-Auth: tom+tromey.com X-Email-Count: 1 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes Received-SPF: permerror client-ip=192.185.47.129; envelope-from=tom@tromey.com; helo=gateway22.websitewelcome.com X-Spam_score_int: 15 X-Spam_score: 1.5 X-Spam_bar: + X-Spam_report: (1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_BL_SPAMCOP_NET=1.347, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_RP_RNBL=1.31, SPF_HELO_PASS=-0.001, SPF_NEUTRAL=0.779 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -0.4 (/) 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.4 (-) Consider this 2-line Python file: x =3D "hello""" y =3D "confused" If you put this into a .py file, Emacs will font-lock the second line incorrectly. It appears that Emacs thinks the `"""' on the first line is an opening triple quote. However, it is actually string concatenation, with the second string being empty. I tripped over a case like this in some real code. In GNU Emacs 27.1 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.24.21, = cairo version 1.16.0) of 2020-08-20 built on buildvm-x86-24.iad2.fedoraproject.org Windowing system distributor 'Fedora Project', version 11.0.12010000 System Description: Fedora 32 (Workstation Edition) Recent messages: Wrote /home/tromey/.newsrc.eld Saving /home/tromey/.newsrc.eld...done (No changes need to be saved) (New file) Can=E2=80=99t guess python-indent-offset, using defaults: 4 EOL while scanning string literal [3 times] Saving file /tmp/q.py... Wrote /tmp/q.py Quit Undo Configured using: 'configure --build=3Dx86_64-redhat-linux-gnu --host=3Dx86_64-redhat-linux-gnu --program-prefix=3D --disable-dependency-tracking --prefix=3D/usr --exec-prefix=3D/usr --bindir=3D/usr/bin --sbindir=3D/usr/sbin --sysconfdir=3D/etc --datadir=3D/usr/share --includedir=3D/usr/include --libdir=3D/usr/lib64 --libexecdir=3D/usr/libexec --localstatedir=3D/var --sharedstatedir=3D/var/lib --mandir=3D/usr/share/man --infodir=3D/usr/share/info --with-dbus --with-gif --with-jpeg --with-png --with-rsvg --with-tiff --with-xft --with-xpm --with-x-toolkit=3Dgtk3 --with-gpm=3Dno --with-xwidgets --with-modules --with-harfbuzz --with-cairo --with-json build_alias=3Dx86_64-redhat-linux-gnu host_alias=3Dx86_64-redhat-linux-gnu 'CFLAGS=3D-DMAIL_USE_LOCKF -O2 -g -pipe -Wall -Werror=3Dformat-security -Wp,-D_FORTIFY_SOURCE=3D2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=3D/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=3D/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=3Dgeneric -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' LDFLAGS=3D-Wl,-z,relro PKG_CONFIG_PATH=3D:/usr/lib64/pkgconfig:/usr/share/pkgconfig' Configured features: XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND DBUS GSETTINGS GLIB NOTIFY INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS XWIDGETS LIBSYSTEMD JSON PDUMPER GMP Important settings: value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=3Dibus locale-coding-system: utf-8-unix Major mode: Python Minor modes in effect: erc-list-mode: t erc-menu-mode: t erc-autojoin-mode: t erc-ring-mode: t erc-pcomplete-mode: t erc-netsplit-mode: t erc-spelling-mode: t erc-truncate-mode: t display-fill-column-indicator-mode: t flyspell-mode: t shell-dirtrack-mode: t which-function-mode: t erc-track-mode: t erc-track-minor-mode: t erc-notify-mode: t erc-notifications-mode: t erc-match-mode: t erc-services-mode: t erc-networks-mode: t erc-hl-nicks-mode: t erc-button-mode: t erc-fill-mode: t erc-stamp-mode: t erc-irccontrols-mode: t erc-noncommands-mode: t erc-move-to-prompt-mode: t erc-readonly-mode: t flycheck-mode: t savehist-mode: t tooltip-mode: t global-eldoc-mode: t eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t column-number-mode: t line-number-mode: t auto-fill-function: python-do-auto-fill transient-mark-mode: t Load-path shadows: None found. Features: (shadow emacsbug tramp-cmds yaml-mode gnus-draft vc-annotate tramp-cache thai-util thai-word goto-addr log-edit sh-script smie executable cc-mode cc-fonts cc-guess cc-menus cc-cmds tabify man find-dired rst ffap grep webjump log-view pcvs-util dabbrev mule-util ggtags etags fileloop generator bug-reference tcl jka-compr gnus-html url-queue help-fns radix-tree url-cache mm-url flow-fill misearch multi-isearch shr-color supercite regi smerge-mode diff python tramp-sh ada-mode ada-imenu align ada-skel wisi-skel skeleton ada-process wisi-process-parse ada-indent-user-options ada-core wisi-prj wisi xref wisi-fringe wisi-parse-common semantic/lex semantic/fw mode-local uniquify-files project find-file compile erc-list erc-menu erc-join erc-ring erc-pcomplete erc-netsplit erc-spelling erc-truncate cl-extra smiley mm-archive gnus-bcklg qp gnus-async gnus-ml disp-table sort gnus-cite vc-mtn vc-hg mailalias mail-hist nnir gnus-topic nndraft nnmh nnfolder utf-7 bbdb-gnus bbdb-mua bbdb-com crm gnutls network-stream nsm gnus-agent gnus-srvr gnus-score score-mode nnvirtual gnus-msg gnus-art mm-uu mml2015 mm-view mml-smime smime dig nntp gnus-cache gnus-sum url url-proxy url-privacy url-expand url-methods url-history mailcap shr url-cookie url-domsuf svg dom gnus-group gnus-undo smtpmail gnus-start gnus-cloud nnimap nnmail mail-source utf7 netrc nnoo gnus-spec gnus-int gnus-range gnus-win gnus nnheader bbdb-message sendmail mail-extr message rmc puny rfc822 mml mml-sec epa derived epg epg-config gnus-util rmail rmail-loaddefs text-property-search mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils mailheader rfc2368 copyright add-log make-mode vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs vc-git diff-mode easy-mmode term/xterm xterm display-fill-column-indicator flyspell ispell diminish appt diary-lib diary-loaddefs cal-menu calendar cal-loaddefs tramp tramp-loaddefs trampver tramp-integration files-x tramp-compat shell pcomplete parse-time iso8601 time-date ls-lisp which-func imenu autorevert filenotify desktop frameset cus-start cus-load git-link url-util erc-track erc-notify erc-desktop-notifications erc-match erc-services erc-networks notifications dbus erc-hl-nicks color erc-button erc-fill erc-stamp wid-edit erc-goodies erc erc-backend erc-compat format-spec thingatpt pp erc-loaddefs dired-aux dired-x dired dired-loaddefs warnings advice vc-dir ewoc vc vc-dispatcher flycheck find-func help-mode rx dash cc-styles cc-align cc-engine cc-vars cc-defs bbdb bbdb-site timezone ange-ftp comint ansi-color ring server savehist finder-inf clang-rename clang-include-fixer let-alist clang-format xml info package easymenu browse-url url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache json subr-x map url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads dbusbind inotify dynamic-setting system-font-setting font-render-setting xwidget-internal cairo move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 1294698 143374) (symbols 48 40600 90) (strings 32 416876 28749) (string-bytes 1 9986293) (vectors 16 135630) (vector-slots 8 2470110 287678) (floats 8 541 727) (intervals 56 112191 2695) (buffers 1000 395)) From unknown Fri Aug 15 15:37:34 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45897: 27.1; python mode font-lock confused by string concatenation 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 16:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45897 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 45897@debbugs.gnu.org Cc: Tom Tromey Received: via spool by 45897-submit@debbugs.gnu.org id=B45897.170568012117670 (code B ref 45897); Fri, 19 Jan 2024 16:02:02 +0000 Received: (at 45897) by debbugs.gnu.org; 19 Jan 2024 16:02:01 +0000 Received: from localhost ([127.0.0.1]:59999 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rQrJh-0004aa-0b for submit@debbugs.gnu.org; Fri, 19 Jan 2024 11:02:01 -0500 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]:53308) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rQrJe-0004VO-UA for 45897@debbugs.gnu.org; Fri, 19 Jan 2024 11:01:59 -0500 Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-a2821884a09so68234766b.2 for <45897@debbugs.gnu.org>; Fri, 19 Jan 2024 08:01:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705680110; x=1706284910; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:cc:to :user-agent:references:in-reply-to:subject:from:from:to:cc:subject :date:message-id:reply-to; bh=ZIMV16RlXacrVlOY3Cef4iiiB4bRC5iqFPDGf1tKtPY=; b=BpVz2Ju1NSl700KxssKWLlEK4C0TvM/2Po0vYzfANQf9qTINxOPQEOGlLb+h/PCg5g NzBRGyabfO+UnHXLEX+tVFaNMy8pozXDiMu9DO4WEtRe6MepaCPo0e/am6gjw0Vhsrn0 475aCk0RuGjLzNqW7faJcoP1Qc0Ny3wFPJF9ePteIAjUnJDxNeFHtGkTNHOVzJXr0h13 gPWtuUzKI/LMcZruv8zWuROL3zGOmCDCwsTQ7pPrIU0S7HBeY/2WgM9SY5/WUTNfk7R/ +B0Cvwu9X2lhKNeMLsmhI2mciH/YohbCQNIiU16HE2QWgEj6kdEehH8X8xkLRocclZlh UJuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705680110; x=1706284910; h=content-transfer-encoding:mime-version:message-id:date:cc:to :user-agent:references:in-reply-to:subject:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=ZIMV16RlXacrVlOY3Cef4iiiB4bRC5iqFPDGf1tKtPY=; b=eNrOjIg8esmUh5OmzJEjp0t+CKGY2iWtYUQncafC7Hjw/xG/aja+ElOZfhMoUxdFY2 ABaA7UuruJYejI4gUQKAqnUv3mggaGbT9gbBTacCeCkSMhjNlDy8ElwuZ3q5quYZRnOi cKjGUsSmO1j8nZx/eO1JOXMS3Ud0faRi3CYD+7dymd5LL7fAIOZ0cuYCVadoRS8PMSZw 4vXz2kRfi5bLhhsxlOUwEEfLOLSAdWKfW9pCxg5q8R9YN1HyMRl5sC33rgjxbbkP+K4F TyIc15JVcrqwTO+F7fwrhn5At30HUMDc3Jw7RsiShuTRhF+FYio4gG7zfH8beTtdS32f BC/Q== X-Gm-Message-State: AOJu0Yy4me0Irkwb3F8qg+0v9ACDc9Qf9OVZRgf89mlaxUJRC/DAVCyX mfgTPUoIWGS0R6e1pzVZCDIQY7fCY/9KS7+zwg9fCVbJ3OW+xKw1 X-Google-Smtp-Source: AGHT+IERchoph9ElcaT/pRn6BlCvEFOx2y6oQbSPaLQkbRDdleBaw/XzGEJrbT9x5sFcxDBdmNBy4A== X-Received: by 2002:a17:906:40c8:b0:a28:b35d:f240 with SMTP id a8-20020a17090640c800b00a28b35df240mr6496ejk.10.1705680110090; Fri, 19 Jan 2024 08:01:50 -0800 (PST) Received: from Jakubs-MacBook-Air.local ([185.249.114.4]) by smtp.gmail.com with ESMTPSA id i18-20020a170906091200b00a2c2b475a0esm10354896ejd.105.2024.01.19.08.01.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 08:01:49 -0800 (PST) From: Jakub =?UTF-8?Q?Je=C4=8Dm=C3=ADnek?= In-Reply-To: <875z3ydqlz.fsf@tromey.com> (Tom Tromey's message of "Fri, 15 Jan 2021 11:03:52 -0700") References: <875z3ydqlz.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.1 Date: Fri, 19 Jan 2024 17:01:48 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) 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 (-) Tom Tromey writes: > Consider this 2-line Python file: > > x =3D "hello""" > y =3D "confused" > > If you put this into a .py file, Emacs will font-lock the second line > incorrectly. It appears that Emacs thinks the `"""' on the first line > is an opening triple quote. However, it is actually string > concatenation, with the second string being empty. > > I tripped over a case like this in some real code. Hi, thanks for the bug report and sorry for the late response! I confirm that this is an issue. I've prepared a patch which handles this special case: >From f34c84b8b4c629c51d547dd41d20222b32f838bb 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..d6534a7ddae 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))) (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 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) If the patch is good enough, I'll sign the paperwork (I've most likely crossed the line limit). Best, Jakub Je=C4=8Dm=C3=ADnek From unknown Fri Aug 15 15:37:34 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45897: [PATCH] 27.1; python mode font-lock confused by string concatenation 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 X-GNU-PR-Keywords: To: 45897@debbugs.gnu.org Received: via spool by 45897-submit@debbugs.gnu.org id=B45897.170568517013993 (code B ref 45897); Fri, 19 Jan 2024 17:27:02 +0000 Received: (at 45897) by debbugs.gnu.org; 19 Jan 2024 17:26:10 +0000 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 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 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) 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) From: Jakub =?UTF-8?Q?Je=C4=8Dm=C3=ADnek?= In-Reply-To: ("Jakub =?UTF-8?Q?Je=C4=8Dm=C3=ADnek?="'s message of "Fri, 19 Jan 2024 17:01:48 +0100") References: <875z3ydqlz.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.1 Date: Fri, 19 Jan 2024 18:25:57 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) 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: 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 From unknown Fri Aug 15 15:37:34 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45897: [PATCH] 27.1; python mode font-lock confused by string concatenation 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 X-GNU-PR-Keywords: To: Jakub =?UTF-8?Q?Je=C4=8Dm=C3=ADnek?= , kobarity Cc: 45897@debbugs.gnu.org Received: via spool by 45897-submit@debbugs.gnu.org id=B45897.170574542231729 (code B ref 45897); Sat, 20 Jan 2024 10:11:02 +0000 Received: (at 45897) by debbugs.gnu.org; 20 Jan 2024 10:10:22 +0000 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 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 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==; Date: Sat, 20 Jan 2024 12:09:50 +0200 Message-Id: <83bk9gtixd.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (message from Jakub =?UTF-8?Q?Je=C4=8Dm=C3=ADnek?= on Fri, 19 Jan 2024 18:25:57 +0100) References: <875z3ydqlz.fsf@tromey.com> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) 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: -3.3 (---) > 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 > > > > From unknown Fri Aug 15 15:37:34 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45897: [PATCH] 27.1; python mode font-lock confused by string concatenation Resent-From: kobarity Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 20 Jan 2024 15:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45897 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Jakub =?UTF-8?Q?Je=C4=8Dm=C3=ADnek?= Cc: 45897@debbugs.gnu.org, Eli Zaretskii Received: via spool by 45897-submit@debbugs.gnu.org id=B45897.170576529515543 (code B ref 45897); Sat, 20 Jan 2024 15:42:01 +0000 Received: (at 45897) by debbugs.gnu.org; 20 Jan 2024 15:41:35 +0000 Received: from localhost ([127.0.0.1]:35525 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rRDTS-00042b-IX for submit@debbugs.gnu.org; Sat, 20 Jan 2024 10:41:35 -0500 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]:42031) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rRDTQ-00042E-0e for 45897@debbugs.gnu.org; Sat, 20 Jan 2024 10:41:32 -0500 Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-6dbc9dab55dso750609b3a.0 for <45897@debbugs.gnu.org>; Sat, 20 Jan 2024 07:41:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705765283; x=1706370083; 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=BxFsDzWaF7P5iCLbhW1AtSke2xU7srpubqQQqbL32yQ=; b=Q+gLwl+evCHaxg0mbrttI8rw7Gm7HEXrQwFKiA0iXCIyOSdprxBBdQsqAl0N+na00t c0Js8pTHgi2V3Z/CIX6DEc/h/554wDjExJoH7IRbA53R+za61yWyI1+lXIHxqpzpGcg8 b1pE+y8LWm+70SOB+QIGakN/bELYyV2+Jjgb/Ts7VuFRXnNV8cmBhslUO0cafTCmRT2+ /CZP0NyTZiy7ihV/j2t2L7aQVHFOWl8cnCCousmTXgEBIHo3KktHN7dF6ASLEfDfOwaC zMzq1/qGx9T0XQE+xBLLrTX6UsChQoLC9H6k1JlHtKpsXtXMJjwXyYA07bmjHXnJIqeG ujSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705765283; x=1706370083; 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=BxFsDzWaF7P5iCLbhW1AtSke2xU7srpubqQQqbL32yQ=; b=C+LyJz02EsmbhCSF19eXYGrhC4Eo/6kGXgQwGKBjAHFrFWQ7Q/YfGvb/9SC0XU5IBa fq6ERse3szzU36p8W2yh9oxIzNbGCpbDEGyzI2E2WHZlhXU4DZ7UnWBFGPs41i0OhLSP nLQgnZZD2P22c8GqgmkInUmJmDnLcdul1yUtuJe8fBeO6UygbUzgyrfjQa5/KSbeUfce Ic/g+vuuebgVLzhMP5ztyfw8KWqZz9YQG/nxPfHcNQzI4e3RvVVMCyOYtMOD0lxRHM38 vt/Jp77Jp0e6Hg8+OaJjy1ix/pa1ffpJML/VfGamx4kiOwMqsFjqmjxZq5jDD/86G+20 Wkiw== X-Gm-Message-State: AOJu0YyzgoiZfw4KHtfGNpK3q7oyIEGS8viU0k5pGt2wZX84J2uDqPbn BhehHlAYZ9gINjL31q07f384jfv7sgcFN5r7M28kIDuoEMDYkFZJ X-Google-Smtp-Source: AGHT+IH0MDDnz7hBV4BLYX7GsU0aPG/5eRPMryBJ6C0xt4AM2IK6ucr5HZ+yGqkDSt+IeOOc9RS3tQ== X-Received: by 2002:a05:6a00:130f:b0:6da:bed1:c8b with SMTP id j15-20020a056a00130f00b006dabed10c8bmr3385061pfu.20.1705765283092; Sat, 20 Jan 2024 07:41:23 -0800 (PST) Received: from localhost (58x12x133x161.ap58.ftth.ucom.ne.jp. [58.12.133.161]) by smtp.gmail.com with ESMTPSA id s5-20020a056a00194500b006da96503d9fsm6876191pfk.109.2024.01.20.07.41.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 20 Jan 2024 07:41:22 -0800 (PST) Date: Sun, 21 Jan 2024 00:41:22 +0900 Message-ID: From: kobarity In-Reply-To: <83bk9gtixd.fsf@gnu.org> References: <875z3ydqlz.fsf@tromey.com> <83bk9gtixd.fsf@gnu.org> 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) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: multipart/mixed; boundary="Multipart_Sun_Jan_21_00:41:21_2024-1" X-Spam-Score: -0.0 (/) 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 (-) --Multipart_Sun_Jan_21_00:41:21_2024-1 Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: quoted-printable On Sat, 20 Jan 2024 19:09:50 +0900, Eli Zaretskii wrote: >=20 > > From: Jakub Je=E8m=EDnek > > Date: Fri, 19 Jan 2024 18:25:57 +0100 > >=20 > > Tags: patch > >=20 > > I'm sending the patch once again with correct indentation and patch tag > > (I'm still figuring out how the bug tracker works). >=20 > Thanks. >=20 > Kobarity, any comments? Thank you for the patch. I tried it and confirmed that the example shown by Tom Tromey is fixed. I think ppss and line-ppss would be the same in this example. Can you give an example of a case where ppss and line-ppss are different? I noticed an error in the commit-msg hook when applying the patch. CONTRIBUTE states the following: - Lines in ChangeLog entries should preferably be not longer than 63 characters, and must not exceed 78 characters, unless they consist of a single word of at most 140 characters; this 78/140 limit is enforced by a commit hook. Also, the indentation still looks wrong to me. It might be better to attach the patch instead of pasting it into the body of the mail. Attached is a patch to add an ERT that identifies this issue. Please add it to your patch if you like. --Multipart_Sun_Jan_21_00:41:21_2024-1 Content-Type: text/plain; type=patch; name="0001-Add-an-ERT-for-bug-45897.patch"; charset=US-ASCII Content-Disposition: attachment; filename="0001-Add-an-ERT-for-bug-45897.patch" Content-Transfer-Encoding: 7bit >From af56c8c9f6e056d84b604ffc2ab85f029a74aa17 Mon Sep 17 00:00:00 2001 From: kobarity Date: Sun, 21 Jan 2024 00:05:04 +0900 Subject: [PATCH] Add an ERT for bug#45897 * test/lisp/progmodes/python-tests.el (python-font-lock-string-literal-concatenation): New test. --- test/lisp/progmodes/python-tests.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index 97ffd5fe20f..59957ff0712 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el @@ -660,6 +660,18 @@ python-font-lock-raw-escape-sequence (3 . font-lock-string-face) (14) (16 . font-lock-string-face)))) +(ert-deftest python-font-lock-string-literal-concatenation () + "Test for bug#45897." + (python-tests-assert-faces + "x = \"hello\"\"\" +y = \"confused\"" + '((1 . font-lock-variable-name-face) (2) + (3 . font-lock-operator-face) (4) + (5 . font-lock-string-face) (14) + (15 . font-lock-variable-name-face) (16) + (17 . font-lock-operator-face) (18) + (19 . font-lock-string-face)))) + ;;; Indentation -- 2.34.1 --Multipart_Sun_Jan_21_00:41:21_2024-1-- From unknown Fri Aug 15 15:37:34 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45897: [PATCH] 27.1; python mode font-lock confused by string concatenation References: <875z3ydqlz.fsf@tromey.com> In-Reply-To: <875z3ydqlz.fsf@tromey.com> Resent-From: Jakub =?UTF-8?Q?Je=C4=8Dm=C3=ADnek?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 20 Jan 2024 23:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45897 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: kobarity Cc: 45897@debbugs.gnu.org, Eli Zaretskii Received: via spool by 45897-submit@debbugs.gnu.org id=B45897.170579364924646 (code B ref 45897); Sat, 20 Jan 2024 23:35:02 +0000 Received: (at 45897) by debbugs.gnu.org; 20 Jan 2024 23:34:09 +0000 Received: from localhost ([127.0.0.1]:36145 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rRKqn-0006PR-2A for submit@debbugs.gnu.org; Sat, 20 Jan 2024 18:34:09 -0500 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]:43117) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rRKqj-0006Ou-Ik for 45897@debbugs.gnu.org; Sat, 20 Jan 2024 18:34:07 -0500 Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-559cef15db5so5595385a12.0 for <45897@debbugs.gnu.org>; Sat, 20 Jan 2024 15:34:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705793636; x=1706398436; darn=debbugs.gnu.org; h=mime-version:message-id:date:cc:user-agent:subject:to:from:from:to :cc:subject:date:message-id:reply-to; bh=E3lFVCXwUL5xHZ8cGtUSrW90+TPU6qfu2VOyZVPYPuw=; b=Qgxx6w1pIWnWPIiuuMQWfEdmr9sWN+yP5NN2Y39DTZQe8worg8CUBYbofBSAOIhH+m XIXLgH44usgqCpy/yZeir/qYtrpe+cTe1ee8eqtEt//VKgEFPWV72DC+pMoEqQaSzfen JZNpXd8R8pl4i3FFQpzycQiOhq6AEfJhnca5bJkBwehkDR4Xd8uZbubavN1rOWQvOR2+ gv6N40meb0d5CzxgjIWjN2qiKUrFZHA0EBgG/S5k3QjMWAgrJYAWnDDHFQPQK4LVxE1S LrEYjkbod/uuXXd04NNQxmHWJnS6n4OKM4sD/75UpnwhdCz/fSNYuV1v/pY0FgiOaw4A QTiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705793636; x=1706398436; h=mime-version:message-id:date:cc:user-agent:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=E3lFVCXwUL5xHZ8cGtUSrW90+TPU6qfu2VOyZVPYPuw=; b=sstyEX6cffcHKJVhyZ0bXD25PCahxHN/7eMfjMoXwUNuFdhTDrbR4UqzM0o8wlmg+U mQhuUxqbwz5ftWHBdxynluUjB2S95E5Pzk9cHTup4xL5mauL2iw44Rnb963Qc+0PuZhN 2TI0Jst9T+i2+9Tgthz0fWIENFd17I8LPY2I4SUHbMImvJMbZgfVfhyj9kH1sLB5j3dn 5j3qKrkLrOaSUR5UBhdn5fAaLc9dDuDiZyIRSmjIffXnqKuokOK2uO9I/SOE14EaxWph 2LT+RmsAAboo8+SVdqaQ9mDlchh4cJ1kZ3bH/Jnvo86N67q4Hk9dle7gpO5kA1KyvGqF di9g== X-Gm-Message-State: AOJu0YzuRrdM4/IG3N4+0XkGi0Wrc+Xj2djlkyVlKuaYEtzLb0wz8lly RwMHeN6mh/+V540AUnN9MfeneYLzrAMEQqWX5aqfYUnqLWQcC87/ X-Google-Smtp-Source: AGHT+IGhTGvM/OST9ZIE6OSBnck7DBZNDsNDnOLu0ifj9AXUUCiLU6PjvMGJGiXN23+LsQ51Eh5CdA== X-Received: by 2002:aa7:d7c9:0:b0:55b:fda0:4ee9 with SMTP id e9-20020aa7d7c9000000b0055bfda04ee9mr1025233eds.2.1705793636254; Sat, 20 Jan 2024 15:33:56 -0800 (PST) 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 e9-20020a056402104900b0055c15c5919csm275438edu.86.2024.01.20.15.33.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 20 Jan 2024 15:33:55 -0800 (PST) From: Jakub =?UTF-8?Q?Je=C4=8Dm=C3=ADnek?= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.1 Date: Sun, 21 Jan 2024 00:33:55 +0100 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.0 (/) 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 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable kobarity writes: > Thank you for the patch. I tried it and confirmed that the example > shown by Tom Tromey is fixed. > > I think ppss and line-ppss would be the same in this example. Can you > give an example of a case where ppss and line-ppss are different? Well, it would be different in case like this: #+BEGIN_SRC python " # <- forgotten quote a =3D "abc""" #+END_SRC `ppss' would in the context of `python-syntax-stringify' evaluate to '(0 nil 8 nil nil nil 0 nil nil nil nil), while `line-ppss' to '(0 nil 5 34 nil nil 0 nil 7 nil nil). Note the 3rd and 8th element. Here's the snippet to test it: #+BEGIN_SRC emacs-lisp (with-temp-buffer (insert "\" a =3D \"abc\"\"\"") (backward-char 3) (syntax-ppss) (parse-partial-sexp (line-beginning-position) (point))) #+END_SRC I was thinking that we want to consider only cases where the quote is on the same line but I guess I wanted to solve a problem we don't have. I've revised the patch to be more simple, please see attached. > I noticed an error in the commit-msg hook when applying the patch. > CONTRIBUTE states the following: > > - Lines in ChangeLog entries should preferably be not longer than 63 > characters, and must not exceed 78 characters, unless they consist > of a single word of at most 140 characters; this 78/140 limit is > enforced by a commit hook. Thanks, fixed. > Also, the indentation still looks wrong to me. It might be better to > attach the patch instead of pasting it into the body of the mail. Please see attached. > Attached is a patch to add an ERT that identifies this issue. Please > add it to your patch if you like. Thanks, I've added it to my patch and added 'Co-authored-by:' to commit description. Best, Jakub Je=C4=8Dm=C3=ADnek --=-=-= Content-Type: text/plain Content-Disposition: inline; filename=0001-Fix-syntax-highlighting-after-string-literal-concat-.patch Content-Description: 0001-Fix-syntax-highlighting-after-string-literal-concat >From af1f029bde36456b359e9768a8e525fdac6db3e3 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 concat in python-mode * lisp/progmodes/python.el (python-syntax-stringify): Fix incorrect font-lock after string literal concatenation. (Bug#45897) * test/lisp/progmodes/python-tests.el (python-font-lock-string-literal-concatenation): New test. Co-authored-by: kobarity --- lisp/progmodes/python.el | 3 +++ test/lisp/progmodes/python-tests.el | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index e2f614f52c2..bee9c1d8cda 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -909,6 +909,7 @@ is used to limit the scan." "Put `syntax-table' property correctly on single/triple quotes." (let* ((ppss (save-excursion (backward-char 3) (syntax-ppss))) (string-start (and (eq t (nth 3 ppss)) (nth 8 ppss))) + (string-literal-concat (numberp (nth 3 ppss))) (quote-starting-pos (- (point) 3)) (quote-ending-pos (point))) (cond ((or (nth 4 ppss) ;Inside a comment @@ -921,6 +922,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) diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index 97ffd5fe20f..59957ff0712 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el @@ -660,6 +660,18 @@ r'\\x12 \123 \\n \\u1234 \\U00010348 \\N{Plus-Minus Sign}'" (3 . font-lock-string-face) (14) (16 . font-lock-string-face)))) +(ert-deftest python-font-lock-string-literal-concatenation () + "Test for bug#45897." + (python-tests-assert-faces + "x = \"hello\"\"\" +y = \"confused\"" + '((1 . font-lock-variable-name-face) (2) + (3 . font-lock-operator-face) (4) + (5 . font-lock-string-face) (14) + (15 . font-lock-variable-name-face) (16) + (17 . font-lock-operator-face) (18) + (19 . font-lock-string-face)))) + ;;; Indentation -- 2.39.3 (Apple Git-145) --=-=-=-- From unknown Fri Aug 15 15:37:34 2025 X-Loop: help-debbugs@gnu.org Subject: bug#45897: [PATCH] 27.1; python mode font-lock confused by string concatenation Resent-From: kobarity Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 21 Jan 2024 07:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45897 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Jakub =?UTF-8?Q?Je=C4=8Dm=C3=ADnek?= Cc: 45897@debbugs.gnu.org, Eli Zaretskii Received: via spool by 45897-submit@debbugs.gnu.org id=B45897.170582279223488 (code B ref 45897); Sun, 21 Jan 2024 07:40:02 +0000 Received: (at 45897) by debbugs.gnu.org; 21 Jan 2024 07:39:52 +0000 Received: from localhost ([127.0.0.1]:36457 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rRSQq-00066l-Fw for submit@debbugs.gnu.org; Sun, 21 Jan 2024 02:39:52 -0500 Received: from mail-io1-xd30.google.com ([2607:f8b0:4864:20::d30]:46165) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rRSQo-00066W-4c for 45897@debbugs.gnu.org; Sun, 21 Jan 2024 02:39:50 -0500 Received: by mail-io1-xd30.google.com with SMTP id ca18e2360f4ac-7bf2c826a5aso145478239f.0 for <45897@debbugs.gnu.org>; Sat, 20 Jan 2024 23:39:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705822781; x=1706427581; darn=debbugs.gnu.org; h=content-transfer-encoding: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=BOWEbu0gL2e2OGqEZTPojeHRHpN9N7DDlNPcc+f6sm0=; b=IhJyTx2yrXm2XWcmOx7aJSV71vyhamjnwregp0lwFkJ7lucE6Xc2sBtVLP3Wwiw5oi QxS0jS/3396G3a3xdI7pyEK89qxen7GjKwYlaZsVS7nJFUd2WTgy09ptJfbs3Y9UPyn7 ae5ANPnJOhqqwkTJnhkSBSHHZfcI2/jjtVYknmiAOZ8dHLVJo76R7Iu+3Be5TKBqavZ2 FuOMJ2VpIATcRDZFFP12hpjU9yd4wzaOedwJmvdY8qn9KQUoSyGEZ6WXWkhotGJUgtYy X6miocLIm79cF7DOvNeSo54oMPmOGr/eVulSF8zj0++fUKICeaki75VWUR7ZSF+B1SrQ UMVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705822781; x=1706427581; h=content-transfer-encoding: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=BOWEbu0gL2e2OGqEZTPojeHRHpN9N7DDlNPcc+f6sm0=; b=WYwwuKizGQ4yrD9KDlLE603vxGbJTuaY/EKorgSCApaYZa6P0dvihSSOS6zzJtcYjT bFzsTn1q38FzmWu05mYg0FgOPjmSRqCQMrCYrL8tfinfq6n6uUhVZyv1gzDF07hbKT/+ Y5CmeSWyatm4NwEYziNt6lckQlJIfH8uXrZfxi3UrxGxWqzXQPhF3SwDMMPCnMMitClb 4xKtPUB6eOYNfvVjP2IooCBJ1x27cNDsyCTAi+4hgl3TL5Hu2f6MXXLlzrZ2S7mqpPeX WUEIXam+TIuDz7677v6wVlLOORjKl5Y6LvczDNWjSIOZrWPOqqLjtVbmEvyeesBUoM7c 4cIA== X-Gm-Message-State: AOJu0YyCP1wNzJKdshQ0viHSOsT1DKEViKDPp7b6cwsfmUptwNKr2aov 5DAejvE/9jRnUOqnCCHFYra3q2kuv/a84tsZ44Lcm+Z+FQRkiwcR X-Google-Smtp-Source: AGHT+IG+qkBjAelazbHyhLt3Wxbhqd0n+ws0kKWpGJp9oFV6/sl+zLctqYtWD+NRGiGobrQh10m4Mg== X-Received: by 2002:a05:6602:2bc1:b0:7bf:8d27:1567 with SMTP id s1-20020a0566022bc100b007bf8d271567mr2514612iov.8.1705822780998; Sat, 20 Jan 2024 23:39:40 -0800 (PST) Received: from localhost (58x12x133x161.ap58.ftth.ucom.ne.jp. [58.12.133.161]) by smtp.gmail.com with ESMTPSA id i191-20020a6387c8000000b005ced88aa031sm6164286pge.48.2024.01.20.23.39.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 20 Jan 2024 23:39:40 -0800 (PST) Date: Sun, 21 Jan 2024 16:39:43 +0900 Message-ID: From: kobarity In-Reply-To: References: 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) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) 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 (-) Jakub Je=E8m=EDnek wrote: > kobarity writes: >=20 > > Thank you for the patch. I tried it and confirmed that the example > > shown by Tom Tromey is fixed. > > > > I think ppss and line-ppss would be the same in this example. Can you > > give an example of a case where ppss and line-ppss are different? >=20 > Well, it would be different in case like this: >=20 > #+BEGIN_SRC python > " # <- forgotten quote > a =3D "abc""" > #+END_SRC >=20 > `ppss' would in the context of `python-syntax-stringify' evaluate to > '(0 nil 8 nil nil nil 0 nil nil nil nil), while `line-ppss' to > '(0 nil 5 34 nil nil 0 nil 7 nil nil). Note the 3rd and 8th > element. Here's the snippet to test it: >=20 > #+BEGIN_SRC emacs-lisp > (with-temp-buffer > (insert "\" > a =3D \"abc\"\"\"") > (backward-char 3) > (syntax-ppss) > (parse-partial-sexp (line-beginning-position) (point))) > #+END_SRC >=20 > I was thinking that we want to consider only cases where the quote is on > the same line but I guess I wanted to solve a problem we don't > have. I've revised the patch to be more simple, please see attached. >=20 > > I noticed an error in the commit-msg hook when applying the patch. > > CONTRIBUTE states the following: > > > > - Lines in ChangeLog entries should preferably be not longer than 63 > > characters, and must not exceed 78 characters, unless they consist > > of a single word of at most 140 characters; this 78/140 limit is > > enforced by a commit hook. >=20 > Thanks, fixed. >=20 > > Also, the indentation still looks wrong to me. It might be better to > > attach the patch instead of pasting it into the body of the mail. >=20 > Please see attached. >=20 > > Attached is a patch to add an ERT that identifies this issue. Please > > add it to your patch if you like. >=20 > Thanks, I've added it to my patch and added 'Co-authored-by:' to commit > description. Thank you. The revised patch looks good to me. From unknown Fri Aug 15 15:37:34 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Tom Tromey Subject: bug#45897: closed (Re: bug#45897: [PATCH] 27.1; python mode font-lock confused by string concatenation) Message-ID: References: <86mssr84zg.fsf@gnu.org> <875z3ydqlz.fsf@tromey.com> X-Gnu-PR-Message: they-closed 45897 X-Gnu-PR-Package: emacs Reply-To: 45897@debbugs.gnu.org Date: Sat, 27 Jan 2024 10:08:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1706350082-29933-1" This is a multi-part message in MIME format... ------------=_1706350082-29933-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #45897: 27.1; python mode font-lock confused by string concatenation which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 45897@debbugs.gnu.org. --=20 45897: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D45897 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1706350082-29933-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 45897-done) by debbugs.gnu.org; 27 Jan 2024 10:07:16 +0000 Received: from localhost ([127.0.0.1]:53514 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rTfam-0007lm-5V for submit@debbugs.gnu.org; Sat, 27 Jan 2024 05:07:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39280) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rTfaj-0007lX-WF for 45897-done@debbugs.gnu.org; Sat, 27 Jan 2024 05:07:14 -0500 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 1rTfaX-0001ZL-LW; Sat, 27 Jan 2024 05:07:01 -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=pFrAKMAVKWrSLPNnpkA2mOteSpbPUYiXRG6y2ej9z2o=; b=DFo9tNIeEEv7L3u0g0jz RbFeHILdQcVVgDwTbDRo02hf/2ws/r6GMbU9dYdDyBXNlI6Hkg12CVUMyXWuUYKtvTV1IAIQP3qcw Tm2rTA/lQmNl37wVsSnlmlnHnV8QA5Vgx/OmnB4LOJWzy1F321gzB9u9qH75Q4ZgqWYMBl/87e7U1 /FDxRbGRCwv+GhRuPpgCAhtBH9qsll1HGFC3N5ZAAWVs1IFZtz8/nSRoxYerehpCamyfPHqALiVQg SKymPfwHd3HbcDuFN1Xpb4bJ3dfEekFco4dD38aKoZicHVhYPB7P34yAHBAiX8uJdo1v9dVbvBqGI 8CLdySrLyKeTog==; Date: Sat, 27 Jan 2024 12:06:59 +0200 Message-Id: <86mssr84zg.fsf@gnu.org> From: Eli Zaretskii To: kobarity In-Reply-To: (message from kobarity on Sun, 21 Jan 2024 16:39:43 +0900) Subject: Re: bug#45897: [PATCH] 27.1; python mode font-lock confused by string concatenation References: MIME-version: 1.0 Content-type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 45897-done Cc: 45897-done@debbugs.gnu.org, jecminek.k@gmail.com 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: -3.3 (---) > Date: Sun, 21 Jan 2024 16:39:43 +0900 > From: kobarity > Cc: 45897@debbugs.gnu.org, > Eli Zaretskii > > Jakub Jemnek wrote: > > kobarity writes: > > > > > > > Attached is a patch to add an ERT that identifies this issue. Please > > > add it to your patch if you like. > > > > Thanks, I've added it to my patch and added 'Co-authored-by:' to commit > > description. > > Thank you. The revised patch looks good to me. Thanks, installed on master, and closing the bug. ------------=_1706350082-29933-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 15 Jan 2021 18:04:17 +0000 Received: from localhost ([127.0.0.1]:41676 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l0TSK-000247-EL for submit@debbugs.gnu.org; Fri, 15 Jan 2021 13:04:16 -0500 Received: from lists.gnu.org ([209.51.188.17]:52190) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l0TSI-00023z-AU for submit@debbugs.gnu.org; Fri, 15 Jan 2021 13:04:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49936) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l0TSI-0006TH-5n for bug-gnu-emacs@gnu.org; Fri, 15 Jan 2021 13:04:14 -0500 Received: from gateway22.websitewelcome.com ([192.185.47.129]:14029) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l0TSE-0000W8-0Y for bug-gnu-emacs@gnu.org; Fri, 15 Jan 2021 13:04:13 -0500 Received: from cm16.websitewelcome.com (cm16.websitewelcome.com [100.42.49.19]) by gateway22.websitewelcome.com (Postfix) with ESMTP id AB97F9931 for ; Fri, 15 Jan 2021 12:03:53 -0600 (CST) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id 0TRxlHTwVHPnU0TRxl0alq; Fri, 15 Jan 2021 12:03:53 -0600 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID: Date:Subject:To:From:Sender:Reply-To:Cc: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=ukIB08clO2qvBdxaVXNauOdjC/RL53xIUXIAVmN+DOw=; b=Zk42hxfT8jednTQ/IzFTVOG/PD hTZY0a039ZtHt8vX7/aQd22DeckO3P0uFN0ILlX5zo/DcJOpl0o66zZV4g/x0V+MS5f6uaY1TITp+ fPmCfs48DnGSW/3zT008QOMH/; Received: from 97-122-65-38.hlrn.qwest.net ([97.122.65.38]:60260 helo=murgatroyd) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1l0TRx-000RGY-Dk; Fri, 15 Jan 2021 11:03:53 -0700 From: Tom Tromey To: bug-gnu-emacs@gnu.org Subject: 27.1; python mode font-lock confused by string concatenation X-Attribution: Tom Date: Fri, 15 Jan 2021 11:03:52 -0700 Message-ID: <875z3ydqlz.fsf@tromey.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.65.38 X-Source-L: No X-Exim-ID: 1l0TRx-000RGY-Dk X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-65-38.hlrn.qwest.net (murgatroyd) [97.122.65.38]:60260 X-Source-Auth: tom+tromey.com X-Email-Count: 1 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes Received-SPF: permerror client-ip=192.185.47.129; envelope-from=tom@tromey.com; helo=gateway22.websitewelcome.com X-Spam_score_int: 15 X-Spam_score: 1.5 X-Spam_bar: + X-Spam_report: (1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_BL_SPAMCOP_NET=1.347, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_RP_RNBL=1.31, SPF_HELO_PASS=-0.001, SPF_NEUTRAL=0.779 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -0.4 (/) 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: -1.4 (-) Consider this 2-line Python file: x =3D "hello""" y =3D "confused" If you put this into a .py file, Emacs will font-lock the second line incorrectly. It appears that Emacs thinks the `"""' on the first line is an opening triple quote. However, it is actually string concatenation, with the second string being empty. I tripped over a case like this in some real code. In GNU Emacs 27.1 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.24.21, = cairo version 1.16.0) of 2020-08-20 built on buildvm-x86-24.iad2.fedoraproject.org Windowing system distributor 'Fedora Project', version 11.0.12010000 System Description: Fedora 32 (Workstation Edition) Recent messages: Wrote /home/tromey/.newsrc.eld Saving /home/tromey/.newsrc.eld...done (No changes need to be saved) (New file) Can=E2=80=99t guess python-indent-offset, using defaults: 4 EOL while scanning string literal [3 times] Saving file /tmp/q.py... Wrote /tmp/q.py Quit Undo Configured using: 'configure --build=3Dx86_64-redhat-linux-gnu --host=3Dx86_64-redhat-linux-gnu --program-prefix=3D --disable-dependency-tracking --prefix=3D/usr --exec-prefix=3D/usr --bindir=3D/usr/bin --sbindir=3D/usr/sbin --sysconfdir=3D/etc --datadir=3D/usr/share --includedir=3D/usr/include --libdir=3D/usr/lib64 --libexecdir=3D/usr/libexec --localstatedir=3D/var --sharedstatedir=3D/var/lib --mandir=3D/usr/share/man --infodir=3D/usr/share/info --with-dbus --with-gif --with-jpeg --with-png --with-rsvg --with-tiff --with-xft --with-xpm --with-x-toolkit=3Dgtk3 --with-gpm=3Dno --with-xwidgets --with-modules --with-harfbuzz --with-cairo --with-json build_alias=3Dx86_64-redhat-linux-gnu host_alias=3Dx86_64-redhat-linux-gnu 'CFLAGS=3D-DMAIL_USE_LOCKF -O2 -g -pipe -Wall -Werror=3Dformat-security -Wp,-D_FORTIFY_SOURCE=3D2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=3D/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=3D/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=3Dgeneric -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' LDFLAGS=3D-Wl,-z,relro PKG_CONFIG_PATH=3D:/usr/lib64/pkgconfig:/usr/share/pkgconfig' Configured features: XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND DBUS GSETTINGS GLIB NOTIFY INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS XWIDGETS LIBSYSTEMD JSON PDUMPER GMP Important settings: value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=3Dibus locale-coding-system: utf-8-unix Major mode: Python Minor modes in effect: erc-list-mode: t erc-menu-mode: t erc-autojoin-mode: t erc-ring-mode: t erc-pcomplete-mode: t erc-netsplit-mode: t erc-spelling-mode: t erc-truncate-mode: t display-fill-column-indicator-mode: t flyspell-mode: t shell-dirtrack-mode: t which-function-mode: t erc-track-mode: t erc-track-minor-mode: t erc-notify-mode: t erc-notifications-mode: t erc-match-mode: t erc-services-mode: t erc-networks-mode: t erc-hl-nicks-mode: t erc-button-mode: t erc-fill-mode: t erc-stamp-mode: t erc-irccontrols-mode: t erc-noncommands-mode: t erc-move-to-prompt-mode: t erc-readonly-mode: t flycheck-mode: t savehist-mode: t tooltip-mode: t global-eldoc-mode: t eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t column-number-mode: t line-number-mode: t auto-fill-function: python-do-auto-fill transient-mark-mode: t Load-path shadows: None found. Features: (shadow emacsbug tramp-cmds yaml-mode gnus-draft vc-annotate tramp-cache thai-util thai-word goto-addr log-edit sh-script smie executable cc-mode cc-fonts cc-guess cc-menus cc-cmds tabify man find-dired rst ffap grep webjump log-view pcvs-util dabbrev mule-util ggtags etags fileloop generator bug-reference tcl jka-compr gnus-html url-queue help-fns radix-tree url-cache mm-url flow-fill misearch multi-isearch shr-color supercite regi smerge-mode diff python tramp-sh ada-mode ada-imenu align ada-skel wisi-skel skeleton ada-process wisi-process-parse ada-indent-user-options ada-core wisi-prj wisi xref wisi-fringe wisi-parse-common semantic/lex semantic/fw mode-local uniquify-files project find-file compile erc-list erc-menu erc-join erc-ring erc-pcomplete erc-netsplit erc-spelling erc-truncate cl-extra smiley mm-archive gnus-bcklg qp gnus-async gnus-ml disp-table sort gnus-cite vc-mtn vc-hg mailalias mail-hist nnir gnus-topic nndraft nnmh nnfolder utf-7 bbdb-gnus bbdb-mua bbdb-com crm gnutls network-stream nsm gnus-agent gnus-srvr gnus-score score-mode nnvirtual gnus-msg gnus-art mm-uu mml2015 mm-view mml-smime smime dig nntp gnus-cache gnus-sum url url-proxy url-privacy url-expand url-methods url-history mailcap shr url-cookie url-domsuf svg dom gnus-group gnus-undo smtpmail gnus-start gnus-cloud nnimap nnmail mail-source utf7 netrc nnoo gnus-spec gnus-int gnus-range gnus-win gnus nnheader bbdb-message sendmail mail-extr message rmc puny rfc822 mml mml-sec epa derived epg epg-config gnus-util rmail rmail-loaddefs text-property-search mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils mailheader rfc2368 copyright add-log make-mode vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs vc-git diff-mode easy-mmode term/xterm xterm display-fill-column-indicator flyspell ispell diminish appt diary-lib diary-loaddefs cal-menu calendar cal-loaddefs tramp tramp-loaddefs trampver tramp-integration files-x tramp-compat shell pcomplete parse-time iso8601 time-date ls-lisp which-func imenu autorevert filenotify desktop frameset cus-start cus-load git-link url-util erc-track erc-notify erc-desktop-notifications erc-match erc-services erc-networks notifications dbus erc-hl-nicks color erc-button erc-fill erc-stamp wid-edit erc-goodies erc erc-backend erc-compat format-spec thingatpt pp erc-loaddefs dired-aux dired-x dired dired-loaddefs warnings advice vc-dir ewoc vc vc-dispatcher flycheck find-func help-mode rx dash cc-styles cc-align cc-engine cc-vars cc-defs bbdb bbdb-site timezone ange-ftp comint ansi-color ring server savehist finder-inf clang-rename clang-include-fixer let-alist clang-format xml info package easymenu browse-url url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache json subr-x map url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads dbusbind inotify dynamic-setting system-font-setting font-render-setting xwidget-internal cairo move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 1294698 143374) (symbols 48 40600 90) (strings 32 416876 28749) (string-bytes 1 9986293) (vectors 16 135630) (vector-slots 8 2470110 287678) (floats 8 541 727) (intervals 56 112191 2695) (buffers 1000 395)) ------------=_1706350082-29933-1--