Finally able to address this again. > On Aug 28, 2024, at 11:01 PM, Eli Zaretskii <e...@gnu.org> wrote: > >> From: Yuan Fu <caso...@gmail.com> >> Date: Wed, 28 Aug 2024 21:54:26 -0700 >> Cc: Stefan Kangas <stefankan...@gmail.com>, >> Alan Mackenzie <a...@muc.de>, >> 64...@debbugs.gnu.org >> >> Ah, thanks for the review! TIL. Here’s the revised patch. > > A few more nits: > >> + const char *sym; >> + dynlib_addr((void (*) (void)) langfn, &loaded_lang.filename, &sym); > ^^ > We leave one space between the function name and the opening paren. > Also, do you really need the type-cast for langfn? Do you get > compiler warnings if you remove the cast?
Oops. And yeah, I actually get an error: treesit.c:702:16: error: incompatible function pointer types passing 'TSLanguage *(*)(void)' (aka 'struct TSLanguage *(*)(void)') to parameter of type 'void (*)(void)' [-Wincompatible-function-pointer-types] 702 | dynlib_addr (langfn, &loaded_lang.filename, &sym); | ^~~~~~ ./dynlib.h:39:26: note: passing argument to parameter 'ptr' here 39 | void dynlib_addr (void (*ptr) (void), const char **file, const char **sym); | ^ The error seems reasonable to me, I just don’t know other way to suppress it. >> +DEFUN ("treesit-grammar-location", Ftreesit_grammar_location, >> + Streesit_grammar_location, >> + 1, 1, 0, >> + doc: /* Return the path to the grammar file for LANGUAGE. > ^^^^ > "Path" again. I suggest "absolute file name" instead. > >> +If LANGUAGE isn't loaded yet, load it first. If the langauge can't be >> +loaded or the path couldn't be found, return nil. */) > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > I suggest "or the file name couldn't be determined”. Done. Please take a look at the latest patch, thanks! Yuan
grammar-location.patch
Description: Binary data