Fix treesit-parse-string crash (bug#71012)
authorYuan Fu <casouri@gmail.com>
Sat, 1 Jun 2024 17:33:18 +0000 (10:33 -0700)
committerYuan Fu <casouri@gmail.com>
Sat, 1 Jun 2024 17:33:18 +0000 (10:33 -0700)
commit00360258caddc0d8cf29ba3d9971125a06f8959b
tree4254f49a7ca16a508f449dad36506ffc95fb131d
parent20af58d3a13ddb5c2ca376da8cdd3fde4833ca2d
Fix treesit-parse-string crash (bug#71012)

Parsing a large file with treesit-parse-string and then printing the
returned node crashes Emacs, because with-temp-buffer kills the temp
buffer when treesit-parse-string returns, and print.c tries to access
the node's position in the killed buffer.

* lisp/treesit.el (treesit-parse-string): Don't use with-temp-buffer.
lisp/treesit.el