[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How many spaces a tab is worth
I suggest this model for comparing indentation of lines L1 and L2.
TAB is only allowed at the beginning of a line.
Assume line L1 starts with T1 tabs followed by S1 spaces,
and line L2 starts with T2 tabs followed by S2 spaces.
For the indentation of L1 and L2 to be comparable, either:
(= T1 T2), in which case compare S1 and S2; or:
(and (zero? S1) (zero? S2)), in which case compare T1 and T2.
Other case are erroneous, since we cannot consistently
Furthermore, in the case (= T1 T2), if either (= S1 (+ S2 1))
or (= (+ S1 1) S2) that case is also erroneous, since a difference
of a single space is too likely to be a typo.