Next: , Previous: , Up: ファイルの保存   [Contents][Index]


20.3.3 ファイル保存のカスタマイズ

変数require-final-newlineの値がtのとき、ファイルの保存または書き込みにより、ファイルの終端に改行がないときは、何も尋ねずに改行を追加します。値がvisitの場合、Emacsはファイルをvisitした直後に、終端に改行がないファイルの改行を追加します(これによりバッファーは変更されたとマークされます。undoはできません)。値がvisit-saveの場合、Emacsはそのような改行をvisitと保存のときに追加します。値がnilの場合、Emacsはファイルの終端を変更しません。それ以外の非nil値は、改行を追加するかをEmacsが尋ねることを意味します。デフォルトはnilです。

ファイルの終端に常に改行があると想定する、特定の種類のファイルのためにデザインされたメジャーモードがいくつかあります。そのようなメジャーモードは、変数require-final-newlineに、変数mode-require-final-newlineの値(デフォルトはt)をセットします。後者の変数の値をセットすることにより、これらのモードが終端の改行を取り扱う方法を制御できます。

このオプションが非nilでシンボリックリンクを介してファイルをvisitすると、バッファー保持時にlEmacsはシンボリックリンクを解除して、file-precious-flagの値が非nilなら、そのシンボリックリンクと同じ名前のファイルにバッファーを書き込みます(file-precious-flag in The Emacs Lisp Reference Manualを参照)。シンボリックリンクが指すファイルにバッファーを保存させる(リンクを維持させる)には、変数file-preserve-symlinks-on-savetにカスタマイズしてください。

Normally, when a program writes a file, the operating system briefly caches the file’s data in main memory before committing the data to secondary storage. Although this can greatly improve performance, it risks data loss if the system loses power before committing the cache, and on some platforms other processes might not immediately notice the file’s change.

To lessen this risk, Emacs can invoke the fsync system call after saving a file. Using fsync does not eliminate the risk of data loss or slow notification, partly because many systems do not support fsync properly, and partly because Emacs’s file-saving procedure typically relies also on directory updates that might not survive a crash even if fsync works properly.

The write-region-inhibit-fsync variable controls whether Emacs invokes fsync after saving a file. The variable’s default value is t.

Emacsは自動保存ファイルの書き込みにfsyncを使うことはありません。なぜなら、それらのファイルのデータは、いずれにせよ失われるものだからです。

This page has generated for branch:master, commit:762705fb24fd90db318f2e51c1e762452d26f7e2 to check Japanese translation.