Subject: Re: bug#79215: 31.0.50; emacs build fails with tree-sitter (bisected)

From: Eli Zaretskii <[email-masked]>
Date: Mon, 11 Aug 2025 16:30:14 +0300

> Date: Mon, 11 Aug 2025 08:33:46 -0300
> From: German Pacenza <[email-masked]>
> 
> *****
> 
> Hi.
> 
> In a clean emacs source tree:
> ./autogen.sh
> ./configure
> make or make bootstrap
> 
> make[3]: Entering directory '/home/german/repos/emacs-test/lisp'
> ELC treesit.elc
> ELC progmodes/php-ts-mode.elc
> ELC textmodes/mhtml-ts-mode.elc
> Tree-sitter grammar for `jsdoc' is missing; install it? (y or n)
> In toplevel form:
> progmodes/php-ts-mode.el:72:11: Error: End of file during parsing: Error 
> reading from stdin
> make[3]: *** [Makefile:330: progmodes/php-ts-mode.elc] Error 1
> make[3]: Leaving directory '/home/german/repos/emacs-test/lisp'
> make[2]: *** [Makefile:365: compile-main] Error 2
> make[2]: Leaving directory '/home/german/repos/emacs-test/lisp'
> make[1]: *** [Makefile:529: lisp] Error 2
> make[1]: Leaving directory '/home/german/repos/emacs-test'
> make[1]: Entering directory '/home/german/repos/emacs-test'
> ***
> 
> I bisected it to commit bd62f57efd3206fc5764e9e592206be820002500

Thanks.  Does the patch below fix the problem?

diff --git a/lisp/textmodes/mhtml-ts-mode.el b/lisp/textmodes/mhtml-ts-mode.el
index 66bb27c..4182eca 100644
--- a/lisp/textmodes/mhtml-ts-mode.el
+++ b/lisp/textmodes/mhtml-ts-mode.el
@@ -452,7 +452,7 @@ mhtml-ts-mode--range-settings
 
    ;; jsdoc is not mandatory for js-ts-mode, so we respect this by
    ;; adding jsdoc range rules only when jsdoc is available.
-   (when (treesit-ensure-installed 'jsdoc)
+   (when (treesit-language-available-p 'jsdoc t)
      (treesit-range-rules
       :embed 'jsdoc
       :host 'javascript