GNU bug report logs - #17012
[3 PATCHES] Whitespace cleanup : Replace code-alignment tabs with spaces.

Previous Next

Package: grep;

Reported by: behoffski <behoffski <at> grouse.com.au>

Date: Fri, 14 Mar 2014 10:04:01 UTC

Severity: normal

Tags: notabug, patch

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


Message #17 received at 17012 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Bruce Dubbs <bruce.dubbs <at> gmail.com>
Cc: 17012 <17012 <at> debbugs.gnu.org>, Paul Eggert <eggert <at> cs.ucla.edu>
Subject: Re: bug#17012: [3 PATCHES] Whitespace cleanup : Replace
 code-alignment tabs with spaces.
Date: Fri, 14 Mar 2014 21:04:14 -0700
On Fri, Mar 14, 2014 at 11:58 AM, Bruce Dubbs <bruce.dubbs <at> gmail.com> wrote:
> Jim Meyering wrote:
>>
>> On Fri, Mar 14, 2014 at 7:36 AM, Paul Eggert <eggert <at> cs.ucla.edu> wrote:
>>>
>>> behoffski wrote:
>>>>
>>>>
>>>> One easy way to spot tab characters in C sources
>>>
>>>
>>>
>>> This is grep, right?  So we should use "grep '  '".
>>>
>>> Jim Meyering has the strongest feeling about tabs, so I assume he'll pick
>>> this one up.
>>
>>
>> Hi Brenton,
>>
>> I do indeed have strong feelings about tabs :-)
>> Like remove all leading ones, and any TAB-after-space.
>> [rules to enforce that are in maint.mk and cfg.mk]
>> However, a few times when a crusade led me to do
>> what you're proposing and eliminate all of them, I later realized
>> that I found value in TAB-aligned comments, and actually regretted
>> performing that particular TAB->SP+ conversion.
>>
>> On a code normalization front, I am inclined to fully automate the
>> process, and have spent time (though not recently) trying to find
>> the combination of settings in the uncrustify tool that recreate the
>> style we use in a few projects. If you feel like pursuing this, please
>> look at uncrustify and see if you can minimize the changes required
>> to move grep to something uncrustify-generated.
>>
>> Bottom line, I'm not terribly keen on changing comment-aligning
>> tabs to spaces.
>
>
> Tabs in code are indeed evil.  Different users have different tab stops.
> I would convert *all* tabs to spaces and add to each file:
>
> /* -*- tab-width:8; intent-tabs-mode:nil;  -*- */
> /* ex: set tabstop=8 expandtab: */

For the record, I think that such comments should be made unnecessary.
I.e., maintain coding standards with enough automated infrastructure
that that type of crutch is not required.  See the guidelines in coreutils'
HACKING file.  Speaking of which, grep's HACKING needs a refresher.

> A lot of people make a lot of effort to make their code look good.  Then
> someone makes a change and uses a different tab setting and makes it look
> ugly, either in a pager or an editor.
>
> Bottom line is to not permit patches with tabs.
>
>   -- Bruce Dubbs
>      linuxfromscratch.org
>
> P.S.  There was a considerable amount of research in the 1980s that
> investigated cognitive interpretation of code at different tab stops. The
> general conclusion was that between 2 and 4 spaces maximizes comprehension.

That is why we impose the existing no-TAB rules.
The few remaining ones, for comment alignment, not code alignment,
are less problematic.




This bug report was last modified 11 years and 53 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.