Subject: Re: 29.0.50; [feature/tree-sitter] c-ts-mode fails to fontify a portion of a large C file

From: Theodor Thornhill <[email-masked]>
Date: Sun, 20 Nov 2022 21:17:20 +0100

>
> P.S. Btw, isn't the treesit-max-buffer-size limit too low?  4 MiB?

I thought it was supposed to be 4 gigs, as seen in this function:

```
static void
treesit_check_buffer_size (struct buffer *buffer)
{
  ptrdiff_t buffer_size = (BUF_Z (buffer) - BUF_BEG (buffer));
  if (buffer_size > UINT32_MAX)
    xsignal2 (Qtreesit_buffer_too_large,
	      build_pure_c_string ("Buffer size cannot be larger than 4GB"),
	      make_fixnum (buffer_size));
}
```

So my guess is that that is a typo, and should be

(defcustom treesit-max-buffer-size (* 4 1024 1024 1024)
  "Maximum buffer size for enabling tree-sitter parsing (in bytes)."
  :type 'integer
  :version "29.1")

or something like that :-)

Theo