Subject: bug#79356: 31.0.50; 'C-x p r' fails when there are .gpg files EPA can't decrypt

From: Stefan Monnier <[email-masked]>
Date: Tue, 02 Sep 2025 10:00:31 -0400

> From 056938803a5502f8427c6e97a74fa5b29a1d60c9 Mon Sep 17 00:00:00 2001
> From: Sean Whitton <[email-masked]>
> Date: Tue, 2 Sep 2025 13:42:26 +0100
> Subject: [PATCH] fileloop-next-file: Convert file-error to warnings
>
> * lisp/fileloop.el (fileloop-next-file): Catch file-error and
> convert to a delayed warning (bug#79356).
> ---
>  lisp/fileloop.el | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/lisp/fileloop.el b/lisp/fileloop.el
> index d7d2aa7e0d5..903c5cca0a7 100644
> --- a/lisp/fileloop.el
> +++ b/lisp/fileloop.el
> @@ -121,10 +121,16 @@ fileloop-next-file
>          (kill-all-local-variables)
>          (erase-buffer)
>          (setq new next)
> -        (condition-case nil
> +        (condition-case err
>              (insert-file-contents new nil)
>            (file-missing
> -           (fileloop-next-file novisit))))
> +           (fileloop-next-file novisit))
> +          (file-error
> +           ;; See bug#79356 for discussion.
> +           (let ((msg (error-message-string err)))
> +             (unless (string-search new msg)
> +               (setq msg (format "%s, %s" msg new)))
> +             (delay-warning 'file-error msg :error)))))
>        new)))

Not sure "<msg>, <new>" is the best syntax (I'd have used "<new>:
<msg>", instead), but that looks good enough to me, thanks.

        Stefan