static Lisp_Object Vtreesit_str_libtree_sitter;
static Lisp_Object Vtreesit_str_tree_sitter;
+static Lisp_Object Vtreesit_str_dot_0;
static Lisp_Object Vtreesit_str_dot;
static Lisp_Object Vtreesit_str_question_mark;
static Lisp_Object Vtreesit_str_star;
suffixes = Vdynamic_library_suffixes;
FOR_EACH_TAIL (suffixes)
- *path_candidates = Fcons (concat2 (lib_base_name, XCAR (suffixes)),
- *path_candidates);
+ {
+ Lisp_Object candidate1 = concat2 (lib_base_name, XCAR (suffixes));
+ /* Support libraries named with ABI version numbers. In the
+ foreseeable future we only need to support version 0.0. See
+ the thread titled "Versioned Tree-sitter parser libraries" on
+ emacs-devel. */
+ Lisp_Object candidate2 = concat2 (candidate1, Vtreesit_str_dot_0);
+ Lisp_Object candidate3 = concat2 (candidate2, Vtreesit_str_dot_0);
+
+ *path_candidates = Fcons (candidate3, *path_candidates);
+ *path_candidates = Fcons (candidate2, *path_candidates);
+ *path_candidates = Fcons (candidate1, *path_candidates);
+ }
}
/* Load the dynamic library of LANGUAGE_SYMBOL and return the pointer
Vtreesit_str_libtree_sitter = build_pure_c_string ("libtree-sitter-");
staticpro (&Vtreesit_str_tree_sitter);
Vtreesit_str_tree_sitter = build_pure_c_string ("tree-sitter-");
+ staticpro (&Vtreesit_str_dot_0);
+ Vtreesit_str_dot_0 = build_pure_c_string (".0");
staticpro (&Vtreesit_str_dot);
Vtreesit_str_dot = build_pure_c_string (".");
staticpro (&Vtreesit_str_question_mark);