Subject: bug#44979: project-search fails with file-missing error

From: Lars Ingebrigtsen <[email-masked]>
Date: Fri, 30 Jul 2021 15:00:32 +0200

Dmitry Gutov <[email-masked]> writes:

> Not such what's the best solution, but either all commands which use
> fileloop should pre-filter the list with file-exists-p, or
> fileloop-next-file should skip over nonexistent files. This seems to
> work:
>
> diff --git a/lisp/fileloop.el b/lisp/fileloop.el
> index b778eca8e9..289df6d593 100644
> --- a/lisp/fileloop.el
> +++ b/lisp/fileloop.el
> @@ -120,7 +120,10 @@ fileloop-next-file
>          (kill-all-local-variables)
>          (erase-buffer)
>          (setq new next)
> -        (insert-file-contents new nil))
> +        (condition-case nil
> +            (insert-file-contents new nil)
> +          (file-missing
> +           (fileloop-next-file novisit))))

I think this makes sense, so I've pushed it to Emacs 28.  Eli noted that
there may be libraries using fileloop that doesn't want this behaviour,
but I'm having problems envisioning any.  If this turns out to be a
problem, we can add a variable to allow tweaking this behaviour, but I
think it's premature to add one before it's shown that there's a demand
for one.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no