Next: File Names, Previous: Changing File Names and Attributes, Up: Files [Contents][Index]
After Emacs changes a file, there are two reasons the changes might not survive later failures of power or media, both having to do with efficiency. First, the operating system might alias written data with data already stored elsewhere on secondary storage until one file or the other is later modified; this will lose both files if the only copy on secondary storage is lost due to media failure. Second, the operating system might not write data to secondary storage immediately, which will lose the data if power is lost or if there is a media failure.
Although both sorts of failures can largely be avoided by a suitably
configured system, such systems are typically more expensive or
less efficient. In lower-end systems, to survive media failure you
can copy the file to a different device, and to survive a power
failure (or be immediately notified of a media failure) you can use
the write-region
function with the
write-region-inhibit-fsync
variable set to nil
.
Although this variable is ordinarily t
because that can
significantly improve performance, it may make sense to temporarily
bind it to nil
if using Emacs to implement database-like
transactions that survive power failure on lower-end systems.
See Writing to Files.
On some platforms when Emacs changes a file other processes might not
be notified of the change immediately. Setting
write-region-inhibit-fsync
to nil
may improve
notification speed in this case, though there are no guarantees.