Hello!

On 2021-10-30 Jia Tan wrote:
> This patch adds a .editorconfig to the root directory.

Thanks! I hadn't heard about this before but it sounds nice.

> +[*]
> +insert_final_newline = true
> +trim_trailing_whitespace = true

I think it should be fine to add these:

    charset = utf-8
    end_of_line = lf

The exception are some files under windows/vs*. Those files will
hopefully be gone in the future though. They use LF, not CR+LF but have
BOM:

    [*.vcxproj,xz_win.sln]
    charset = utf-8-bom

> +[src/,tests/]

If the syntax is similar to gitignore, then src/ will match also
foo/bar/src/. It doesn't really matter here but I suppose /src/ is a
tiny bit more correct.

> +indent_style = tab

I guess it makes sense to set also indent_size = 8 because viewing the
files with any other setting will look weird when long lines are
wrapped and can editing can result in wrong word wrapping.

There are multiple indentation styles even under src. Instead of
specifying directories, how about specifying file suffixes like *.c so
it won't matter where the files are. There are .sh files with different
styles but maybe it's not that important.

I ended up with this:

---
# To use this config on your editor, follow the instructions at:
# https://editorconfig.org/

root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.c,*.h,*.S,*.map,*.sh,*.bash,Makefile*,/configure.ac,/po4a/update-po,/src/scripts/{xzless,xzmore}.in]
indent_style = tab
indent_size = 8

[/src/scripts/{xzdiff,xzgrep}.in]
indent_style = space
indent_size = 2

[CMakeLists.txt,*.cmake]
indent_style = space
indent_size = 4

[*.vcxproj,xz_win.sln]
charset = utf-8-bom
---

Is it good enough or did I add bad bugs? :-)

-- 
Lasse Collin

Reply via email to