* [PATCH v2 0/2] EditorConfig file @ 2018-10-08 20:29 brian m. carlson 2018-10-08 20:29 ` [PATCH v2 1/2] editorconfig: provide editor settings for Git developers brian m. carlson 2018-10-08 20:29 ` [PATCH v2 2/2] editorconfig: indicate settings should be kept in sync brian m. carlson 0 siblings, 2 replies; 5+ messages in thread From: brian m. carlson @ 2018-10-08 20:29 UTC (permalink / raw) To: git; +Cc: Taylor Blau, Junio C Hamano This series introduces an EditorConfig file to help developers using any editor set their editor's settings in conformance with the Git Project's settings. This is helpful for developers who work on different projects with different indentation standards to keep their work in sync. Changes since v1: * Add notes to both .editorconfig and .clang-format that they should be kept in sync. * Add commit message line length. brian m. carlson (2): editorconfig: provide editor settings for Git developers editorconfig: indicate settings should be kept in sync .clang-format | 2 ++ .editorconfig | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 .editorconfig ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/2] editorconfig: provide editor settings for Git developers 2018-10-08 20:29 [PATCH v2 0/2] EditorConfig file brian m. carlson @ 2018-10-08 20:29 ` brian m. carlson 2018-10-08 20:53 ` Ævar Arnfjörð Bjarmason 2018-10-08 20:29 ` [PATCH v2 2/2] editorconfig: indicate settings should be kept in sync brian m. carlson 1 sibling, 1 reply; 5+ messages in thread From: brian m. carlson @ 2018-10-08 20:29 UTC (permalink / raw) To: git; +Cc: Taylor Blau, Junio C Hamano Contributors to Git use a variety of editors, each with their own configuration files. Because C lacks the defined norms on how to indent and style code that other languages, such as Ruby and Rust, have, it's possible for various contributors, especially new ones, to have configured their editor to use a style other than the style the Git community prefers. To make automatically configuring one's editor easier, provide an EditorConfig file. This is an INI-style configuration file that can be used to specify editor settings and can be understood by a wide variety of editors. Some editors include this support natively; others require a plugin. Regardless, providing such a file allows users to automatically configure their editor of choice with the correct settings by default. Provide global settings to set the character set to UTF-8 and insert a final newline into files. Provide language-specific settings for C, Shell, Perl, and Python files according to what CodingGuidelines already specifies. Since the indentation of other files varies, especially certain AsciiDoc files, don't provide any settings for them until a clear consensus forward emerges. Set the line length for commit messages to 72 characters, which is the generally accepted line length for emails, since we send patches by email. Don't specify an end of line type. While the Git community uses Unix-style line endings in the repository, some Windows users may use Git's auto-conversion support and forcing Unix-style line endings might cause problems for those users. Finally, leave out a root directive, which would prevent reading other EditorConfig files higher up in the tree, in case someone wants to set the end of line type for their system in such a file. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> --- .editorconfig | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000..83227fa0b2 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,14 @@ +[*] +charset = utf-8 +insert_final_newline = true + +[*.{c,h,sh,perl}] +indent_style = tab +tab_width = 8 + +[*.py] +indent_style = space +indent_size = 4 + +[COMMIT_EDITMSG] +max_line_length = 72 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/2] editorconfig: provide editor settings for Git developers 2018-10-08 20:29 ` [PATCH v2 1/2] editorconfig: provide editor settings for Git developers brian m. carlson @ 2018-10-08 20:53 ` Ævar Arnfjörð Bjarmason 2018-10-08 21:54 ` brian m. carlson 0 siblings, 1 reply; 5+ messages in thread From: Ævar Arnfjörð Bjarmason @ 2018-10-08 20:53 UTC (permalink / raw) To: brian m. carlson; +Cc: git, Taylor Blau, Junio C Hamano On Mon, Oct 08 2018, brian m. carlson wrote: > Contributors to Git use a variety of editors, each with their own > configuration files. Because C lacks the defined norms on how to indent > and style code that other languages, such as Ruby and Rust, have, it's > possible for various contributors, especially new ones, to have > configured their editor to use a style other than the style the Git > community prefers. > > To make automatically configuring one's editor easier, provide an > EditorConfig file. This is an INI-style configuration file that can be > used to specify editor settings and can be understood by a wide variety > of editors. Some editors include this support natively; others require > a plugin. Regardless, providing such a file allows users to > automatically configure their editor of choice with the correct settings > by default. > > Provide global settings to set the character set to UTF-8 and insert a > final newline into files. Provide language-specific settings for C, > Shell, Perl, and Python files according to what CodingGuidelines already > specifies. Since the indentation of other files varies, especially > certain AsciiDoc files, don't provide any settings for them until a > clear consensus forward emerges. > > Set the line length for commit messages to 72 characters, which is the > generally accepted line length for emails, since we send patches by > email. > > Don't specify an end of line type. While the Git community uses > Unix-style line endings in the repository, some Windows users may use > Git's auto-conversion support and forcing Unix-style line endings might > cause problems for those users. > > Finally, leave out a root directive, which would prevent reading other > EditorConfig files higher up in the tree, in case someone wants to set > the end of line type for their system in such a file. > > Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> > --- > .editorconfig | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > create mode 100644 .editorconfig > > diff --git a/.editorconfig b/.editorconfig > new file mode 100644 > index 0000000000..83227fa0b2 > --- /dev/null > +++ b/.editorconfig > @@ -0,0 +1,14 @@ > +[*] > +charset = utf-8 > +insert_final_newline = true > + > +[*.{c,h,sh,perl}] > +indent_style = tab > +tab_width = 8 It looks like we can add at least "pm" and "pl" to that pattern: $ git ls-files|grep -E -v -e '\.(c|h|sh|perl)$' | grep -F .| sed 's/.*\.//'|sort|uniq -c|sort -nr|head -n 15 631 txt 56 expect 48 po 41 test 40 tcl 34 gitignore 24 pm 18 patch 18 diff 16 pl 15 side 14 gitattributes 12 dump 11 sample 9 master > +[*.py] > +indent_style = space > +indent_size = 4 > + > +[COMMIT_EDITMSG] > +max_line_length = 72 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/2] editorconfig: provide editor settings for Git developers 2018-10-08 20:53 ` Ævar Arnfjörð Bjarmason @ 2018-10-08 21:54 ` brian m. carlson 0 siblings, 0 replies; 5+ messages in thread From: brian m. carlson @ 2018-10-08 21:54 UTC (permalink / raw) To: Ævar Arnfjörð Bjarmason; +Cc: git, Taylor Blau, Junio C Hamano [-- Attachment #1: Type: text/plain, Size: 333 bytes --] On Mon, Oct 08, 2018 at 10:53:52PM +0200, Ævar Arnfjörð Bjarmason wrote: > > It looks like we can add at least "pm" and "pl" to that pattern: Sure. I didn't think we had any of those, but you've just proven me wrong. I'll send a v3 shortly. -- brian m. carlson: Houston, Texas, US OpenPGP: https://keybase.io/bk2204 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 868 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 2/2] editorconfig: indicate settings should be kept in sync 2018-10-08 20:29 [PATCH v2 0/2] EditorConfig file brian m. carlson 2018-10-08 20:29 ` [PATCH v2 1/2] editorconfig: provide editor settings for Git developers brian m. carlson @ 2018-10-08 20:29 ` brian m. carlson 1 sibling, 0 replies; 5+ messages in thread From: brian m. carlson @ 2018-10-08 20:29 UTC (permalink / raw) To: git; +Cc: Taylor Blau, Junio C Hamano Now that we have two places where we set code formatting settings, .editorconfig and .clang-format, it's possible that they could fall out of sync. This is relatively unlikely, since we're not likely to change the tab width or our preference for tabs, but just in case, add comments to both files reminding future developers to keep them in sync. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> --- .clang-format | 2 ++ .editorconfig | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.clang-format b/.clang-format index 12a89f95f9..de1c8b5c77 100644 --- a/.clang-format +++ b/.clang-format @@ -6,6 +6,8 @@ # Use tabs whenever we need to fill whitespace that spans at least from one tab # stop to the next one. +# +# These settings are mirrored in .editorconfig. Keep them in sync. UseTab: Always TabWidth: 8 IndentWidth: 8 diff --git a/.editorconfig b/.editorconfig index 83227fa0b2..98d7c5ff99 100644 --- a/.editorconfig +++ b/.editorconfig @@ -2,6 +2,8 @@ charset = utf-8 insert_final_newline = true +# The settings for C (*.c and *.h) files are mirrored in .clang-format. Keep +# them in sync. [*.{c,h,sh,perl}] indent_style = tab tab_width = 8 ^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-10-08 21:55 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-10-08 20:29 [PATCH v2 0/2] EditorConfig file brian m. carlson 2018-10-08 20:29 ` [PATCH v2 1/2] editorconfig: provide editor settings for Git developers brian m. carlson 2018-10-08 20:53 ` Ævar Arnfjörð Bjarmason 2018-10-08 21:54 ` brian m. carlson 2018-10-08 20:29 ` [PATCH v2 2/2] editorconfig: indicate settings should be kept in sync brian m. carlson
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).