proposal: remove contradictory indentation directive

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

 



Dave Leskovec <dlesko@xxxxxxxxxxxxxxxxxx> 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
appropriate options.

  $ git grep -l tab-width:|xargs grep -c '^	'|grep -v :0
  proxy/libvirt_proxy.c:316
  python/libvir.c:17
  src/buf.c:27
  src/conf.c:161
  src/conf.h:7
  src/driver.h:130
  src/internal.h:9
  src/libvirt.c:81
  src/lxc_conf.c:17
  src/openvz_driver.h:6
  src/proxy_internal.c:122
  src/proxy_internal.h:13
  src/qemu_conf.c:1
  src/qemu_driver.c:5
  src/qparams.h:1
  src/remote_internal.c:4
  src/stats_linux.h:3
  src/virsh.c:33
  src/virterror.c:166
  src/xen_internal.c:105
  src/xen_unified.c:25
  src/xen_unified.h:37
  src/xend_internal.c:43
  src/xm_internal.c:25
  src/xml.c:6
  src/xs_internal.c:45
  tests/nodeinfotest.c:1
  tests/sexpr2xmltest.c:83

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]