bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Eli Zaretskii
Subject: bug#45897: [PATCH] 27.1; python mode font-lock confused by string concatenation
Date: Sat, 20 Jan 2024 12:09:50 +0200

> From: Jakub Ječmínek <jecminek.k@gmail.com>
> 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?= <jecminek.k@gmail.com>
> 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
> 
> 
> 
> 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]