Subject: Re: bug#73303: 30.0.91; Native compiler repeatedly interrupts at random moments

From: Andrea Corallo <[email-masked]>
Date: Tue, 22 Oct 2024 12:29:49 -0400

Eli Zaretskii <[email-masked]> writes:

>> From: Andrea Corallo <[email-masked]>
>> Cc: [email-masked],  [email-masked],  [email-masked]
>> Date: Wed, 25 Sep 2024 14:47:55 -0400
>> 
>> Eli Zaretskii <[email-masked]> writes:
>> 
>> >> From: Andrea Corallo <[email-masked]>
>> >> Cc: "N. Jackson" <[email-masked]>,  Philip Kaludercic
>> >>  <[email-masked]>,  [email-masked]
>> >> Date: Tue, 24 Sep 2024 15:10:10 -0400
>> >> 
>> >> Eli Zaretskii <[email-masked]> writes:
>> >> 
>> >> > 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? 
>> >> 
>> >> 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?
>> >
>> > Yes, that would be better.  But the test is not very trivial, because
>> > the .eln file can be in another directory, somewhere on
>> > native-comp-eln-load-path, and there's the issue of the right version
>> > and hash.  Maybe we should have a find-eln-file function to do that?
>> 
>> Yep, just looping on `native-comp-eln-load-path` using
>> `comp-el-to-eln-rel-filename` should do the job.  Okay I'll try to put
>> together a patch.
>
> Ping!

Hi Eli,

with 246d68bd2a5 I added an implementation of 'native-compile-directory'
which I believe does what we wanted here.  Please have a look and feel
free to suggest or improve.

Thanks!

  Andrea