[Libvir] proposal: remove contradictory indentation directive
jim at meyering.net
Wed Apr 9 12:43:22 UTC 2008
Dave Leskovec <dlesko at linux.vnet.ibm.com> wrote:
> This is a repost of the start container support. Changes from the last version:
> + * Local variables:
> + * indent-tabs-mode: nil
> + * c-indent-level: 4
> + * c-basic-offset: 4
> + * tab-width: 4
> + * End:
> + */
Please don't add the "tab-width: 4" specifier.
Specifying a tab-width at all in a new file with "indent-tabs-mode: nil"
is a contradiction. The latter says there should be no TABs, yet
the former says "when there are, give them width 4." Coding style
guidelines are universal in their recommendations to stick with 8-byte
TAB stops, independent of whether you actually use TAB or spaces.
Just yesterday I experienced first hand how adding code with existing
8-byte tab stops to a file with settings like the above mangles the
indentation of the new code.
FYI, a better approach would be to ensure that TAB is never used
for indentation in a file with "indent-tabs-mode: nil".
Both directives are in over 70 files, and I propose to straighten things
out. There are many instances of invalid and misleading indentation,
in part because of this sort of mix-up. To give an idea of the scope,
while 77 files have those settings, removing 'tab-width: 4' would only
affect those that use TABs for indentation in spite of "indent-tabs-mode:
nil" (perhaps added via copy/paste, or added with a non-emacs editor).
Many distro-provided versions of Vim do not honor :se-style settings,
due to security concerns.
Here are counts of lines with TAB indentation in those 77 files.
Each TAB would have to be changed to 4 or 8 spaces, depending
on context. That'd be the minimal change. An alternative
is simply to filter each of these files through indent with
$ git grep -l tab-width:|xargs grep -c '^ '|grep -v :0
More information about the libvir-list