changeset 47326:fc1a7db42eee

(make-backup-file-name-1): When make-directory fails, ignore backup-directory-alist. (make-directory): Expand DIR before looking for handler.
author Richard M. Stallman <rms@gnu.org>
date Mon, 09 Sep 2002 19:23:37 +0000
parents dd0eb98ebb2e
children 94b3c6a53104
files lisp/files.el
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/files.el	Mon Sep 09 19:20:27 2002 +0000
+++ b/lisp/files.el	Mon Sep 09 19:23:37 2002 +0000
@@ -2574,18 +2574,18 @@
 (defun make-backup-file-name-1 (file)
   "Subroutine of `make-backup-file-name' and `find-backup-file-name'."
   (let ((alist backup-directory-alist)
-	elt backup-directory)
+	elt backup-directory failed)
     (while alist
       (setq elt (pop alist))
       (if (string-match (car elt) file)
 	  (setq backup-directory (cdr elt)
 		alist nil)))
+    (if (and backup-directory (not (file-exists-p backup-directory)))
+	(condition-case nil
+	    (make-directory backup-directory 'parents)
+	  (file-error (setq backup-directory nil))))
     (if (null backup-directory)
 	file
-      (unless (file-exists-p backup-directory)
-	(condition-case nil
-	    (make-directory backup-directory 'parents)
-	  (file-error file)))
       (if (file-name-absolute-p backup-directory)
 	  (progn
 	    (when (memq system-type '(windows-nt ms-dos))
@@ -3199,6 +3199,9 @@
    (list (read-file-name "Make directory: " default-directory default-directory
 			 nil nil)
 	 t))
+  ;; If default-directory is a remote directory,
+  ;; make sure we find its make-directory handler.
+  (setq dir (expand-file-name dir))
   (let ((handler (find-file-name-handler dir 'make-directory)))
     (if handler
 	(funcall handler 'make-directory dir parents)