|
From: | Dmitry Gutov |
Subject: | Re: Use (eval-when-compile 'treesit) to save us from writing declare-function forms |
Date: | Wed, 11 Dec 2024 03:57:42 +0200 |
User-agent: | Mozilla Thunderbird |
On 09/12/2024 04:40, Stefan Monnier wrote:
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).
[Prev in Thread] | Current Thread | [Next in Thread] |