[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/files.el
From: |
Richard M. Stallman |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/files.el |
Date: |
Tue, 23 Jul 2002 15:23:08 -0400 |
Index: emacs/lisp/files.el
diff -c emacs/lisp/files.el:1.596 emacs/lisp/files.el:1.597
*** emacs/lisp/files.el:1.596 Sat Jul 20 18:02:45 2002
--- emacs/lisp/files.el Tue Jul 23 15:23:08 2002
***************
*** 2326,2338 ****
(defun backup-buffer ()
"Make a backup of the disk file visited by the current buffer, if
appropriate.
This is normally done before saving the buffer the first time.
- If the value is non-nil, it is the result of `file-modes' on the original
- file; this means that the caller, after saving the buffer, should change
- the modes of the new file to agree with the old modes.
A backup may be done by renaming or by copying; see documentation of
variable `make-backup-files'. If it's done by renaming, then the file is
! no longer accessible under its old name."
(if (and make-backup-files (not backup-inhibited)
(not buffer-backed-up)
(file-exists-p buffer-file-name)
--- 2326,2342 ----
(defun backup-buffer ()
"Make a backup of the disk file visited by the current buffer, if
appropriate.
This is normally done before saving the buffer the first time.
A backup may be done by renaming or by copying; see documentation of
variable `make-backup-files'. If it's done by renaming, then the file is
! no longer accessible under its old name.
!
! The value is non-nil after a backup was made by renaming.
! It has the form (MODES . BACKUPNAME).
! MODES is the result of `file-modes' on the original
! file; this means that the caller, after saving the buffer, should change
! the modes of the new file to agree with the old modes.
! BACKUPNAME is the backup file name, which is the old file renamed."
(if (and make-backup-files (not backup-inhibited)
(not buffer-backed-up)
(file-exists-p buffer-file-name)
***************
*** 2386,2392 ****
(copy-file real-file-name backupname t t)))
;; rename-file should delete old backup.
(rename-file real-file-name backupname t)
! (setq setmodes (file-modes backupname)))
(file-error
;; If trouble writing the backup, write it in ~.
(setq backupname (expand-file-name
--- 2390,2397 ----
(copy-file real-file-name backupname t t)))
;; rename-file should delete old backup.
(rename-file real-file-name backupname t)
! (setq setmodes
! (cons (file-modes backupname) backupname)))
(file-error
;; If trouble writing the backup, write it in ~.
(setq backupname (expand-file-name
***************
*** 2882,2888 ****
(nthcdr 10 (file-attributes buffer-file-name)))
(if setmodes
(condition-case ()
! (set-file-modes buffer-file-name setmodes)
(error nil))))
;; If the auto-save file was recent before this command,
;; delete it now.
--- 2887,2893 ----
(nthcdr 10 (file-attributes buffer-file-name)))
(if setmodes
(condition-case ()
! (set-file-modes buffer-file-name (car setmodes))
(error nil))))
;; If the auto-save file was recent before this command,
;; delete it now.
***************
*** 2895,2907 ****
;; This does the "real job" of writing a buffer into its visited file
;; and making a backup file. This is what is normally done
;; but inhibited if one of write-file-functions returns non-nil.
! ;; It returns a value to store in setmodes.
(defun basic-save-buffer-1 ()
(if save-buffer-coding-system
(let ((coding-system-for-write save-buffer-coding-system))
(basic-save-buffer-2))
(basic-save-buffer-2)))
(defun basic-save-buffer-2 ()
(let (tempsetmodes setmodes)
(if (not (file-writable-p buffer-file-name))
--- 2900,2913 ----
;; This does the "real job" of writing a buffer into its visited file
;; and making a backup file. This is what is normally done
;; but inhibited if one of write-file-functions returns non-nil.
! ;; It returns a value (MODES . BACKUPNAME), like backup-buffer.
(defun basic-save-buffer-1 ()
(if save-buffer-coding-system
(let ((coding-system-for-write save-buffer-coding-system))
(basic-save-buffer-2))
(basic-save-buffer-2)))
+ ;; This returns a value (MODES . BACKUPNAME), like backup-buffer.
(defun basic-save-buffer-2 ()
(let (tempsetmodes setmodes)
(if (not (file-writable-p buffer-file-name))
***************
*** 2960,2966 ****
;; Since we have created an entirely new file
;; and renamed it, make sure it gets the
;; right permission bits set.
! (setq setmodes (or setmodes (file-modes buffer-file-name)))
;; We succeeded in writing the temp file,
;; so rename it.
(rename-file tempname buffer-file-name t))
--- 2966,2973 ----
;; Since we have created an entirely new file
;; and renamed it, make sure it gets the
;; right permission bits set.
! (setq setmodes (or setmodes (cons (file-modes buffer-file-name)
! buffer-file-name)))
;; We succeeded in writing the temp file,
;; so rename it.
(rename-file tempname buffer-file-name t))
***************
*** 2970,2979 ****
;; (setmodes is set) because that says we're superseding.
(cond ((and tempsetmodes (not setmodes))
;; Change the mode back, after writing.
! (setq setmodes (file-modes buffer-file-name))
! (set-file-modes buffer-file-name (logior setmodes 128))))
! (write-region (point-min) (point-max)
! buffer-file-name nil t buffer-file-truename)))
setmodes))
(defun save-some-buffers (&optional arg pred)
--- 2977,2994 ----
;; (setmodes is set) because that says we're superseding.
(cond ((and tempsetmodes (not setmodes))
;; Change the mode back, after writing.
! (setq setmodes (cons (file-modes buffer-file-name)
buffer-file-name))
! (set-file-modes buffer-file-name (logior (car setmodes) 128))))
! (let (success)
! (unwind-protect
! (progn
! (write-region (point-min) (point-max)
! buffer-file-name nil t buffer-file-truename)
! (setq success t))
! ;; If we get an error writing the new file, and we made
! ;; the backup by renaming, undo the backing-up.
! (and setmodes (not success)
! (rename-file (cdr setmodes) buffer-file-name))))))
setmodes))
(defun save-some-buffers (&optional arg pred)
- [Emacs-diffs] Changes to emacs/lisp/files.el, Richard M. Stallman, 2002/07/02
- [Emacs-diffs] Changes to emacs/lisp/files.el, Francesco Potortì, 2002/07/05
- [Emacs-diffs] Changes to emacs/lisp/files.el, Kim F. Storm, 2002/07/08
- [Emacs-diffs] Changes to emacs/lisp/files.el, Richard M. Stallman, 2002/07/08
- [Emacs-diffs] Changes to emacs/lisp/files.el, Kenichi Handa, 2002/07/08
- [Emacs-diffs] Changes to emacs/lisp/files.el, Pavel JanÃk, 2002/07/11
- [Emacs-diffs] Changes to emacs/lisp/files.el, Richard M. Stallman, 2002/07/14
- [Emacs-diffs] Changes to emacs/lisp/files.el, Andre Spiegel, 2002/07/16
- [Emacs-diffs] Changes to emacs/lisp/files.el, Richard M. Stallman, 2002/07/20
- [Emacs-diffs] Changes to emacs/lisp/files.el,
Richard M. Stallman <=
- [Emacs-diffs] Changes to emacs/lisp/files.el, Kenichi Handa, 2002/07/26
- [Emacs-diffs] Changes to emacs/lisp/files.el, Richard M. Stallman, 2002/07/27
- [Emacs-diffs] Changes to emacs/lisp/files.el, Kenichi Handa, 2002/07/29