From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.devel Subject: Re: Use (eval-when-compile 'treesit) to save us from writing declare-function forms Date: Wed, 4 Dec 2024 10:19:42 -0800 Message-ID: <0D278D91-4D67-4E0E-869F-6AF0A46678F7@gmail.com> References: <2C0B7D3A-6131-4427-BF04-9211981B57DD@gmail.com> <867c8g3o6v.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24884"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Dec 04 19:21:08 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tItzo-0006Cf-4q for ged-emacs-devel@m.gmane-mx.org; Wed, 04 Dec 2024 19:21:08 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tItym-0000R4-4F; Wed, 04 Dec 2024 13:20:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tItyi-0000QI-Ta for emacs-devel@gnu.org; Wed, 04 Dec 2024 13:20:02 -0500 Original-Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tItye-0001sl-GD; Wed, 04 Dec 2024 13:19:58 -0500 Original-Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-7252fba4de1so143794b3a.0; Wed, 04 Dec 2024 10:19:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733336394; x=1733941194; darn=gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=xfFl5linL+hBU+FM5TkOBmeJUQKIdS/6HK6247aaIdg=; b=i0k1ZZK12mSFlTWkHJ2uk5RB1Du1DZcr6pCoHg7qMnrcQ7FXKqlcolcdy4HYH+h6Rl 1bHn0hpUMcZA3M3ylkKbdL3gWbxpKT93c3VxgQvw1k6UEBcaTPWNiGnjgToQo542KMlg 7kd2qR/VNrxNMsA68Han8gTAWRQohmPwKqViz88jO97CwIg9DWTlbYhGJVVxFwpHmZxX FFS0+cX/SM8DxuC9sGjLnaRBYt9ZVw0ieObZvrqmxCcnSA41ZlvDgOe/wPrbEaFydriS HOi4OUFq79cFIJ3hri1+lIIyi4PokPL80qWORNBgEu5VxiWOtdHmPiGIL7rVjI2P11wQ 3g8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733336394; x=1733941194; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xfFl5linL+hBU+FM5TkOBmeJUQKIdS/6HK6247aaIdg=; b=vFTZRMlUHKbHt7ekJhiz/B9NoZbbfuDq3G9XGhBP+cqCaaJS6ccGlmq72h42wgC85G C2lhoe0sEE9wLQc4AzWzCVpHPOlac/LEynovlTsNCGcdsn1EDCSxBV3aDvsaiC85Mout QBdWL/xvykWu/eeWVMCS80WO9vBbAsdafLvwWGoSKv/AIATYWD8x4f+R9ThEddpes75L AiO96UZSAL55lsKTgaZvnVVGSp8KefahzcKIuFnNy33jXM9iXGBhl/bSTPuBHTpHeYsl m7WML0Uh6ktV6evkWleEZZ8E6y9LBbzlgtgoogZXkjwuOJUM6i7pKUJIrspj1VCCRQNZ N//g== X-Gm-Message-State: AOJu0Yz+Rgr8iWVK8pji5V7v1CWb+yqySald9mccwmgZy2huQIW9xLt+ spREj7KfK6Gm35vj4qiPji3J49Wz2xtakzSSiRDVtjb+FzAbkFbrfrjgdQ== X-Gm-Gg: ASbGnctG8OMFfkw8+A24AlOZNVLp3xl3u8k5wtHExnolulEHZusyZ9lDjGszV4U7O9i jRFvWr2QdEA3zR/NPXYNf/VIjB26U81/LS9n13jIohIycH3q/KoMJOknleJ8Q7v3ank4zDseTcy vUaBye6QyI9KMKcieCQhCvktbctraNk/IMXQj0WTuukoQVzswY3GbXKwTE1hy8/lscNziXXgk/O F9eXHJJLHfi+4McawcWrgBCtermEcOiH0MY2QUaewVpOgX/Pp6Y7sL5VzK0FZ1JmUuvnV0RTg== X-Google-Smtp-Source: AGHT+IEmz23MVPUVMD0GiroCSdjA3+eXH4mdVmICKJVxAHm68PpW8Adch15dCC79bE7vB9JzwByMYg== X-Received: by 2002:a05:6a00:9a0:b0:71e:6c65:e7c4 with SMTP id d2e1a72fcca58-7257fce9159mr12010024b3a.26.1733336393561; Wed, 04 Dec 2024 10:19:53 -0800 (PST) Original-Received: from smtpclient.apple ([2601:646:8f81:6120:d4a2:bdb3:ccbc:4058]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7254176f170sm12662133b3a.49.2024.12.04.10.19.52 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Dec 2024 10:19:53 -0800 (PST) In-Reply-To: <867c8g3o6v.fsf@gnu.org> X-Mailer: Apple Mail (2.3776.700.51) Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=casouri@gmail.com; helo=mail-pf1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:326046 Archived-At: > On Dec 3, 2024, at 5:12=E2=80=AFAM, Eli Zaretskii = wrote: >=20 >> From: Yuan Fu >> Date: Mon, 2 Dec 2024 22:31:48 -0800 >>=20 >> Some of my recent changes to c-ts-mode.el uses some more C treesit = functions, and I (again) forgot to add their declare-function forms to = c-ts-mode.el, and Andrea has to fix it for me. The main problem for me = is that (I think) you don=E2=80=99t get warning for them unless you = build a non-tree-sitter build of Emacs. So I=E2=80=99m prone to forgot = about them. Also it=E2=80=99s a burden for anyone wanting to use = tree-sitter functions. >>=20 >> treesit.el already has all the declare-function forms, how about we = use (eval-when-compile 'treesit) in other files? I believe that should = alleviate us from adding those declare-function forms in other files? >=20 > I don't understand" c-ts-mode.el already does >=20 > (require 'treesit) >=20 > 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=E2=80=99ll 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=E2=80=99t need to write = declare-function forms in c-ts-mode.el anymore, because treesit.el has = declare-function forms for all treesit.c functions. Yuan=