Skip to content

Commit c987eb8

Browse files
authored
Add a simple .editorconfig file (#747)
This ensures that (most) compatible editors will insert tabs into the makefiles and spaces elsewhere. We also don't want trailing whitespace to be stripped when we edit the test files. Finally, it helps to open testinput1 in Latin-1 and testinput2 in UTF-8 mode. All this can be automated. The editorconfig file should work with any text editor - although note that VS Code needs an extension to make use of it.
1 parent 8f6c990 commit c987eb8

File tree

2 files changed

+44
-21
lines changed

2 files changed

+44
-21
lines changed

.editorconfig

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# EditorConfig helps ensure that files are opened in editors with the correct
2+
# settings, regardless of the editor or platform. See http://editorconfig.org.
3+
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
indent_style = space
9+
indent_size = 2
10+
end_of_line = lf
11+
12+
[Makefile.am]
13+
indent_style = tab
14+
15+
[*.bat]
16+
end_of_line = crlf
17+
18+
[testdata/*]
19+
insert_final_newline = false
20+
trim_trailing_whitespace = false
21+
22+
[testdata/test{input,output}{1,2,3,3A,3B,3C,6,28,29}]
23+
charset = latin1

Makefile.am

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -338,13 +338,13 @@ src/config.h.generic: configure.ac
338338
cs=$(srcdir)/config.status; test ! -f $$cs.aside || mv -f $$cs.aside $$cs
339339
test -f _generic/src/config.h
340340
perl -n \
341-
-e 'BEGIN{$$blank=0;}' \
342-
-e 'if(/(.+?)\s*__attribute__ \(\(visibility/){print"$$1\n";$$blank=0;next;}' \
343-
-e 'if(/LT_OBJDIR/){print"/* This is ignored unless you are using libtool. */\n";}' \
344-
-e 'if(/^#define\s((?:HAVE|SUPPORT|STDC)_\w+)/){print"/* #undef $$1 */\n";$$blank=0;next;}' \
345-
-e 'if(/^#define\s(?!PACKAGE|VERSION)(\w+)/){print"#ifndef $$1\n$$_#endif\n";$$blank=0;next;}' \
346-
-e 'if(/^\s*$$/){print unless $$blank; $$blank=1;} else{print;$$blank=0;}' \
347-
_generic/src/config.h >$@
341+
-e 'BEGIN{$$blank=0;}' \
342+
-e 'if(/(.+?)\s*__attribute__ \(\(visibility/){print"$$1\n";$$blank=0;next;}' \
343+
-e 'if(/LT_OBJDIR/){print"/* This is ignored unless you are using libtool. */\n";}' \
344+
-e 'if(/^#define\s((?:HAVE|SUPPORT|STDC)_\w+)/){print"/* #undef $$1 */\n";$$blank=0;next;}' \
345+
-e 'if(/^#define\s(?!PACKAGE|VERSION)(\w+)/){print"#ifndef $$1\n$$_#endif\n";$$blank=0;next;}' \
346+
-e 'if(/^\s*$$/){print unless $$blank; $$blank=1;} else{print;$$blank=0;}' \
347+
_generic/src/config.h >$@
348348
rm -rf _generic
349349

350350
MAINTAINERCLEANFILES += src/pcre2.h.generic src/config.h.generic
@@ -847,20 +847,20 @@ EXTRA_DIST += \
847847
# they don't, add their working files to CLEANFILES.
848848

849849
CLEANFILES += \
850-
testSinput \
851-
testSoutput \
852-
test3input \
853-
test3output \
854-
test3outputA \
855-
test3outputB \
856-
testtry \
857-
teststdout \
858-
teststderr \
859-
teststderrgrep \
860-
testtemp1grep \
861-
testtemp2grep \
862-
testtrygrep \
863-
testNinputgrep
850+
testSinput \
851+
testSoutput \
852+
test3input \
853+
test3output \
854+
test3outputA \
855+
test3outputB \
856+
testtry \
857+
teststdout \
858+
teststderr \
859+
teststderrgrep \
860+
testtemp1grep \
861+
testtemp2grep \
862+
testtrygrep \
863+
testNinputgrep
864864

865865
testoutput-clean:
866866
-rm -rf testoutput8 testoutput8-jit testoutput8-dfa

0 commit comments

Comments
 (0)