From e638aaf6e82aa9eeb5e5723b995d3295b53fa6c9 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 27 Sep 2022 15:10:47 -0400 Subject: [PATCH] * lisp/files.el (file-backup-file-names): Don't burp if dir doesn't exist --- lisp/files.el | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/lisp/files.el b/lisp/files.el index 1e1ec6127de..b953961aa18 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -6127,16 +6127,17 @@ recent files are first." (let* ((filename (file-name-sans-versions (make-backup-file-name (expand-file-name filename)))) (dir (file-name-directory filename))) - (sort - (seq-filter - (lambda (candidate) - (and (backup-file-name-p candidate) - (string= (file-name-sans-versions candidate) filename))) - (mapcar - (lambda (file) - (concat dir file)) - (file-name-all-completions (file-name-nondirectory filename) dir))) - #'file-newer-than-file-p))) + (when (file-directory-p dir) + (sort + (seq-filter + (lambda (candidate) + (and (backup-file-name-p candidate) + (string= (file-name-sans-versions candidate) filename))) + (mapcar + (lambda (file) + (concat dir file)) + (file-name-all-completions (file-name-nondirectory filename) dir))) + #'file-newer-than-file-p)))) (defun rename-uniquely () "Rename current buffer to a similar name not already taken. -- 2.39.2