diff options
| author | Yuan Fu | 2022-12-04 00:22:28 -0800 |
|---|---|---|
| committer | Yuan Fu | 2022-12-04 20:03:28 -0800 |
| commit | ec00d292ec02f34a0d879767c6737fadbe24ce20 (patch) | |
| tree | 1d7ddbf47b81fbfab3f846f7f230e3960653e148 /lisp/progmodes/python.el | |
| parent | 4bcdb1cc65bf779b6479f99a7aa767ab83b3bae1 (diff) | |
| download | emacs-ec00d292ec02f34a0d879767c6737fadbe24ce20.tar.gz emacs-ec00d292ec02f34a0d879767c6737fadbe24ce20.zip | |
Improve treesit-fontify-with-override
This also fixes fontification problem with c-ts-mode--fontify-defun.
Now treesit-fontify-with-override clips the fontification region for
the user, so no need for (max start node-start) shenanigans anymore.
More importantly it doesn't fontify unless the region between
node-start and node-end intersects with the region between start and
end, which fixes the problem with c-ts-mode--fontify-defun.
* lisp/treesit.el (treesit-fontify-with-override): Add optional
parameter BOUND-START and BOUND-END. Wrap the function body in a
when-form.
* lisp/progmodes/c-ts-mode.el (c-ts-mode--fontify-declarator)
(c-ts-mode--fontify-variable)
(c-ts-mode--fontify-defun)
(c-ts-fontify-error)
* lisp/progmodes/js.el (js--fontify-template-string)
* lisp/progmodes/python.el (python--treesit-fontify-string): Use the
new signature.
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 4fc5d24e2fb..ebee703499a 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -1069,7 +1069,7 @@ fontified." | |||
| 1069 | (when (eq (char-after string-beg) ?f) | 1069 | (when (eq (char-after string-beg) ?f) |
| 1070 | (cl-incf string-beg)) | 1070 | (cl-incf string-beg)) |
| 1071 | (treesit-fontify-with-override | 1071 | (treesit-fontify-with-override |
| 1072 | (max start string-beg) (min end string-end) face override))) | 1072 | string-beg string-end face override start end))) |
| 1073 | 1073 | ||
| 1074 | (defvar python--treesit-settings | 1074 | (defvar python--treesit-settings |
| 1075 | (treesit-font-lock-rules | 1075 | (treesit-font-lock-rules |