mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-23 18:47:57 +00:00
Future-proof loading tree-sitter library on MS-Windows
* src/treesit.c (syms_of_treesit) <tree-sitter--library-abi>: New internal variable. * lisp/term/w32-win.el (dynamic-library-alist): Use 'tree-sitter--library-abi' to select a proper libtree-sitter DLL version.
This commit is contained in:
parent
3eb3018682
commit
83fc3cf53a
@ -290,8 +290,18 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
|
|||||||
'(lcms2 "liblcms2-2.dll")
|
'(lcms2 "liblcms2-2.dll")
|
||||||
'(gccjit "libgccjit-0.dll")
|
'(gccjit "libgccjit-0.dll")
|
||||||
;; MSYS2 distributes libtree-sitter.dll, without API version
|
;; MSYS2 distributes libtree-sitter.dll, without API version
|
||||||
;; number...
|
;; number, upto and including version 0.24.3-2; later versions
|
||||||
'(tree-sitter "libtree-sitter.dll" "libtree-sitter-0.dll")))
|
;; come with libtree-sitter-major.minor.dll (as in
|
||||||
|
;; libtree-sitter-0.24.dll). Sadly, the header files don't have
|
||||||
|
;; any symbols for library version, so we can only use the
|
||||||
|
;; library-language ABI version; according to
|
||||||
|
;; https://github.com/tree-sitter/tree-sitter/issues/3925, the
|
||||||
|
;; language ABI must change when the library's ABI is modified.
|
||||||
|
(if (<= tree-sitter--library-abi 14)
|
||||||
|
'(tree-sitter "libtree-sitter-0.24.dll"
|
||||||
|
"libtree-sitter.dll"
|
||||||
|
"libtree-sitter-0.dll")
|
||||||
|
'(tree-sitter "libtree-sitter-0.25.dll"))))
|
||||||
|
|
||||||
;;; multi-tty support
|
;;; multi-tty support
|
||||||
(defvar w32-initialized nil
|
(defvar w32-initialized nil
|
||||||
|
@ -4371,4 +4371,15 @@ the symbol of that THING. For example, (or sexp sentence). */);
|
|||||||
defsubr (&Streesit_subtree_stat);
|
defsubr (&Streesit_subtree_stat);
|
||||||
#endif /* HAVE_TREE_SITTER */
|
#endif /* HAVE_TREE_SITTER */
|
||||||
defsubr (&Streesit_available_p);
|
defsubr (&Streesit_available_p);
|
||||||
|
#ifdef WINDOWSNT
|
||||||
|
DEFSYM (Qtree_sitter__library_abi, "tree-sitter--library-abi");
|
||||||
|
Fset (Qtree_sitter__library_abi,
|
||||||
|
#if HAVE_TREE_SITTER
|
||||||
|
make_fixnum (TREE_SITTER_LANGUAGE_VERSION)
|
||||||
|
#else
|
||||||
|
make_fixnum (-1)
|
||||||
|
#endif
|
||||||
|
);
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user