Thread (24 messages) 24 messages, 4 authors, 2026-04-15
STALE79d
Revisions (3)
  1. v2 current
  2. v3 [diff vs current]
  3. v4 [diff vs current]

[PATCH v2 0/2] userdiff: extend Scheme support to cover other Lisp dialects

From: Scott L. Burson via GitGitGadget <hidden>
Date: 2025-11-27 02:38:18

Common Lisp, Emacs Lisp, and other dialects have some top-level forms, most
importantly 'defun', that are not matched by the current Scheme pattern.
Also, it is common in these dialects, when defining user macros intended as
top-level forms, to prefix their names with "def" instead of "define"; such
forms are also not currently matched. Some such 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.

This commit disjoins a regexp employing these heuristics to the existing
Scheme regexp, so it will still match everything that it did previously.

Changes since v1:

 * unified with Scheme driver
 * fixed whitespace bug (tabs were allowed incorrectly)
 * made "(def" case-insensitive
 * improved commit summary line
 * improved commit description

Scott L. Burson (2):
  diff: "lisp" userdiff_driver
  merge with Scheme regexp; fix bugs

 userdiff.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)


base-commit: fd372d9b1a69a01a676398882bbe3840bf51fe72
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2000%2Fslburson%2Flisp-userdiff_driver-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2000/slburson/lisp-userdiff_driver-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/2000

Range-diff vs v1:

 1:  da99bb0bcd = 1:  da99bb0bcd diff: "lisp" userdiff_driver
 -:  ---------- > 2:  86315aa3e3 merge with Scheme regexp; fix bugs

-- 
gitgitgadget
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help