indent style for D

H. S. Teoh hsteoh at quickfur.ath.cx
Sun Jan 29 19:27:48 PST 2012


On Mon, Jan 30, 2012 at 01:57:43AM +0100, Timon Gehr wrote:
> More practical than requiring all source files to be saved without
> formatting:
> 
> - Upon opening a file, the editor looks for a style sheet in the
> same directory. If there is no such style sheet, it automatically
> deduces the style from the code, falling back to the local
> preferences.
> 
> - Then it acts as you propose.
> 
> - And when saving, it automatically formats the source code in the
> deduced format.

The problem with autoformatting on save is that it interacts badly with
revision control systems. You could end up with lots of noisy diffs
mostly involving changes in whitespace. By enforcing a fixed formatting,
whether it's everything-on-a-line or delete all unnecessary whitespace
but leave newlines intact, you ensure that diffs generated by the
revision control system will not include whitespace noise.


T

-- 
Debian GNU/Linux: Cray on your desktop.


More information about the Digitalmars-d mailing list