Subject: Re: bug#61155: 29.0.60; build failures tree sitter

From: Theodor Thornhill <[email-masked]>
Date: Mon, 30 Jan 2023 12:40:40 +0100

Robert Pluim <[email-masked]> writes:

>>>>>> On Sun, 29 Jan 2023 21:00:07 +0000, John <[email-masked]> said:
>
>     John> For the last couple of days I have been unable to build emacs-29
>     John> branch; error messages  are
>
>     John> In toplevel form:
>     John> cedet/semantic/wisent/python.el:30:2: Error: Symbol’s function definition is void: treesit-parser-list
>     John> make[3]: *** [Makefile:332: cedet/semantic/wisent/python.elc] Error 1"
>     John> make[3]: Leaving directory '/home/jpff/GNU/emacs/lisp'
>     John> make[2]: *** [Makefile:366: compile-main] Error 2
>     John> make[2]: Leaving directory '/home/jpff/GNU/emacs/lisp'
>     John> make[1]: *** [Makefile:533: lisp] Error 2
>     John> make[1]: Leaving directory '/home/jpff/GNU/emacs'
>     John> make[1]: Entering directory '/home/jpff/GNU/emacs'
>     John> ***
>     John> *** "make all" failed with exit status 2.
>     John> ***
>     John> *** You could try to:
>     John> *** - run "make bootstrap", which might fix the problem
>     John> *** - run "make V=1", which displays the full commands invoked by make,
>     John> ***   to further investigate the problem
>     John> ***
>     John> make[1]: *** [Makefile:414: advice-on-failure] Error 2
>     John> make[1]: Leaving directory '/home/jpff/GNU/emacs'
>
>     John> I do not have any tree-sitter code.  "make bootstrap" appears to work
>     John> but every day it takes too much time.  I read tat tree-sitter as not
>     John> necessary but this seems to contradict
>
> I suspect the following commit, which uses treesit-parser-list
> unconditionally
>
>     Bob> diff --git a/lisp/shell.el b/lisp/shell.el
>     Bob> index 5cf108bfa3b..877c48097a8 100644
>     Bob> --- a/lisp/shell.el
>     Bob> +++ b/lisp/shell.el
>     Bob> @@ -366,6 +366,11 @@ shell-has-auto-cd
>     Bob>    :group 'shell-directories
>     Bob>    :version "28.1")
>  
> commit 1de6ebf2878485a0ef6b778df7d6a14d5b22a01c
> Author: Theodor Thornhill <[email-masked]>
> Date:   Sat Jan 28 13:57:01 2023 +0100
>
>     Make treesit-font-lock-level a defcustom
>
> Robert
> -- 

Can you try this and see if the error goes away?

thanks,
Theo

diff --git a/lisp/treesit.el b/lisp/treesit.el
index 92833fb007..d7e702bfb8 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -568,7 +568,7 @@ treesit--font-lock-level-setter
               res)
       (let ((buffer (car buffers)))
         (with-current-buffer buffer
-          (if (treesit-parser-list)
+          (if (and (treesit-available-p) (treesit-parser-list))
               (loop (append res (list buffer)) (cdr buffers))
             (loop res (cdr buffers))))))))