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 22:25:33 -0800 Message-ID: <502D58B8-9432-4A8F-B50D-ECA392B7E7C5@gmail.com> References: <2C0B7D3A-6131-4427-BF04-9211981B57DD@gmail.com> <867c8g3o6v.fsf@gnu.org> <0D278D91-4D67-4E0E-869F-6AF0A46678F7@gmail.com> <86h67jz36z.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="23204"; 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 Thu Dec 05 07:26:54 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 1tJ5KA-0005uT-3s for ged-emacs-devel@m.gmane-mx.org; Thu, 05 Dec 2024 07:26:54 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tJ5JW-0002AQ-Sd; Thu, 05 Dec 2024 01:26:14 -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 1tJ5JT-00029u-PU for emacs-devel@gnu.org; Thu, 05 Dec 2024 01:26:11 -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 1tJ5J5-00045w-Tm; Thu, 05 Dec 2024 01:26:09 -0500 Original-Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-7252b7326f4so491052b3a.2; Wed, 04 Dec 2024 22:25:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733379945; x=1733984745; 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=Byk2Qrf6LZemk7nePPva5GdYlOKFoHfYvfrvz0QWQqo=; b=OH8uznzaECe26y2ol+8wuQpD03soHkU4F5xGS9Q8oI61U/KBzdXfRl38fEyxdrN3Rx wfsdTxQeCGlzUN7v77TKCEJKgHqYhazKOtgWI4Zx7uHPY7jBfzVjmiEh7qvBf3XWfq+K JRhveS7CX1gPvq6e2er7adHqoWVytL7v43S+obchF8wN46OqwdU/u0Lu+rV4CE1g7clf SWkXx7ZSNLed7Iit14YgAgz9izR2sLTAD2ETICspa5Eh4xcad3Pm2ksOmM2IUyOiOdwG eoYRT3NZuu0l1viEqb4cZWin213NxARPknWsydhicrbctWFRzbXDfn0cE/pbEY9GoFWq b5QA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733379945; x=1733984745; 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=Byk2Qrf6LZemk7nePPva5GdYlOKFoHfYvfrvz0QWQqo=; b=s3Pt0qfj/b+/R/AeldZnj7AMdtrh+YQtWbv/MRB+lRZFAZvIecmw6kCVIBz/K+AsNN L2D5N8R6UcTVpiPl+UeDayHaWwTGVVmjjeMrLq7GtjNnWcCj/ZLoSyfLqJKgvQf9IARH 1W4yokVqmoj8n1luGpa6R1OeJrlE8BSGsKXRg8TrYbo3YfI7tkjHHjJNVCTqaJ76AL9G q9kWkubm8O2GfOizCkVBmqHDjkPoqgeRW3JLEp7sP+3m4HOwJ07F8mZ1iKZQ26BAZvcv aPMijy7rQkouyDTmi3LC2HgQaqkjeDO7FXaK1VQPc3tGoZ3O4i0owZts8g9rwEhF9Da5 Zsaw== X-Gm-Message-State: AOJu0Yz+hGSDMm4e3MYgeRBpwLz4RU9YwSDmbpAqM48mx9dHSfHy8Ad/ XbWdDSrt5jneNGPc4TMNjyCi7bd1kGQy5n8u0fq6QPgcdnl2XQFLHOom3Q== X-Gm-Gg: ASbGncvsljQT16K50xIpFsbmtmKXyCYbTMUkK3zCRfFJEPVLnUOvLy8d0JsAE3iFjj8 g3tXHcI8Kts7yJrQuK1jQFPx7Yf32ChHxeIoTAC/RrPRwemjXq5vizR5gcOAUgxQujiVvckpt6G UEwPZ/TEERV98XZAEmW9SYI0WedIOrnP+/n6AnhUbAPMWJ45cptbDfHc9Tn34goHry0WEEsmWWb /QNs8027UhvwNJYsq+V7odj99HsSTLBeqkz9XAXu+DwyyTD8DFEpNzv+45pdE0XR4hAsqqg8Q== X-Google-Smtp-Source: AGHT+IGXCUTO9UGz7fNOS4a8VkyDVuchVYHI3l96L1fqBOrg3MYffjgGldeXOFHaYsEN+9XaOLVEUg== X-Received: by 2002:a17:902:cec6:b0:215:3849:9275 with SMTP id d9443c01a7336-215bd17ddccmr132639865ad.49.1733379945353; Wed, 04 Dec 2024 22:25:45 -0800 (PST) Original-Received: from smtpclient.apple ([2601:646:8f81:6120:d4a2:bdb3:ccbc:4058]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-215f8f0ab8fsm5377845ad.190.2024.12.04.22.25.44 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Dec 2024 22:25:44 -0800 (PST) In-Reply-To: <86h67jz36z.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:326067 Archived-At: > On Dec 4, 2024, at 10:57=E2=80=AFAM, Eli Zaretskii = wrote: >=20 >> From: Yuan Fu >> Date: Wed, 4 Dec 2024 10:19:42 -0800 >> Cc: emacs-devel@gnu.org >>=20 >>=20 >>=20 >>> On Dec 3, 2024, at 5:12=E2=80=AFAM, Eli Zaretskii = wrote: >>>=20 >>> I don't understand" c-ts-mode.el already does >>>=20 >>> (require 'treesit) >>>=20 >>> So what would eval-when-compile add to that? >>=20 >> 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. >>=20 >> 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. >=20 > 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=E2=80=99t use = eval-when-compile, simply byte-compiling c-ts-mode.el wouldn=E2=80=99t = load treesit.el? Yuan=