[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: |
Stefan Monnier |
Subject: |
Re: Use (eval-when-compile 'treesit) to save us from writing declare-function forms |
Date: |
Fri, 13 Dec 2024 16:54:01 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
>>> I thought eval-when-compile is more of a “include if compiling” macro,
>>> should’ve checked 🙂
>>>
>>> We can also go with Dmitry’s idea, and just define all the functions in
>>> treesit.el if Emacs is not built with tree-sitter. We can detect that with
>>> treesit-available-p.
>> I haven't really thought about it, so I don't have a strong opinion.
>> AFAICT your proposal should work fine even if you remove the
>> `eval-when-compile` wrappers to which I objected. 🙂
>
> It seems to me that, having taken than route, we would recommend every
>
> (require 'treesit)
>
> to be accompanied by
>
> (treesit-declare-c-functions)
>
> ...or the familiar declare-function list, of course.
>
> And the same would also be true for transitive dependencies (so, both
> c-ts-common and c-ts-mode, even though otherwise the latter could drop the
> (require 'treesit) form).
Yup. The only cleanish way to avoid having to do that (short of
a major improvement to the byte-compiler's handling of tracking when
functions are defined) is to arrange it to all those function are always
defined (and presumably signal errors when treesit is not actually
available).
Stefan
- Re: Use (eval-when-compile 'treesit) to save us from writing declare-function forms, (continued)
- Re: Use (eval-when-compile 'treesit) to save us from writing declare-function forms, Yuan Fu, 2024/12/06
- Re: Use (eval-when-compile 'treesit) to save us from writing declare-function forms, Eli Zaretskii, 2024/12/07
- Re: Use (eval-when-compile 'treesit) to save us from writing declare-function forms, Stefan Monnier, 2024/12/07
- Re: Use (eval-when-compile 'treesit) to save us from writing declare-function forms, Yuan Fu, 2024/12/08
- Re: Use (eval-when-compile 'treesit) to save us from writing declare-function forms, Eli Zaretskii, 2024/12/08
- Re: Use (eval-when-compile 'treesit) to save us from writing declare-function forms, Andrea Corallo, 2024/12/11
- Re: Use (eval-when-compile 'treesit) to save us from writing declare-function forms, Stefan Monnier, 2024/12/08
- Re: Use (eval-when-compile 'treesit) to save us from writing declare-function forms, Yuan Fu, 2024/12/08
- Re: Use (eval-when-compile 'treesit) to save us from writing declare-function forms, Stefan Monnier, 2024/12/08
- Re: Use (eval-when-compile 'treesit) to save us from writing declare-function forms, Dmitry Gutov, 2024/12/10
- Re: Use (eval-when-compile 'treesit) to save us from writing declare-function forms,
Stefan Monnier <=
- Re: Use (eval-when-compile 'treesit) to save us from writing declare-function forms, Dmitry Gutov, 2024/12/08
- Re: Use (eval-when-compile 'treesit) to save us from writing declare-function forms, Andrea Corallo, 2024/12/11
- Re: Use (eval-when-compile 'treesit) to save us from writing declare-function forms, Dmitry Gutov, 2024/12/11
- Re: Use (eval-when-compile 'treesit) to save us from writing declare-function forms, Yuan Fu, 2024/12/12
- Re: Use (eval-when-compile 'treesit) to save us from writing declare-function forms, Eli Zaretskii, 2024/12/12
- Re: Use (eval-when-compile 'treesit) to save us from writing declare-function forms, Yuan Fu, 2024/12/13
- Re: Use (eval-when-compile 'treesit) to save us from writing declare-function forms, Eli Zaretskii, 2024/12/12
- Re: Use (eval-when-compile 'treesit) to save us from writing declare-function forms, Eli Zaretskii, 2024/12/12