On Wed, 7 Aug 2024 at 21:09, Andrew Dunstan <and...@dunslane.net> wrote: > You're not meant to use our pg_bsd_indent on its own without the > appropriate flags, namely (from src/tools/pgindent/pgindent):
Ah sorry, I wasn't clear in what I meant then. I meant that if you look at the sources of pg_bsd_indent (such as src/tools/pg_bsd_indent/io.c) then you'll realize that comments are alligned using tabs of width 8, not tabs of width 4. And right now .editorconfig configures editors to show all .c files with a tab_width of 4, because we use that for Postgres source files. The bottom .gitattributes line now results in an editorconfig rule that sets a tab_width of 8 for just the c and h files in src/tools/pg_bsd_indent directory. > Also, why are you proposing to undet indent-style for .pl and .pm files? > That's not in accordance with our perltidy settings > (src/tools/pgindent/perltidyrc), unless I'm misunderstanding. All the way at the bottom of the .editorconfig file those "ident_style = unset" lines are overridden to be "tab" for .pl and .pm files. There's a comment there explaining why it's done that way. # We want editors to use tabs for indenting Perl files, but we cannot add it # such a rule to .gitattributes, because certain lines are still indented with # spaces (e.g. SYNOPSIS blocks). [*.{pl,pm}] indent_style = tab But now thinking about this again after your comment, I realize it's just as easy and effective to change the script slightly to hardcode the indent_style for "*.pl" and "*.pm" so that the resulting .editorconfig looks less confusing. Attached is a patch that does that. I also added a .gitattributes rule for .py files, and changed the default tab_width to unset. Because I realized the resulting .editorconfig was using tab_width 8 for python files when editing src/tools/generate_editorconfig.py
v7-0001-Add-script-to-keep-.editorconfig-in-sync-with-.gi.patch
Description: Binary data