From: Stefan Monnier Date: Tue, 27 Sep 2022 19:10:47 +0000 (-0400) Subject: * lisp/files.el (file-backup-file-names): Don't burp if dir doesn't exist X-Git-Tag: emacs-29.0.90~1856^2~184 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e638aaf6e82aa9eeb5e5723b995d3295b53fa6c9;p=emacs.git * lisp/files.el (file-backup-file-names): Don't burp if dir doesn't exist --- 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.