]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/files.el (file-backup-file-names): Don't burp if dir doesn't exist
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 27 Sep 2022 19:10:47 +0000 (15:10 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Tue, 27 Sep 2022 19:10:47 +0000 (15:10 -0400)
lisp/files.el

index 1e1ec6127de08254c347906b264303cba431d27a..b953961aa18164926a6477eb752f1f8fa029b922 100644 (file)
@@ -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.