final newlines.
@vindex write-region-inhibit-fsync
- When Emacs saves a file, it invokes the @code{fsync} system call to
-force the data immediately out to disk. This is important for safety
-if the system crashes or in case of power outage. However, it can be
-disruptive on laptops using power saving, as it may force a disk
-spin-up each time you save a file. If you accept an increased risk of
-data loss, you can set @code{write-region-inhibit-fsync} to a
-non-@code{nil} value to disable the synchronization.
+ Normally, when a program writes a file, the operating system briefly
+caches the file's data in main memory before committing the data to
+disk. This can greatly improve performance; for example, when running
+on laptops, it can avoid a disk spin-up each time a file is written.
+However, it risks data loss if the operating system crashes before
+committing the cache to disk.
+
+ To lessen this risk, Emacs can invoke the @code{fsync} system call
+after saving a file. Using @code{fsync} does not eliminate the risk
+of data loss, partly because many systems do not implement
+@code{fsync} properly, and partly because Emacs's file-saving
+procedure typically relies also on directory updates that might not
+survive a crash even if @code{fsync} works properly.
+
+ The @code{write-region-inhibit-fsync} variable controls whether
+Emacs invokes @code{fsync} after saving a file. The variable's
+default value is @code{nil} when Emacs is interactive, and @code{t}
+when Emacs runs in batch mode.
+
+ Emacs never uses @code{fsync} when writing auto-save files, as these
+files might lose data anyway.
@node Interlocking
@subsection Protection against Simultaneous Editing
@cindex locking files
When you make the first modification in an Emacs buffer that is
visiting a file, Emacs records that the file is @dfn{locked} by you.
-(It does this by creating a specially-named symbolic link in the same
-directory.) Emacs removes the lock when you save the changes. The
-idea is that the file is locked whenever an Emacs buffer visiting it
-has unsaved changes.
+(It does this by creating a specially-named symbolic link or regular
+file with special contents in the same directory.) Emacs removes the
+lock when you save the changes. The idea is that the file is locked
+whenever an Emacs buffer visiting it has unsaved changes.
@vindex create-lockfiles
You can prevent the creation of lock files by setting the variable
simultaneously under different names.
A lock file cannot be written in some circumstances, e.g., if Emacs
-lacks the system permissions or the system does not support symbolic
-links. In these cases, Emacs can still detect the collision when you
-try to save a file, by checking the file's last-modification date. If
-the file has changed since the last time Emacs visited or saved it,
-that implies that changes have been made in some other way, and will
-be lost if Emacs proceeds with saving. Emacs then displays a warning
-message and asks for confirmation before saving; answer @kbd{yes} to
-save, and @kbd{no} or @kbd{C-g} cancel the save.
+lacks the system permissions or cannot create lock files for some
+other reason. In these cases, Emacs can still detect the collision
+when you try to save a file, by checking the file's last-modification
+date. If the file has changed since the last time Emacs visited or
+saved it, that implies that changes have been made in some other way,
+and will be lost if Emacs proceeds with saving. Emacs then displays a
+warning message and asks for confirmation before saving; answer
+@kbd{yes} to save, and @kbd{no} or @kbd{C-g} cancel the save.
If you are notified that simultaneous editing has already taken
place, one way to compare the buffer to its file is the @kbd{M-x
displayed. If the image can be animated, the command @kbd{RET}
(@code{image-toggle-animation}) starts or stops the animation.
Animation plays once, unless the option @code{image-animate-loop} is
-non-@code{nil}. Currently, Emacs only supports animation in GIF
-files.
+non-@code{nil}.
@cindex ImageMagick support
@vindex imagemagick-enabled-types