diff options
| author | Richard M. Stallman | 2005-09-15 12:47:10 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2005-09-15 12:47:10 +0000 |
| commit | 81a3597738afebfddc5be09ed744abfad7b42cba (patch) | |
| tree | f01514e994e45456779e70621f6d728bfe747add | |
| parent | 3af0867d70af94e7bfca777c259f05ec3aa41219 (diff) | |
| download | emacs-81a3597738afebfddc5be09ed744abfad7b42cba.tar.gz emacs-81a3597738afebfddc5be09ed744abfad7b42cba.zip | |
(Saving Commands): New node, broken out of Saving.
(Customize Save): New node, broken out of Saving.
Clarify effect of write-region-inhibit-fsync.
(Misc File Ops): Say write-region-inhibit-fsync affects write-region.
| -rw-r--r-- | man/files.texi | 89 |
1 files changed, 51 insertions, 38 deletions
diff --git a/man/files.texi b/man/files.texi index b8e8d60c2f9..cd8360bf8f9 100644 --- a/man/files.texi +++ b/man/files.texi | |||
| @@ -366,6 +366,21 @@ variables defined for that file (@pxref{File Variables}). | |||
| 366 | @dfn{Saving} a buffer in Emacs means writing its contents back into the file | 366 | @dfn{Saving} a buffer in Emacs means writing its contents back into the file |
| 367 | that was visited in the buffer. | 367 | that was visited in the buffer. |
| 368 | 368 | ||
| 369 | @menu | ||
| 370 | * Save Commands:: Commands for saving files. | ||
| 371 | * Backup:: How Emacs saves the old version of your file. | ||
| 372 | * Customize Save:: Customizing the saving of files. | ||
| 373 | * Interlocking:: How Emacs protects against simultaneous editing | ||
| 374 | of one file by two users. | ||
| 375 | * Shadowing: File Shadowing. Copying files to "shadows" automatically. | ||
| 376 | * Time Stamps:: Emacs can update time stamps on saved files. | ||
| 377 | @end menu | ||
| 378 | |||
| 379 | @node Saving Commands | ||
| 380 | @subsection Commands for Saving Files | ||
| 381 | |||
| 382 | These are the commands that relate to saving and writing files. | ||
| 383 | |||
| 369 | @table @kbd | 384 | @table @kbd |
| 370 | @item C-x C-s | 385 | @item C-x C-s |
| 371 | Save the current buffer in its visited file on disk (@code{save-buffer}). | 386 | Save the current buffer in its visited file on disk (@code{save-buffer}). |
| @@ -483,42 +498,6 @@ notifies you of this fact, because it probably indicates a problem caused | |||
| 483 | by simultaneous editing and requires your immediate attention. | 498 | by simultaneous editing and requires your immediate attention. |
| 484 | @xref{Interlocking,, Simultaneous Editing}. | 499 | @xref{Interlocking,, Simultaneous Editing}. |
| 485 | 500 | ||
| 486 | @vindex require-final-newline | ||
| 487 | If the value of the variable @code{require-final-newline} is | ||
| 488 | @code{t}, Emacs silently puts a newline at the end of any file that | ||
| 489 | doesn't already end in one, every time a file is saved or written. If | ||
| 490 | the value is @code{visit}, Emacs adds a newline at the end of any file | ||
| 491 | that doesn't have one, just after it visits the file. (This marks the | ||
| 492 | buffer as modified, and you can undo it.) If the value is | ||
| 493 | @code{visit-save}, that means to add newlines both on visiting and on | ||
| 494 | saving. If the value is @code{nil}, Emacs leaves the end of the file | ||
| 495 | unchanged; if it's neither @code{nil} nor @code{t}, Emacs asks you | ||
| 496 | whether to add a newline. The default is @code{nil}. | ||
| 497 | |||
| 498 | @vindex mode-require-final-newline | ||
| 499 | Many major modes are designed for specific kinds of files that are | ||
| 500 | always supposed to end in newlines. These major modes set the | ||
| 501 | variable @code{require-final-newline} according to | ||
| 502 | @code{mode-require-final-newline}. By setting the latter variable, | ||
| 503 | you can control how these modes handle final newlines. | ||
| 504 | |||
| 505 | @vindex write-region-inhibit-fsync | ||
| 506 | When Emacs saves a file to disk, it issues an @code{fsync} call to the | ||
| 507 | operating system to ensure that your data has indeed reached the media. | ||
| 508 | This is important for safety if the system crashes or in case of power | ||
| 509 | outage. However, it can be disruptive on laptops using power saving | ||
| 510 | because it forces the system to spin up the drive each time you save a | ||
| 511 | file; the variable @code{write-region-inhibit-fsync} disables this | ||
| 512 | synchronization. This may result in data loss, use with care! | ||
| 513 | |||
| 514 | @menu | ||
| 515 | * Backup:: How Emacs saves the old version of your file. | ||
| 516 | * Interlocking:: How Emacs protects against simultaneous editing | ||
| 517 | of one file by two users. | ||
| 518 | * Shadowing: File Shadowing. Copying files to "shadows" automatically. | ||
| 519 | * Time Stamps:: Emacs can update time stamps on saved files. | ||
| 520 | @end menu | ||
| 521 | |||
| 522 | @node Backup | 501 | @node Backup |
| 523 | @subsection Backup Files | 502 | @subsection Backup Files |
| 524 | @cindex backup file | 503 | @cindex backup file |
| @@ -725,6 +704,38 @@ typically break hard links, disconnecting the file name you visited from | |||
| 725 | any alternate names for the same file. This has nothing to do with | 704 | any alternate names for the same file. This has nothing to do with |
| 726 | Emacs---the version control system does it. | 705 | Emacs---the version control system does it. |
| 727 | 706 | ||
| 707 | @node Customize Save | ||
| 708 | @subsection Customizing Saving of Files | ||
| 709 | |||
| 710 | @vindex require-final-newline | ||
| 711 | If the value of the variable @code{require-final-newline} is | ||
| 712 | @code{t}, saving or writing a file silently puts a newline at the end | ||
| 713 | if there isn't already one there. If the value is @code{visit}, Emacs | ||
| 714 | adds a newline at the end of any file that doesn't have one, just | ||
| 715 | after it visits the file. (This marks the buffer as modified, and you | ||
| 716 | can undo it.) If the value is @code{visit-save}, that means to add | ||
| 717 | newlines both on visiting and on saving. If the value is @code{nil}, | ||
| 718 | Emacs leaves the end of the file unchanged; if it's neither @code{nil} | ||
| 719 | nor @code{t}, Emacs asks you whether to add a newline. The default is | ||
| 720 | @code{nil}. | ||
| 721 | |||
| 722 | @vindex mode-require-final-newline | ||
| 723 | Many major modes are designed for specific kinds of files that are | ||
| 724 | always supposed to end in newlines. These major modes set the | ||
| 725 | variable @code{require-final-newline} according to | ||
| 726 | @code{mode-require-final-newline}. By setting the latter variable, | ||
| 727 | you can control how these modes handle final newlines. | ||
| 728 | |||
| 729 | @vindex write-region-inhibit-fsync | ||
| 730 | When Emacs saves a file, it invokes the @code{fsync} system call to | ||
| 731 | force the data immediately out to disk. This is important for safety | ||
| 732 | if the system crashes or in case of power outage. However, it can be | ||
| 733 | disruptive on laptops using power saving, because it requires the disk | ||
| 734 | to spin up each time you save a file. Setting | ||
| 735 | @code{write-region-inhibit-fsync} to a non-@code{nil} value disables | ||
| 736 | this synchronization. Be careful---this means increased risk of data | ||
| 737 | loss. | ||
| 738 | |||
| 728 | @node Interlocking | 739 | @node Interlocking |
| 729 | @subsection Protection against Simultaneous Editing | 740 | @subsection Protection against Simultaneous Editing |
| 730 | 741 | ||
| @@ -3008,8 +3019,10 @@ leaving point unchanged before the contents and the mark after them. | |||
| 3008 | @findex write-region | 3019 | @findex write-region |
| 3009 | @kbd{M-x write-region} is the inverse of @kbd{M-x insert-file}; it | 3020 | @kbd{M-x write-region} is the inverse of @kbd{M-x insert-file}; it |
| 3010 | copies the contents of the region into the specified file. @kbd{M-x | 3021 | copies the contents of the region into the specified file. @kbd{M-x |
| 3011 | append-to-file} adds the text of the region to the end of the specified | 3022 | append-to-file} adds the text of the region to the end of the |
| 3012 | file. @xref{Accumulating Text}. | 3023 | specified file. @xref{Accumulating Text}. The variable |
| 3024 | @code{write-region-inhibit-fsync} applies to these commands, as well | ||
| 3025 | as saving files; see @ref{Customize Save}. | ||
| 3013 | 3026 | ||
| 3014 | @findex delete-file | 3027 | @findex delete-file |
| 3015 | @cindex deletion (of files) | 3028 | @cindex deletion (of files) |