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

From: Eli Zaretskii <[email-masked]>
Date: Mon, 30 Jan 2023 16:20:38 +0200

> Date: Mon, 30 Jan 2023 14:22:10 +0100
> From: Theodor Thornhill <[email-masked]>
> CC: [email-masked], [email-masked], [email-masked]
> 
> 
> 
> On 30 January 2023 14:17:17 CET, Eli Zaretskii <[email-masked]> wrote:
> >> Cc: [email-masked]
> >> Date: Mon, 30 Jan 2023 12:40:40 +0100
> >> From:  Theodor Thornhill via "Bug reports for GNU Emacs,
> >>  the Swiss army knife of text editors" <[email-masked]>
> >> 
> >> 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))))))))
> >
> >I fixed this differently, please see the latest emacs-29 branch: I
> >disabled the loop altogether.
> >
> >Why would we need to loop over buffers if tree-sitter is not
> >available?
> 
> No need, your fix it fine, i just whipped up something quick in a break here :)

OK, thanks.

Btw, it was a bitch finding which code caused the error message.  It
is easy to forget that the :set functions of defcustom's are called
during startup, and the line number shown with the message didn't
identify the defcustom, just the file name.  I eventually found this
was the culprit by running the byte-compilation command under GDB...