diff options
| author | Yuan Fu | 2022-10-31 15:08:17 -0700 |
|---|---|---|
| committer | Yuan Fu | 2022-10-31 15:08:17 -0700 |
| commit | b49250ada978c7b21cb93177c874c81a27fa4fec (patch) | |
| tree | 386c54afed04929f85f08a7ae4e796e48fc75b3e /lisp/progmodes/python.el | |
| parent | eeeae5e9ee34da5539046ff8dac4f4fffa19a5b9 (diff) | |
| download | emacs-b49250ada978c7b21cb93177c874c81a27fa4fec.tar.gz emacs-b49250ada978c7b21cb93177c874c81a27fa4fec.zip | |
Use treesit-fontify-with-override in tree-sitter functions
* lisp/progmodes/js.el (js--fontify-template-string)
* lisp/progmodes/python.el (python--treesit-fontify-string): Use
treesit-fontify-with-override.
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 0b10058eebe..916b098aefa 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -1015,10 +1015,11 @@ It makes underscores and dots word constituent chars.") | |||
| 1015 | "VMSError" "WindowsError" | 1015 | "VMSError" "WindowsError" |
| 1016 | )) | 1016 | )) |
| 1017 | 1017 | ||
| 1018 | (defun python--treesit-fontify-string (_beg _end node _override &rest _) | 1018 | (defun python--treesit-fontify-string (_beg _end node override &rest _) |
| 1019 | "Fontify string. | 1019 | "Fontify string. |
| 1020 | NODE is the last quote in the string. Do not fontify the initial | 1020 | NODE is the last quote in the string. Do not fontify the initial |
| 1021 | f for f-strings." | 1021 | f for f-strings. OVERRIDE is the override flag described in |
| 1022 | `treesit-font-lock-rules'." | ||
| 1022 | (let* ((string (treesit-node-parent node)) | 1023 | (let* ((string (treesit-node-parent node)) |
| 1023 | (string-beg (treesit-node-start string)) | 1024 | (string-beg (treesit-node-start string)) |
| 1024 | (string-end (treesit-node-end string)) | 1025 | (string-end (treesit-node-end string)) |
| @@ -1032,7 +1033,7 @@ f for f-strings." | |||
| 1032 | 'font-lock-string-face))) | 1033 | 'font-lock-string-face))) |
| 1033 | (when (eq (char-after string-beg) ?f) | 1034 | (when (eq (char-after string-beg) ?f) |
| 1034 | (cl-incf string-beg)) | 1035 | (cl-incf string-beg)) |
| 1035 | (put-text-property string-beg string-end 'face face))) | 1036 | (treesit-fontify-with-override string-beg string-end face override))) |
| 1036 | 1037 | ||
| 1037 | (defvar python--treesit-settings | 1038 | (defvar python--treesit-settings |
| 1038 | (treesit-font-lock-rules | 1039 | (treesit-font-lock-rules |