2014/02/01: Long lines and trailing whitespace... (in emacs)

...are a nuisance in coding and a constant source of coding-style discussions. Similarly for tabs versus spaces and trailing empty lines. The usual convention (and the one that fits best with history and merging) is that you're not supposed to add new violations, but keep existing ones untouched—unless you touch that part of the code anyway. As the latter is a semantical consideration, the best support a text editor can provide you with in that matter is to keep you aware of what you're doing. For emacs, the mode I found most useful is whitespace. The relevant part of my .emacs is as follows, but it is definitely worth reading the full documentation of the whitespace-style variable, as it contains lots or useful options.


(require 'whitespace)
(setq whitespace-style '(face lines-tail trailing tabs empty))
(global-whitespace-mode t)
download



Cross-referenced by: