From 20e1a57d443c5fc36aa6c09a644870dfa0bceb3e Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 31 Dec 2025 13:15:40 -0500 Subject: [PATCH] (native--compile-async): Try and avoid inf-loops (bug#80012) * lisp/emacs-lisp/comp-run.el (native--compile-async): Call `comp--run-async-workers` only if we caused the queue to become non-empty. --- lisp/emacs-lisp/comp-run.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lisp/emacs-lisp/comp-run.el b/lisp/emacs-lisp/comp-run.el index 5e33b1bc318..cfec4f3d5bb 100644 --- a/lisp/emacs-lisp/comp-run.el +++ b/lisp/emacs-lisp/comp-run.el @@ -454,6 +454,7 @@ bytecode definition was not changed in the meantime)." (unless (listp files) (setf files (list files))) (let ((added-something nil) + (old-comp-files-queue comp-files-queue) file-list) (dolist (file-or-dir files) (cond ((file-directory-p file-or-dir) @@ -472,6 +473,8 @@ bytecode definition was not changed in the meantime)." ;; compilation, so update `comp-files-queue' to reflect that. (unless (or (null load) (eq load (cdr entry))) + ;; IIUC, this is a non-destructive version of + ;; (setcdr entry load)? (setf comp-files-queue (cl-loop for i in comp-files-queue with old = (car entry) @@ -494,6 +497,9 @@ bytecode definition was not changed in the meantime)." out-filename))))))) ;; Perhaps nothing passed `native--compile-async-skip-p'? (when (and added-something + ;; If the queue was already non-empty, then we already + ;; in the middle of processing the queue. + (null old-comp-files-queue) ;; Don't start if there's one already running. (zerop (comp--async-runnings))) (comp--run-async-workers))))