changeset 74979:2711fe24b0e3

(backup-buffer): Show entire backup file name in message. (make-backup-file-name-1): Precompute abs name but don't lose the relative name.
author Richard M. Stallman <rms@gnu.org>
date Sat, 30 Dec 2006 06:28:57 +0000
parents 750801c2d9b6
children 2a6c900770bc
files lisp/files.el
diffstat 1 files changed, 10 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/files.el	Sat Dec 30 06:27:30 2006 +0000
+++ b/lisp/files.el	Sat Dec 30 06:28:57 2006 +0000
@@ -3031,7 +3031,7 @@
 				       (convert-standard-filename
 					"~/%backup%~")))
 		     (message "Cannot write backup file; backing up in %s"
-			      (file-name-nondirectory backupname))
+			      backupname)
 		     (sleep-for 1)
 		     (backup-buffer-copy real-file-name backupname modes)))
 		  (setq buffer-backed-up t)
@@ -3227,7 +3227,7 @@
 (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 abs-backup-directory)
     (while alist
       (setq elt (pop alist))
       (if (string-match (car elt) file)
@@ -3237,12 +3237,14 @@
     ;; file's directory.  By expanding explicitly here, we avoid
     ;; depending on default-directory.
     (if backup-directory
-	(setq backup-directory (expand-file-name backup-directory
-						 (file-name-directory file))))
-    (if (and backup-directory (not (file-exists-p backup-directory)))
+	(setq abs-backup-directory
+	      (expand-file-name backup-directory
+				(file-name-directory file))))
+    (if (and abs-backup-directory (not (file-exists-p abs-backup-directory)))
 	(condition-case nil
-	    (make-directory backup-directory 'parents)
-	  (file-error (setq backup-directory nil))))
+	    (make-directory abs-backup-directory 'parents)
+	  (file-error (setq backup-directory nil
+			    abs-backup-directory nil))))
     (if (null backup-directory)
 	file
       (if (file-name-absolute-p backup-directory)
@@ -3273,9 +3275,7 @@
 	      (replace-regexp-in-string "!" "!!" file))
 	     backup-directory))
 	(expand-file-name (file-name-nondirectory file)
-			  (file-name-as-directory
-			   (expand-file-name backup-directory
-					     (file-name-directory file))))))))
+			  (file-name-as-directory abs-backup-directory))))))
 
 (defun backup-file-name-p (file)
   "Return non-nil if FILE is a backup file name (numeric or not).