Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Next: , Previous: Backup, Up: Saving


23.3.3 Customizing Saving of Files

If the value of the variable require-final-newline is t, saving or writing a file silently puts a newline at the end if there isn't already one there. If the value is visit, Emacs adds a newline at the end of any file that doesn't have one, just after it visits the file. (This marks the buffer as modified, and you can undo it.) If the value is visit-save, that means to add newlines both on visiting and on saving. If the value is nil, Emacs leaves the end of the file unchanged; if it's neither nil nor t, Emacs asks you whether to add a newline. The default is nil.

Many major modes are designed for specific kinds of files that are always supposed to end in newlines. These major modes set the variable require-final-newline according to mode-require-final-newline. By setting the latter variable, you can control how these modes handle final newlines.

When Emacs saves a file, it invokes the 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, because it requires the disk to spin up each time you save a file. Setting write-region-inhibit-fsync to a non-nil value disables this synchronization. Be careful—this means increased risk of data loss.


 
 
  Published under the terms of the GNU General Public License Design by Interspire