Subject: bug#57627: 29.0.50; [native-compilation] cl-loaddefs.el recompiled on startup

From: Andrea Corallo <[email-masked]>
Date: Sun, 13 Oct 2024 17:20:15 -0400

Eli Zaretskii <[email-masked]> writes:

> Ping!

Here I'm.

I tried again reproducing the bug but with no success, maybe it depends
on the configuration?

Anyway the following patch makes Phil test return (t t t t), essentially
if "file" ends with ".el.gz" we just remove the final ".gz" and keep the
previous logic.

==================
modified   lisp/emacs-lisp/comp-run.el
@@ -143,20 +143,24 @@ native--compile-async-skip-p

 LOAD and SELECTOR work as described in `native--compile-async'."
   ;; Make sure we are not already compiling `file' (bug#40838).
-  (or (gethash file comp-async-compilations)
-      (gethash (file-name-with-extension file "elc") comp--no-native-compile)
-      (cond
-       ((null selector) nil)
-       ((functionp selector) (not (funcall selector file)))
-       ((stringp selector) (not (string-match-p selector file)))
-       (t (error "SELECTOR must be a function a regexp or nil")))
-      ;; Also exclude files from deferred compilation if
-      ;; any of the regexps in
-      ;; `native-comp-jit-compilation-deny-list' matches.
-      (and (eq load 'late)
-           (seq-some (lambda (re)
-                      (string-match-p re file))
-                    native-comp-jit-compilation-deny-list))))
+  (let ((file (if (string-match (rx (group-n 1 (one-or-more nonl) ".el") ".gz" eol)
+                                file)
+                  (match-string 1 file)
+                file)))
+    (or (gethash file comp-async-compilations)
+        (gethash (file-name-with-extension file "elc") comp--no-native-compile)
+        (cond
+         ((null selector) nil)
+         ((functionp selector) (not (funcall selector file)))
+         ((stringp selector) (not (string-match-p selector file)))
+         (t (error "SELECTOR must be a function a regexp or nil")))
+        ;; Also exclude files from deferred compilation if
+        ;; any of the regexps in
+        ;; `native-comp-jit-compilation-deny-list' matches.
+        (and (eq load 'late)
+             (seq-some (lambda (re)
+                         (string-match-p re file))
+                       native-comp-jit-compilation-deny-list)))))

 (defvar comp-files-queue ()
   "List of Emacs Lisp files to be compiled.")

==================

  Andrea