On 28-Mar-2021, at 05:16, Johannes Sixt <j6t@xxxxxxxx> wrote: >> diff --git a/t/t4018/scheme-define-syntax b/t/t4018/scheme-define-syntax >> new file mode 100644 >> index 0000000000..603b99cea4 >> --- /dev/null >> +++ b/t/t4018/scheme-define-syntax >> @@ -0,0 +1,8 @@ >> +(define-syntax define-test-suite RIGHT >> + (syntax-rules () >> + ((_ suite-name (name test) ChangeMe ...) >> + (define suite-name > > This test is suspicious. Notice the "ChangeMe" above? That is sufficient > to let the test case succeed. The "ChangeMe" in the last line below > should be the only one. Thanks for pointing this out. The second "ChangeMe" was not supposed to be there. What I wanted to test was the hunk header showing the line for '(define-syntax ...' and not the internal '(define ...' below it. Thus the ChangeMe should be located above the internal define so that the hunk header would show define-syntax and not the local define. > But then there is this indented '(define' that is not marked as RIGHT, > and I wonder how is it different from... > >> + (let ((tests >> + `((name . ,test) ...))) >> + (lambda () >> + (ChangeMe 'suite-name tests))))))) >> \ No newline at end of file >> diff --git a/t/t4018/scheme-local-define b/t/t4018/scheme-local-define >> new file mode 100644 >> index 0000000000..90e75dcce8 >> --- /dev/null >> +++ b/t/t4018/scheme-local-define >> @@ -0,0 +1,4 @@ >> +(define (higher-order) >> + (define local-function RIGHT > > ... this one, which is also indented and *is* marked as RIGHT. In this test case, I was explicitly testing for an indented '(define' whereas in the former, I was testing for the top-level '(define-syntax', which happened to have an internal define (which will inevitably show up in a lot of scheme code). >> + (lambda (x) >> + (car "this is" "ChangeMe")))) >> \ No newline at end of file > >> diff --git a/userdiff.c b/userdiff.c >> index 3f81a2261c..c51a8c98ba 100644 >> --- a/userdiff.c >> +++ b/userdiff.c >> @@ -191,6 +191,14 @@ PATTERNS("rust", >> "[a-zA-Z_][a-zA-Z0-9_]*" >> "|[0-9][0-9_a-fA-Fiosuxz]*(\\.([0-9]*[eE][+-]?)?[0-9_fF]*)?" >> "|[-+*\\/<>%&^|=!:]=|<<=?|>>=?|&&|\\|\\||->|=>|\\.{2}=|\\.{3}|::"), >> +PATTERNS("scheme", >> + "^[\t ]*(\\(define-?.*)$", > > This "optional hyphen followed by anything" in the regex is strange. > Wouldn't that also capture a line that looks like, e.g., > > (defined-foo bar) > > Perhaps we want "define[- \t].*" in the regex? Yes, this is what I intended to do, thanks for correcting it.