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: Fringes, Up: Display


19.9 Useless Whitespace

It is easy to leave unnecessary spaces at the end of a line, or empty lines at the end of a file, without realizing it. In most cases, this trailing whitespace has no effect, but there are special circumstances where it matters.

You can make trailing whitespace at the end of a line visible on the screen by setting the buffer-local variable show-trailing-whitespace to t. Then Emacs displays trailing whitespace in the face trailing-whitespace.

This feature does not apply when point is at the end of the line containing the whitespace. Strictly speaking, that is “trailing whitespace” nonetheless, but displaying it specially in that case looks ugly while you are typing in new text. In this special case, the location of point is enough to show you that the spaces are present.

To delete all trailing whitespace within the current buffer's accessible portion (see Narrowing), type M-x delete-trailing-whitespace <RET>. (This command does not remove the form-feed characters.)

Emacs can indicate unused lines at the end of the window with a small image in the left fringe (see Fringes). The image appears for window lines that do not correspond to any buffer text. Blank lines at the end of the buffer then stand out because they do not have this image in the fringe.

To enable this feature, set the buffer-local variable indicate-empty-lines to a non-nil value. The default value of this variable is controlled by the variable default-indicate-empty-lines; by setting that variable, you can enable or disable this feature for all new buffers. (This feature currently doesn't work on character terminals.)


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