[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs/lisp files.el ChangeLog
From: |
Karl Fogel |
Subject: |
[Emacs-diffs] emacs/lisp files.el ChangeLog |
Date: |
Sat, 29 Nov 2008 19:04:18 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Changes by: Karl Fogel <kfogel> 08/11/29 19:04:17
Modified files:
lisp : files.el ChangeLog
Log message:
* emacs-cvs/lisp/files.el
(break-hardlink-on-save): New variable.
(basic-save-buffer-2): Honor new variable break-hardlink-on-save.
(file-precious-flag): Mention it in doc string.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/files.el?cvsroot=emacs&r1=1.1019&r2=1.1020
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.14880&r2=1.14881
Patches:
Index: files.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/files.el,v
retrieving revision 1.1019
retrieving revision 1.1020
diff -u -b -r1.1019 -r1.1020
--- files.el 24 Nov 2008 19:13:58 -0000 1.1019
+++ files.el 29 Nov 2008 19:04:14 -0000 1.1020
@@ -243,10 +243,29 @@
This feature is advisory: for example, if the directory in which the
file is being saved is not writeable, Emacs may ignore a non-nil value
-of `file-precious-flag' and write directly into the file."
+of `file-precious-flag' and write directly into the file.
+
+See also: `break-hardlink-on-save'."
:type 'boolean
:group 'backup)
+(defcustom break-hardlink-on-save nil
+ "Non-nil means when saving a file that exists under several names
+(i.e., has multiple hardlinks), break the hardlink associated with
+`buffer-file-name' and write to a new file, so that the other
+instances of the file are not affected by the save.
+
+If `buffer-file-name' refers to a symlink, do not break the symlink.
+
+Unlike `file-precious-flag', `break-hardlink-on-save' is not advisory.
+For example, if the directory in which a file is being saved is not
+itself writeable, then error instead of saving in some
+hardlink-nonbreaking way.
+
+See also `backup-by-copying' and `backup-by-copying-when-linked'."
+ :type 'boolean
+ :group 'files)
+
(defcustom version-control nil
"Control use of version numbers for backup files.
When t, make numeric backup versions unconditionally.
@@ -4164,10 +4183,16 @@
(error "Attempt to save to a file which you aren't allowed to
write"))))))
(or buffer-backed-up
(setq setmodes (backup-buffer)))
- (let ((dir (file-name-directory buffer-file-name)))
- (if (and file-precious-flag
- (file-writable-p dir))
- ;; If file is precious, write temp name, then rename it.
+ (let* ((dir (file-name-directory buffer-file-name))
+ (dir-writable (file-writable-p dir)))
+ (if (or (and file-precious-flag dir-writable)
+ (and break-hardlink-on-save
+ (> (file-nlinks buffer-file-name) 1)
+ (or dir-writable
+ (error (concat (format
+ "Directory %s write-protected; " dir)
+ "cannot break hardlink when saving")))))
+ ;; Write temp name, then rename it.
;; This requires write access to the containing dir,
;; which is why we don't try it if we don't have that access.
(let ((realname buffer-file-name)
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.14880
retrieving revision 1.14881
diff -u -b -r1.14880 -r1.14881
--- ChangeLog 29 Nov 2008 18:07:15 -0000 1.14880
+++ ChangeLog 29 Nov 2008 19:04:15 -0000 1.14881
@@ -1,3 +1,9 @@
+2008-11-27 Karl Fogel <address@hidden>
+
+ * files.el (break-hardlink-on-save): New variable.
+ (basic-save-buffer-2): Honor new variable break-hardlink-on-save.
+ (file-precious-flag): Mention it in doc string.
+
2008-11-29 Miles Bader <address@hidden>
* minibuffer.el (minibuffer-confirm-exit-commands): New variable.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs/lisp files.el ChangeLog,
Karl Fogel <=