]> git.eshelyaron.com Git - emacs.git/commit
Improve treesit-fontify-with-override
authorYuan Fu <casouri@gmail.com>
Sun, 4 Dec 2022 08:22:28 +0000 (00:22 -0800)
committerYuan Fu <casouri@gmail.com>
Mon, 5 Dec 2022 04:03:28 +0000 (20:03 -0800)
commitec00d292ec02f34a0d879767c6737fadbe24ce20
tree1d7ddbf47b81fbfab3f846f7f230e3960653e148
parent4bcdb1cc65bf779b6479f99a7aa767ab83b3bae1
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.
lisp/progmodes/c-ts-mode.el
lisp/progmodes/js.el
lisp/progmodes/python.el
lisp/treesit.el