[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

C/C++ mode feature I badly want... (non-persistent indentation)

From: S Boucher
Subject: C/C++ mode feature I badly want... (non-persistent indentation)
Date: Tue, 13 Nov 2012 15:32:32 -0800 (PST)

I seem to often run into code with what I call random indentation.

Because it is in source control, it's a can of worm to re-indent everything and submit the code properly formatted (just makes it harder to look at history afterward, and it doesn't help when people mess the formatting again after...)

(let ((non-persistent-formatting t))
   (indent-region (point-min) (point-max)))

Would indent the lines, but instead of actually changing the buffer, it would put a display property over the leading white spaces, where the text in the property corresponds to the correct indentation.

The rest of the time, (when non-persistent-formatting is nil), then it removes the display property on the leading white spaces, and modifies the line the normal way.

In this way, I can actually understand the file without causing chaos in the source repository.

I think that would be a killer feature.  That's my .02$.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]