Subject: [PATCH] [nt/INSTALL.W64] configure error about missing tree-sitter

From: "Hiweed Mandriva3" <[email-masked]>
Date: Sat, 23 Nov 2024 23:00:16 +0800 (CST)

At 2024-11-23 21:38:06, "Eli Zaretskii" <[email-masked]> wrote:
>> Date: Sat, 23 Nov 2024 20:21:03 +0800 (CST)
>> From: "Hiweed Mandriva3" <[email-masked]>
>> Cc: [email-masked], "[email-masked]" <[email-masked]>
>> 
>> At 2024-11-21 19:04:57, "Eli Zaretskii" <[email-masked]> wrote:
>> >> Cc: Nerd <[email-masked]>
>> >> From: Nerd <[email-masked]>
>> >> Date: Mon, 18 Nov 2024 23:03:12 +0800
>> >> 
>> >> configure: error: The following required libraries were not found:
>> >>      tree-sitter
>> >>     Maybe some development libraries/packages are missing?
>> >>     To build anyway, give:
>> >>          --with-tree-sitter=ifavailable
>> >>         as options to configure.
>> >> 
>> >> https://packages.msys2.org/base/mingw-w64-tree-sitter
>> >> it seems that tree-sitter on msys2/mingw-w64 has two libraries
>> >> mingw-w64-x86_64-libtree-sitter and mingw-w64-x86_64-tree-sitter
>> >> ---
>> >>  nt/INSTALL.W64 | 1 +
>> >>  1 file changed, 1 insertion(+)
>> >> 
>> >> diff --git a/nt/INSTALL.W64 b/nt/INSTALL.W64
>> >> index 9694e85f269d..87eecff779a0 100644
>> >> --- a/nt/INSTALL.W64
>> >> +++ b/nt/INSTALL.W64
>> >> @@ -60,6 +60,7 @@ packages (you can copy and paste it into the shell with Shift + Insert):
>> >>    mingw-w64-x86_64-harfbuzz \
>> >>    mingw-w64-x86_64-libgccjit \
>> >>    mingw-w64-x86_64-sqlite3 \
>> >> +  mingw-w64-x86_64-libtree-sitter \
>> >>    mingw-w64-x86_64-tree-sitter
>> >
>> >Thanks.  However, AFAICS the mingw-w64-x86_64-libtree-sitter package
>> >provided by MSYS2 includes the library under the name
>> >libtree-sitter-0.24.dll, whereas Emacs only knows to look for
>> >libtree-sitter-0.dll.  Does installing this package provide
>> >tree-sitter support for you?  Or did you need to rename the DLL to the
>> >name Emacs looks for?  If users need to rename the DLL, we should tell
>> >that in INSTALL and perhaps also README files.
>> 
>> By installing mingw-w64-x86_64-libtree-sitter, it fixed the configure issue.
>> I did not check whether tree-sitter works well after building emacs.exe successfully at that time.
>> I did not rename libtree-sitter-0.24.dll.
>> 
>> Just now, I confirm that tree-sitter major mode is not enabled when opening a C source file.
>
>If you rename the DLL to the name libtree-sitter-0.dll, tree-sitter

>major modes should be enabled.

after rename, open a C source file and check `c-h m` the major mode is still `c-mode` not `c-ts-mode`.

>
>Alternatively, if you can build the latest emacs-30 branch of the
>Emacs Git repository, it should know about libtree-sitter-0.24.dll.
>
>> `ldd emacs.exe` does not contain dynamic link library libtree-sitter-0.24.dll.
>

>That's normal, since Emacs loads the DLL dynamically.

Build the latest commit https://git.savannah.gnu.org/cgit/emacs.git/commit/?h=emacs-30&id=e14007ad631120a3f7521e503c8de86aca849bad
of branch eamcs-30 and with library name libtree-sitter-0.24.dll
open a C source file and check major mode is still `c-mode`

How do I check whether tree-sitter works well exactly? Thanks.