From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Use (eval-when-compile 'treesit) to save us from writing declare-function forms Date: Sat, 07 Dec 2024 09:51:07 +0200 Message-ID: <86ser0j5hw.fsf@gnu.org> References: <2C0B7D3A-6131-4427-BF04-9211981B57DD@gmail.com> <867c8g3o6v.fsf@gnu.org> <0D278D91-4D67-4E0E-869F-6AF0A46678F7@gmail.com> <86h67jz36z.fsf@gnu.org> <502D58B8-9432-4A8F-B50D-ECA392B7E7C5@gmail.com> <86ser2y5e1.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14734"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Yuan Fu , Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Dec 07 08:51:35 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 1tJpbC-0003hs-4v for ged-emacs-devel@m.gmane-mx.org; Sat, 07 Dec 2024 08:51:34 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tJpay-0005M1-7w; Sat, 07 Dec 2024 02:51:20 -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 1tJpaq-0005LD-Sk for emacs-devel@gnu.org; Sat, 07 Dec 2024 02:51:15 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tJpao-0001Re-RW; Sat, 07 Dec 2024 02:51:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=hWBpYqy6v7GmIRAqFJgv/LvRIXBbJn0LX9cknHJFyRw=; b=oLE4v3ibTW1APkY29Eif uAJHJcPKytvs+UewLsh0eRroiwf7k59qfhXzzDUQyneBBDE8WGfZXaG/Ez0JTEkq/aT+TXTwI57lo p4bxHOApYgVrV16EZTyA5ebv3G2Rbfo1h7z4C+9/Ehlwkj+9yz701X/ZqZgCZeTRgQfdTG8AX7OI3 /M97TGR2jOYlXef7r91P+gXQUp7F0+SIDmEbPXE+yGw+AEcxmYruHBGnbYosO3PaqfHpaDVX5sHCq mbe3vYp4cw/cSp1cPGhrQWYCwO+ebPWv6RSWUxoYnUggP4kWdcHZ/d132dJcRpaM3RX54vqHP3vOm +FpfWYsEKxBN+w==; In-Reply-To: (message from Yuan Fu on Fri, 6 Dec 2024 17:12:38 -0800) 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:326158 Archived-At: > From: Yuan Fu > Date: Fri, 6 Dec 2024 17:12:38 -0800 > Cc: emacs-devel@gnu.org > > > > > On Dec 4, 2024, at 11:07 PM, Eli Zaretskii wrote: > > > >> From: Yuan Fu > >> Date: Wed, 4 Dec 2024 22:25:33 -0800 > >> Cc: emacs-devel@gnu.org > >> > >>>> 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? > >> > >> I maybe wrong here, but I thought if you don’t use eval-when-compile, simply byte-compiling c-ts-mode.el wouldn’t load treesit.el? > > > > Yes, it would. You can clearly see this in a debugger if you put a > > breakpoint in Fload and then byte-compile c-ts-mode.el. > > 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?