aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1992-09-12 08:44:18 +0000
committerRichard M. Stallman1992-09-12 08:44:18 +0000
commit65864ae07e2adcf0de133bfb626e2f5091c03cbb (patch)
tree6a85a2a1fcb09339419f153088add76cb9b00478
parente2b40c238ee71ab58423b661cde0e6fb7789284a (diff)
downloademacs-65864ae07e2adcf0de133bfb626e2f5091c03cbb.tar.gz
emacs-65864ae07e2adcf0de133bfb626e2f5091c03cbb.zip
*** empty log message ***
-rw-r--r--lisp/files.el25
1 files changed, 19 insertions, 6 deletions
diff --git a/lisp/files.el b/lisp/files.el
index 1a15792c92c..07c2d2c301e 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -787,11 +787,16 @@ the modes of the new file to agree with the old modes."
787 (let ((attr (file-attributes real-file-name))) 787 (let ((attr (file-attributes real-file-name)))
788 (or (nth 9 attr) 788 (or (nth 9 attr)
789 (/= (nth 2 attr) (user-uid)))))) 789 (/= (nth 2 attr) (user-uid))))))
790 (copy-file real-file-name backupname t t) 790 (condition-case ()
791; rename-file should delete old backup. 791 (copy-file real-file-name backupname t t)
792; (condition-case () 792 (file-error
793; (delete-file backupname) 793 ;; If copying fails because file BACKUPNAME
794; (file-error nil)) 794 ;; is not writable, delete that file and try again.
795 (if (and (file-exists-p backupname)
796 (not (file-writable-p backupname)))
797 (delete-file backupname))
798 (copy-file real-file-name backupname t t)))
799 ;; rename-file should delete old backup.
795 (rename-file real-file-name backupname t) 800 (rename-file real-file-name backupname t)
796 (setq setmodes (file-modes backupname))) 801 (setq setmodes (file-modes backupname)))
797 (file-error 802 (file-error
@@ -799,7 +804,15 @@ the modes of the new file to agree with the old modes."
799 (setq backupname (expand-file-name "~/%backup%~")) 804 (setq backupname (expand-file-name "~/%backup%~"))
800 (message "Cannot write backup file; backing up in ~/%%backup%%~") 805 (message "Cannot write backup file; backing up in ~/%%backup%%~")
801 (sleep-for 1) 806 (sleep-for 1)
802 (copy-file real-file-name backupname t t))) 807 (condition-case ()
808 (copy-file real-file-name backupname t t)
809 (file-error
810 ;; If copying fails because file BACKUPNAME
811 ;; is not writable, delete that file and try again.
812 (if (and (file-exists-p backupname)
813 (not (file-writable-p backupname)))
814 (delete-file backupname))
815 (copy-file real-file-name backupname t t)))))
803 (setq buffer-backed-up t) 816 (setq buffer-backed-up t)
804 ;; Now delete the old versions, if desired. 817 ;; Now delete the old versions, if desired.
805 (if delete-old-versions 818 (if delete-old-versions