emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Use (eval-when-compile 'treesit) to save us from writing declare-fun


From: Yuan Fu
Subject: Re: Use (eval-when-compile 'treesit) to save us from writing declare-function forms
Date: Fri, 6 Dec 2024 17:12:38 -0800


> On Dec 4, 2024, at 11:07 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> From: Yuan Fu <casouri@gmail.com>
>> Date: Wed, 4 Dec 2024 22:25:33 -0800
>> Cc: emacs-devel@gnu.org
>> 
>>>> If we use eval-when-compile, we don’t need to write declare-function forms 
>>>> in c-ts-mode.el anymore, because treesit.el has declare-function forms for 
>>>> all treesit.c functions.
>>> 
>>> That's what I don't understand: how will eval-when-compile which loads
>>> treesit.el be different from (require 'treesit) we already have in
>>> c-ts-mode?  Don't they both load treesit.el?
>> 
>> I maybe wrong here, but I thought if you don’t use eval-when-compile, simply 
>> byte-compiling c-ts-mode.el wouldn’t load treesit.el?
> 
> Yes, it would.  You can clearly see this in a debugger if you put a
> breakpoint in Fload and then byte-compile c-ts-mode.el.

Does that mean declare-function forms only affect the file it’s in? Because if 
treesit.el has declare-function forms for all the treesit.c functions, and 
c-ts-mode.el requires treesit.el, why do we need to have declare-function forms 
in c-ts-mode.el?

Yuan


reply via email to

[Prev in Thread] Current Thread [Next in Thread]