Subject: bug#68678: 29.1; package-recompile-all should skip system packages in package-directory-list

From: Philip Kaludercic <[email-masked]>
Date: Tue, 06 Feb 2024 19:13:14 +0000

Allen Li <[email-masked]> writes:

> On Sun, Jan 28, 2024 at 1:40 PM Philip Kaludercic <[email-masked]>
> wrote:
>>
>> Allen Li <[email-masked]> writes:
>> >
>> > That works for me, though it's possible that someone may want errors
>> > recompiling user packages surfaced directly.
>>
>> That is why I used `with-demoted-errors', which propagates errors if
>> `debug-on-error' is non-nil.  Or do you mean permanently and
>> specifically related to this issue, e.g. in form of a user option.
>
> My bad, yes, `with-demoted-errors' sounds fine to me.  At the risk of
> repeating myself,
> I don't have a use case for surfacing the errors, but I think some
> other users might.

OK, then this is the patch I propse:

>From a6c1e5259d413f3ca488e32f2c38d51353494fc6 Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <[email-masked]>
Date: Tue, 6 Feb 2024 20:12:15 +0100
Subject: [PATCH] Tolerate errors while recompiling all packages

* lisp/emacs-lisp/package.el (package-recompile-all): Demote errors
raised by 'package-recompile'.  (Bug#68678)
---
 lisp/emacs-lisp/package.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 868373f46c2..fe7b10f569a 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -2610,7 +2610,8 @@ package-recompile-all
 are invalid due to changed byte-code, macros or the like."
   (interactive)
   (pcase-dolist (`(_ ,pkg-desc) package-alist)
-    (package-recompile pkg-desc)))
+    (with-demoted-errors "Error while recompiling: %S"
+      (package-recompile pkg-desc))))
 
 ;;;###autoload
 (defun package-autoremove ()
-- 
2.39.2

Any objections?