[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: |
Eli Zaretskii |
Subject: |
Re: Use (eval-when-compile 'treesit) to save us from writing declare-function forms |
Date: |
Wed, 04 Dec 2024 20:57:24 +0200 |
> From: Yuan Fu <casouri@gmail.com>
> Date: Wed, 4 Dec 2024 10:19:42 -0800
> Cc: emacs-devel@gnu.org
>
>
>
> > On Dec 3, 2024, at 5:12 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> >
> > I don't understand" c-ts-mode.el already does
> >
> > (require 'treesit)
> >
> > So what would eval-when-compile add to that?
>
> When Emacs is built without tree-sitter, none of the treesit.c functions are
> available (except for treesit-ready-p). Now if this Emacs compiles
> c-ts-mode.el, it’ll signal undefined function error for all those functions.
> So we add declare-function forms for all the treesit.c functions used in
> c-ts-mode.el, and have to update the declare-function forms whenever we use
> some new treesit.c functions.
>
> 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?
- Use (eval-when-compile 'treesit) to save us from writing declare-function forms, Yuan Fu, 2024/12/03
- Re: Use (eval-when-compile 'treesit) to save us from writing declare-function forms, Andrea Corallo, 2024/12/03
- Re: Use (eval-when-compile 'treesit) to save us from writing declare-function forms, Eli Zaretskii, 2024/12/03
- Re: Use (eval-when-compile 'treesit) to save us from writing declare-function forms, Yuan Fu, 2024/12/04
- Re: Use (eval-when-compile 'treesit) to save us from writing declare-function forms,
Eli Zaretskii <=
- Re: Use (eval-when-compile 'treesit) to save us from writing declare-function forms, Yuan Fu, 2024/12/05
- Re: Use (eval-when-compile 'treesit) to save us from writing declare-function forms, Eli Zaretskii, 2024/12/05
- 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