Subject: bug#45897: [PATCH] 27.1; python mode font-lock confused by string concatenation

From: kobarity <[email-masked]>
Date: Sun, 21 Jan 2024 00:41:22 +0900

On Sat, 20 Jan 2024 19:09:50 +0900,
Eli Zaretskii wrote:
> 
> > From: Jakub Ječmínek <[email-masked]>
> > 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?

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.
>From af56c8c9f6e056d84b604ffc2ab85f029a74aa17 Mon Sep 17 00:00:00 2001
From: kobarity <[email-masked]>
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