[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-29 8f71c1546df: Accept versioned tree-sitter language grammar file
From: |
Yuan Fu |
Subject: |
emacs-29 8f71c1546df: Accept versioned tree-sitter language grammar files |
Date: |
Mon, 24 Apr 2023 13:39:21 -0400 (EDT) |
branch: emacs-29
commit 8f71c1546dfc70ae7e646834c8d8baf23d4b4d90
Author: Yuan Fu <casouri@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>
Accept versioned tree-sitter language grammar files
By discussion on emacs-devel, titled "Versioned Tree-sitter parser
libraries".
* src/treesit.c (Vtreesit_str_dot_0): New variable.
(treesit_load_language_push_for_each_suffix): Additionally look for
lib_base_name.0 and lib_base_name.0.0.
(syms_of_treesit): Initialize Vtreesit_str_dot_0.
---
src/treesit.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/treesit.c b/src/treesit.c
index 53dbeb68882..2d0df10ec44 100644
--- a/src/treesit.c
+++ b/src/treesit.c
@@ -404,6 +404,7 @@ init_treesit_functions (void)
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;
@@ -529,8 +530,19 @@ treesit_load_language_push_for_each_suffix (Lisp_Object
lib_base_name,
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
@@ -3583,6 +3595,8 @@ then in the system default locations for dynamic
libraries, in that order. */);
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);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- emacs-29 8f71c1546df: Accept versioned tree-sitter language grammar files,
Yuan Fu <=