From df1dbaf121703aebae83d2725b7aed8b961f2913 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Fri, 30 Jul 2021 14:58:25 +0200 Subject: [PATCH] Make fileloop skip missing files * lisp/fileloop.el (fileloop-next-file): If a file doesn't exist, skip to the next one (bug#44979). --- etc/NEWS | 3 +++ lisp/fileloop.el | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/etc/NEWS b/etc/NEWS index d378a818909..36dc98d8c09 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2340,6 +2340,9 @@ This command, called interactively, toggles the local value of ** Miscellaneous +--- +*** fileloop will now skip missing files instead of signalling an error. + +++ *** ".dir-locals.el" now supports setting 'auto-mode-alist'. The new 'auto-mode-alist' specification in ".dir-locals.el" files can diff --git a/lisp/fileloop.el b/lisp/fileloop.el index 8a2755d69a5..45b9cea9397 100644 --- a/lisp/fileloop.el +++ b/lisp/fileloop.el @@ -120,7 +120,10 @@ operating on the next file and nil otherwise." (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)))) new))) (defun fileloop-continue () -- 2.39.2