emacs-diffs
[Top][All Lists]
Advanced

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

emacs-29 e3d806b417 10/10: Fix string fontification on python-ts-mode (b


From: Yuan Fu
Subject: emacs-29 e3d806b417 10/10: Fix string fontification on python-ts-mode (bug#60599)
Date: Sat, 7 Jan 2023 21:44:44 -0500 (EST)

branch: emacs-29
commit e3d806b4172f16c446bb3c5b31a160ed24fa5244
Author: Yuan Fu <casouri@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>

    Fix string fontification on python-ts-mode (bug#60599)
    
    * lisp/progmodes/python.el:
    (python--treesit-fontify-string): Generalize and skip anything
    before the first quote character.
---
 lisp/progmodes/python.el | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index e6ded7a064..21d16db287 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -1067,8 +1067,11 @@ fontified."
                                "expression_statement"))
                    'font-lock-doc-face
                  'font-lock-string-face)))
-    (when (eq (char-after string-beg) ?f)
-      (cl-incf string-beg))
+    ;; Don't highlight string prefixes like f/r/b.
+    (save-excursion
+      (goto-char string-beg)
+      (when (search-forward "\"" string-end t)
+        (setq string-beg (match-beginning 0))))
     (treesit-fontify-with-override
      string-beg string-end face override start end)))
 



reply via email to

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