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: Stefan Monnier
Subject: Re: Use (eval-when-compile 'treesit) to save us from writing declare-function forms
Date: Sat, 07 Dec 2024 08:47:24 -0500
User-agent: Gnus/5.13 (Gnus v5.13)

>> 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?
> Seems like that.  Stefan, am I missing something here?

Yes, `declare-function` *should* follow the same principles as `(defvar
FOO)`, meaning that they are compiler directives not functions to
execute.  They affect warnings only in the current lexical scope, and
requiring a file full of `(defvar FOO)` and `declare-function` will have
no effect at all.

[ Side note regarding this *should*: it currently doesn't work quite as
  well as `defvar` because its effect is always file-wide, whereas it
  should be limited to the current scope.  ]


        Stefan




reply via email to

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