From 8044140b54bfe7e88c28a49cc0dc4ae129029e4f Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Tue, 26 Dec 2023 22:37:19 -0800 Subject: [PATCH] Revert e8df6c311fcf59bf23d31b9db2bb8fec9d78fbe7 --- src/treesit.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/treesit.c b/src/treesit.c index 3f4337ba97e..c65873a28f7 100644 --- a/src/treesit.c +++ b/src/treesit.c @@ -600,8 +600,6 @@ treesit_load_language (Lisp_Object language_symbol, /* First push just the filenames to the candidate list, which will make dynlib_open look under standard system load paths. */ treesit_load_language_push_for_each_suffix (lib_base_name, &path_candidates); - /* This is used for reporting errors (i.e., just filenames). */ - Lisp_Object base_candidates = path_candidates; /* Then push ~/.emacs.d/tree-sitter paths. */ Lisp_Object lib_name = Fexpand_file_name (concat2 (build_string ("tree-sitter/"), lib_base_name), @@ -624,6 +622,7 @@ treesit_load_language (Lisp_Object language_symbol, fail. */ dynlib_handle_ptr handle; const char *error; + Lisp_Object error_list = Qnil; tail = path_candidates; error = NULL; @@ -637,13 +636,17 @@ treesit_load_language (Lisp_Object language_symbol, error = dynlib_error (); if (error == NULL) break; + else + error_list = Fcons (build_string (error), error_list); } if (error != NULL) { + /* Yes, the error message list gets a bit verbose, but those + messages will be helpful for certain errors like libc version + mismatch. */ *signal_symbol = Qtreesit_load_language_error; - *signal_data = list3 (Qnot_found, base_candidates, - build_string ("No such file or directory")); + *signal_data = Fcons (Qnot_found, Fnreverse (error_list)); return NULL; } -- 2.39.2