From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrea Corallo Newsgroups: gmane.emacs.bugs Subject: bug#73303: 30.0.91; Native compiler repeatedly interrupts at random moments Date: Tue, 24 Sep 2024 15:10:10 -0400 Message-ID: References: <87wmjbmpnt.fsf@moondust.awandering> <867cbbcuen.fsf@gnu.org> <87plp2mhj1.fsf@moondust.awandering> <865xqub7ai.fsf@gnu.org> Mime-Version: 1.0 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="17548"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Philip Kaludercic , "N. Jackson" , 73303@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 24 21:11:01 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1stAw8-0004MH-NE for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 24 Sep 2024 21:11:01 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1stAvo-0004Wo-GJ; Tue, 24 Sep 2024 15:10:40 -0400 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 1stAvm-0004WP-A8 for bug-gnu-emacs@gnu.org; Tue, 24 Sep 2024 15:10:38 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1stAvl-0004R9-Vl for bug-gnu-emacs@gnu.org; Tue, 24 Sep 2024 15:10:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=ScUbnCZxFO5l2ELdo04s13wsTLX00qatHPBYODuW2dU=; b=F4HLkT6pmto0G6tMYnKmcdBIcSx+rk+c9LTe6/79RKCN0FdfE2v0a7PvYiB0fsSoFONi53Jt98pQ18VwR1hWV6CkJohY35eu9FoGj+EcAkTLBcEpJZrQ69D6Hrv8ekFG3RcdZ0XzWawtaFmTAgHg+I8cqiBoicsrs7cOXqKttn19mXPAKccSBcM9X+95GLVEuHbV8lAHzoJXNvPbVcBZATmH07hOZr60HGQg4TDjCB/T5WFwbgKL5eCnMhZpo2B0kE1w3bxGYShh2L9Cr2wrcm50Qu53RKRUCA6EVN9f1RnXhM4vPEwOK8KUolkv3viScgIPntrh9h/2E2Zih8Pbhg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1stAwA-0000p8-DK for bug-gnu-emacs@gnu.org; Tue, 24 Sep 2024 15:11:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Andrea Corallo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 24 Sep 2024 19:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73303 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: notabug Original-Received: via spool by 73303-submit@debbugs.gnu.org id=B73303.17272050453123 (code B ref 73303); Tue, 24 Sep 2024 19:11:02 +0000 Original-Received: (at 73303) by debbugs.gnu.org; 24 Sep 2024 19:10:45 +0000 Original-Received: from localhost ([127.0.0.1]:37356 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stAvs-0000oI-Ak for submit@debbugs.gnu.org; Tue, 24 Sep 2024 15:10:44 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:48482) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1stAvq-0000nx-5c for 73303@debbugs.gnu.org; Tue, 24 Sep 2024 15:10:42 -0400 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 1stAvL-0004PL-NX; Tue, 24 Sep 2024 15:10:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=ScUbnCZxFO5l2ELdo04s13wsTLX00qatHPBYODuW2dU=; b=ZVl4SXf0hemvqQXD41zN x7mNGQs1c4YJgeqe0++jOJ7GpDTRdIKNoqc3jM6cnw8UlQLvw2IUoP12FLms+2/i9tUsPkMGvA+/s CoRUaGzzRt2oMqdK14Dr5YbXuxc0Jrdo8b7DU0n8M/fgjMZ/MlYgtTedFr8RFTwM5Q/L76z13UEuS tbBq+WJP8sNGsUGdqcBBdkCWq0kK7SxjGM8dQlXHQBjZxqdAKx4mT3LBpIgRWAWQbCrKepa3iqE5O AOcnG/IuuRhhrBwd60xqUbeWWdwaEqwwQ1rLBD70fuvlYSaS2OMwF6wvcuqVNdZEwt73wTjh8mapd 2t5Gq8r2hc5QAw==; Original-Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1stAvK-0005zo-JH; Tue, 24 Sep 2024 15:10:10 -0400 In-Reply-To: <865xqub7ai.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 17 Sep 2024 18:59:17 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:292363 Archived-At: Eli Zaretskii writes: >> From: "N. Jackson" >> Cc: 73303@debbugs.gnu.org, Andrea Corallo >> Date: Tue, 17 Sep 2024 15:22:42 +0000 >>=20 >> Hello Eli, thank you for your response. >>=20 >> At 21:42 +0300 on Monday 2024-09-16, Eli Zaretskii wrote: >>=20 >> > I see no bug in what you describe. >>=20 >> Fair enough. The concern that prompted me to file a bug report was >> not that native compile is broken (a literal bug) but rather that >> since it's a newish feature you might welcome end-user feedback >> about it's default behaviour (or perceived behaviour) that might >> lead to to beneficial tweaks to either the behaviour or to the >> documentation. > > The feedback is always welcome, of course (if my wording somehow made > an impression it wasn't, I apologize). And what you describe is > already known: a few users posted similar experiences during the > development and testing of Emacs 29. So these issues are not new, and > I think Emacs 30 is better equipped to deal with them, and gives users > more knobs to deal with them. > >> > These warnings usually mean that the offending Lisp file lacks >> > some 'require's. JIT native compilation runs in a separate Emacs >> > session, which only loads the file it compiles, so any missing >> > 'require's or autoloading cookies trigger these warnings, whereas >> > when the same packages are loaded into your main Emacs session, >> > they can benefit from packages loaded earlier in the session. >> ... >> > JIT native compilation is triggered by loading a .elc file that >> > doesn't yet have a corresponding .eln file >>=20 >> Thank you for the overview of how native compilation works. I had >> wrongly guessed that it was deferring the compilation lazily and >> doing it later on an idle timer or something of that sort. If I >> understand what you are saying correctly, the native compiler, not >> having a crystal ball, cannot possibly know ahead of time what .elc >> files a user might load, so it cannot compile them ahead of time. > > Yes, exactly. JIT compilation compiles only packages that you load, > when you load them for the first time. > >> However, as a na=C3=AFve end-user of Emacs, when I am _using_ Emacs, as a >> tool to get a job done -- writing an essay, say -- I don't want to >> think about the guts of how Emacs works. I'm happy to save that for >> when I'm building Emacs or maintaining my configuration files and >> that is when I would want the native compilation to happen, if that >> were possible. >>=20 >> You write >>=20 >> > You can disable these warnings if you are annoyed by them. They >> > are just warnings, and will not usually cause any problems when >> > using the compiled code. See >> > native-comp-async-report-warnings-errors. >>=20 >> Sweeping warnings under the rug isn't something I'm comfortable with >> even if nine times out of ten (or 999 times in 1000) they're false >> alarms. (I'm the sort of person that -Werror was made for.) > > If you set native-comp-async-report-warnings-errors to the value > 'silent', the warnings will be logged in the *Warnings* buffer, where > you can later review them, but will not be shown in a popup buffer, > which might distract you when you don't want that. > >> > You can cause these compilations to happen at the beginning of your >> > Emacs session if you change your init files such that Emacs loads all >> > these files. >> ... >> > In any case, Emacs compiles each Lisp file just once, so you should >> > only see these when you start a new Emacs version for the first time. >>=20 >> I guess, then, that I would want to (somehow) process my init files -- >> before using Emacs for the first time after upgrading to a new >> version -- to ensure native compilation of all dependencies. >>=20 >> Do you have any pointers on how to go about doing that? It seems >> impractical for a casual Emacs user since they don't necessary know >> what files will be loaded by the packages they use. The warnings >> I've seen so far all refer to files I've never heard of. > > If your init file arranges for many packages to load only on demand, > then I don't think there is a way, except summarily compile all the > packages under your ~/.emacs.d/ directory (assuming that's where you > install them). Maybe we should have a native-compile-directory > function to make that easier; currently we only have > emacs-lisp-native-compile, which compiles a single file. Andrea, > WDYT?=20 Yes we could do that if we think is useful, is probably few lines like: (defun native-compile-directory (directory) (mapc (lambda (file) (native-compile file)) (directory-files-recursively directory ".+\\.el$"))) but this will recompile all files, so maybe to make it useful for .emacs we should have something that compiles files only when the corresponding eln is not already present?