diff options
| author | Martin Rudalics | 2007-08-30 08:16:55 +0000 |
|---|---|---|
| committer | Martin Rudalics | 2007-08-30 08:16:55 +0000 |
| commit | 0f39d2c98b50d522e9ebfcfb61b96219a338e7c5 (patch) | |
| tree | b09860ad440c3df703bf01b69374afaa82f34e1e | |
| parent | 1bb1f7d38c25ac81f9173e7735190b7a386e4e27 (diff) | |
| download | emacs-0f39d2c98b50d522e9ebfcfb61b96219a338e7c5.tar.gz emacs-0f39d2c98b50d522e9ebfcfb61b96219a338e7c5.zip | |
(backup-buffer-copy): Try to overwrite old backup first.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/files.el | 28 |
2 files changed, 21 insertions, 12 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a7cbdf407cb..76a6a7c4726 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2007-08-30 Martin Rudalics <rudalics@gmx.at> | ||
| 2 | |||
| 3 | * files.el (backup-buffer-copy): Try to overwrite old backup | ||
| 4 | first. | ||
| 5 | |||
| 1 | 2007-08-29 Martin Rudalics <rudalics@gmx.at> | 6 | 2007-08-29 Martin Rudalics <rudalics@gmx.at> |
| 2 | 7 | ||
| 3 | * repeat.el (repeat): Use last-repeatable-command instead of | 8 | * repeat.el (repeat): Use last-repeatable-command instead of |
diff --git a/lisp/files.el b/lisp/files.el index 69ebf460781..bc482c8f37b 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -3127,18 +3127,22 @@ BACKUPNAME is the backup file name, which is the old file renamed." | |||
| 3127 | ;; loosen them later, whereas it's impossible to close the | 3127 | ;; loosen them later, whereas it's impossible to close the |
| 3128 | ;; time-window of loose permissions otherwise. | 3128 | ;; time-window of loose permissions otherwise. |
| 3129 | (set-default-file-modes ?\700) | 3129 | (set-default-file-modes ?\700) |
| 3130 | (while (condition-case () | 3130 | (when (condition-case nil |
| 3131 | (progn | 3131 | ;; Try to overwrite old backup first. |
| 3132 | (and (file-exists-p to-name) | 3132 | (copy-file from-name to-name t t) |
| 3133 | (delete-file to-name)) | 3133 | (error t)) |
| 3134 | (copy-file from-name to-name nil t) | 3134 | (while (condition-case nil |
| 3135 | nil) | 3135 | (progn |
| 3136 | (file-already-exists t)) | 3136 | (when (file-exists-p to-name) |
| 3137 | ;; The file was somehow created by someone else between | 3137 | (delete-file to-name)) |
| 3138 | ;; `delete-file' and `copy-file', so let's try again. | 3138 | (copy-file from-name to-name nil t) |
| 3139 | ;; rms says "I think there is also a possible race | 3139 | nil) |
| 3140 | ;; condition for making backup files" (emacs-devel 20070821). | 3140 | (file-already-exists t)) |
| 3141 | nil)) | 3141 | ;; The file was somehow created by someone else between |
| 3142 | ;; `delete-file' and `copy-file', so let's try again. | ||
| 3143 | ;; rms says "I think there is also a possible race | ||
| 3144 | ;; condition for making backup files" (emacs-devel 20070821). | ||
| 3145 | nil))) | ||
| 3142 | ;; Reset the umask. | 3146 | ;; Reset the umask. |
| 3143 | (set-default-file-modes umask))) | 3147 | (set-default-file-modes umask))) |
| 3144 | (and modes | 3148 | (and modes |