git/t/t4018
Scott L. Burson b79f7a3ad3 userdiff: extend Scheme support to cover other Lisp dialects
Common Lisp has top-level forms, such as 'defun' and 'defmacro', that
are not matched by the current Scheme pattern.  Also, it is more
common in CL, when defining user macros intended as top-level forms,
to prefix their names with "def" instead of "define"; such forms are
also not matched.  And some top-level forms don't even begin with
"def".

On the other hand, it is an established formatting convention in the
Lisp community that only top-level forms start at the left margin.  So
matching any unindented line starting with an open parenthesis is an
acceptable heuristic; false positives will be rare.

However, there are also cases where notionally top-level forms are
grouped together within some containing form.  At least in the Common
Lisp community, it is conventional to indent these by two spaces, or
sometimes one.  But matching just an open parenthesis indented by two
spaces would be too broad; so the pattern added by this commit
requires an indented form to start with "(def".  It is believed that
this strikes a good balance between potential false positives and
false negatives.

Signed-off-by: Scott L. Burson <Scott@sympoiesis.com>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-04-15 08:43:33 -07:00
..
README
bash-arithmetic-function
bash-bashism-style-compact
bash-bashism-style-complete-line-capture userdiff: extend Bash pattern to cover more shell function forms 2025-05-16 11:52:41 -07:00
bash-bashism-style-function
bash-bashism-style-whitespace
bash-conditional-function
bash-missing-parentheses
bash-mixed-style-compact
bash-mixed-style-function
bash-nested-functions
bash-other-characters
bash-posix-style-compact
bash-posix-style-complete-line-capture userdiff: extend Bash pattern to cover more shell function forms 2025-05-16 11:52:41 -07:00
bash-posix-style-function
bash-posix-style-single-command-function userdiff: extend Bash pattern to cover more shell function forms 2025-05-16 11:52:41 -07:00
bash-posix-style-whitespace
bash-subshell-function
bash-trailing-comment
cpp-c++-function
cpp-class-constructor
cpp-class-constructor-mem-init
cpp-class-definition
cpp-class-definition-derived
cpp-class-destructor
cpp-function-returning-global-type
cpp-function-returning-nested
cpp-function-returning-pointer
cpp-function-returning-reference
cpp-gnu-style-function
cpp-namespace-definition
cpp-operator-definition
cpp-skip-access-specifiers
cpp-skip-comment-block
cpp-skip-labels
cpp-struct-definition
cpp-struct-single-line
cpp-template-function-definition
cpp-union-definition
cpp-void-c-function
csharp-exclude-assignments userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
csharp-exclude-control-statements userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
csharp-exclude-exceptions userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
csharp-exclude-generic-method-calls userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
csharp-exclude-init-dispose userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
csharp-exclude-iterations userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
csharp-exclude-method-calls userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
csharp-exclude-other userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
csharp-method userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
csharp-method-array userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
csharp-method-explicit userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
csharp-method-generics userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
csharp-method-generics-alternate-spaces userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
csharp-method-modifiers userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
csharp-method-multiline userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
csharp-method-params userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
csharp-method-special-chars userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
csharp-method-with-spacing userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
csharp-property userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
csharp-property-braces-same-line userdiff: better method/property matching for C# 2024-04-05 15:21:43 -07:00
css-attribute-value-selector
css-block-level-@-statements
css-brace-in-col-1
css-class-selector
css-colon-eol
css-colon-selector
css-common
css-id-selector
css-long-selector-list
css-prop-sans-indent
css-root-selector
css-short-selector-list
css-trailing-space
custom1-pattern
custom2-match-to-end-of-line
custom3-alternation-in-pattern
dts-labels
dts-node-unitless
dts-nodes
dts-nodes-boolean-prop
dts-nodes-comment1
dts-nodes-comment2
dts-nodes-multiline-prop
dts-reference
dts-root
dts-root-comment
elixir-do-not-pick-end
elixir-ex-unit-test
elixir-function
elixir-macro
elixir-module
elixir-module-func
elixir-nested-module
elixir-private-function
elixir-protocol
elixir-protocol-implementation
fortran-block-data
fortran-comment
fortran-comment-keyword
fortran-comment-legacy
fortran-comment-legacy-star
fortran-external-function
fortran-external-subroutine
fortran-module
fortran-module-procedure
fortran-program
fountain-scene
golang-complex-function
golang-func
golang-interface
golang-long-func
golang-struct
ini-section userdiff: add builtin driver for INI files 2025-04-01 03:02:09 -07:00
ini-section-noindent userdiff: add builtin driver for INI files 2025-04-01 03:02:09 -07:00
ini-section-same-line userdiff: add builtin driver for INI files 2025-04-01 03:02:09 -07:00
ini-subsection userdiff: add builtin driver for INI files 2025-04-01 03:02:09 -07:00
ini-subsection-noindent userdiff: add builtin driver for INI files 2025-04-01 03:02:09 -07:00
java-class-brace-on-separate-line userdiff: support Java type parameters 2023-02-08 12:56:57 -08:00
java-class-member-function userdiff: improve java hunk header regex 2021-08-11 11:11:30 -07:00
java-class-space-before-type-parameters userdiff: support Java type parameters 2023-02-08 12:56:57 -08:00
java-class-type-parameters userdiff: support Java type parameters 2023-02-08 12:56:57 -08:00
java-class-type-parameters-implements userdiff: support Java type parameters 2023-02-08 12:56:57 -08:00
java-enum-constant userdiff: improve java hunk header regex 2021-08-11 11:11:30 -07:00
java-interface-type-parameters userdiff: support Java type parameters 2023-02-08 12:56:57 -08:00
java-interface-type-parameters-extends userdiff: support Java type parameters 2023-02-08 12:56:57 -08:00
java-method-return-generic-bounded userdiff: improve java hunk header regex 2021-08-11 11:11:30 -07:00
java-method-return-generic-wildcard userdiff: improve java hunk header regex 2021-08-11 11:11:30 -07:00
java-nested-field userdiff: improve java hunk header regex 2021-08-11 11:11:30 -07:00
java-non-sealed userdiff: support Java sealed classes 2023-02-08 12:57:13 -08:00
java-record userdiff: support Java record types 2023-02-08 12:57:11 -08:00
java-record-space-before-components userdiff: support Java record types 2023-02-08 12:57:11 -08:00
java-record-type-parameters userdiff: support Java record types 2023-02-08 12:57:11 -08:00
java-sealed userdiff: support Java sealed classes 2023-02-08 12:57:13 -08:00
java-sealed-permits userdiff: support Java sealed classes 2023-02-08 12:57:13 -08:00
java-sealed-type-parameters userdiff: support Java sealed classes 2023-02-08 12:57:13 -08:00
java-sealed-type-parameters-implements-permits userdiff: support Java sealed classes 2023-02-08 12:57:13 -08:00
java-sealed-type-parameters-permits userdiff: support Java sealed classes 2023-02-08 12:57:13 -08:00
kotlin-class userdiff: add builtin diff driver for kotlin language. 2022-03-12 18:15:47 -08:00
kotlin-enum-class userdiff: add builtin diff driver for kotlin language. 2022-03-12 18:15:47 -08:00
kotlin-fun userdiff: add builtin diff driver for kotlin language. 2022-03-12 18:15:47 -08:00
kotlin-inheritace-class userdiff: add builtin diff driver for kotlin language. 2022-03-12 18:15:47 -08:00
kotlin-inline-class userdiff: add builtin diff driver for kotlin language. 2022-03-12 18:15:47 -08:00
kotlin-interface userdiff: add builtin diff driver for kotlin language. 2022-03-12 18:15:47 -08:00
kotlin-nested-fun userdiff: add builtin diff driver for kotlin language. 2022-03-12 18:15:47 -08:00
kotlin-public-class userdiff: add builtin diff driver for kotlin language. 2022-03-12 18:15:47 -08:00
kotlin-sealed-class userdiff: add builtin diff driver for kotlin language. 2022-03-12 18:15:47 -08:00
markdown-heading-indented
markdown-heading-non-headings
matlab-class-definition
matlab-function
matlab-octave-section-1
matlab-octave-section-2
matlab-section
perl-skip-end-of-heredoc
perl-skip-forward-decl
perl-skip-sub-in-pod
perl-sub-definition
perl-sub-definition-kr-brace
php-abstract-class
php-abstract-method
php-class
php-enum userdiff: support enum keyword in PHP hunk header 2021-08-31 12:13:36 -07:00
php-final-class
php-final-method
php-function
php-interface
php-method
php-trait
python-async-def
python-class
python-def
python-indented-async-def
python-indented-class
python-indented-def
r-indent userdiff: add support for R programming language 2025-05-29 15:29:37 -07:00
r-indent-nested userdiff: add support for R programming language 2025-05-29 15:29:37 -07:00
r-noindent userdiff: add support for R programming language 2025-05-29 15:29:37 -07:00
rust-fn
rust-impl
rust-macro-rules
rust-struct
rust-trait
scheme-class
scheme-def
scheme-def-variant
scheme-define-slash-public
scheme-define-syntax
scheme-define-variant
scheme-library
scheme-lisp-defun-a userdiff: extend Scheme support to cover other Lisp dialects 2026-04-15 08:43:33 -07:00
scheme-lisp-defun-b userdiff: extend Scheme support to cover other Lisp dialects 2026-04-15 08:43:33 -07:00
scheme-lisp-eval-when userdiff: extend Scheme support to cover other Lisp dialects 2026-04-15 08:43:33 -07:00
scheme-local-define
scheme-module-a userdiff: extend Scheme support to cover other Lisp dialects 2026-04-15 08:43:33 -07:00
scheme-module-b userdiff: extend Scheme support to cover other Lisp dialects 2026-04-15 08:43:33 -07:00
scheme-top-level-define
scheme-user-defined-define

README

How to write RIGHT test cases
=============================

Insert the word "ChangeMe" (exactly this form) at a distance of
at least two lines from the line that must appear in the hunk header.

The text that must appear in the hunk header must contain the word
"right", but in all upper-case, like in the title above.

This text is a bit twisted and out of order, but it is itself a
test case for the default hunk header pattern. Know what you are doing
if you change it.

BTW, this tests that the head line goes to the hunk header, not the line
of equal signs.