[PATCH] Replace 8 consecutive spaces in leading whitespace by tab

Arsen Arsenović arsen@aarsen.me
Fri Oct 25 19:36:36 GMT 2024


Jonathan Wakely <jwakely@redhat.com> writes:

> On Fri, 25 Oct 2024 at 12:54, Jakub Jelinek <jakub@redhat.com> wrote:
>>
>> On Fri, Oct 25, 2024 at 01:25:25PM +0200, Arsen Arsenović wrote:
>> > Maybe we should go the other way around?  Compressing eight spaces into
>> > a tab leads to strange artifacts in diffs (where lines appear
>> > misindented because some were aligned by tabs and some by spaces), and
>> > nowadays editor authors seem to have forgotten tabs are eight spaces and
>> > instead default to (or, worse, hard-code) four, obviously making the
>> > codebase quite unreadable.  We also don't get the benefit of being able
>> > to adjust tabstop locally to our preferences when we use two-column
>> > indentation, so I don't see an advantage to keeping 'indent-tabs-mode
>> > (or equivalent in other editors) enabled.
>>
>> Editors which are worth a dime handle tabs fine, and I think using tabs is
>> better.
>
> And if we put a .editorconfig file at the top level, then most decent
> editors will be auto-configured as we want.

That won't help with wonky diffs.  For example:

+      if (foo)
+	{}

The indentation is correct here, but is wrong in the diff.  This happens
on every indent level 4N+3 to 4(N + 1) or back change.
-- 
Arsen Arsenović
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 381 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20241025/0e4aae5b/attachment.sig>


More information about the Libstdc++ mailing list