Git development
 help / color / mirror / Atom feed
From: "Scott L. Burson via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Johannes Sixt" <j6t@kdbg.org>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Jaydeep P Das" <jaydeepjd.8914@gmail.com>,
	"D. Ben Knoble" <ben.knoble@gmail.com>,
	"Scott L. Burson" <Scott@sympoiesis.com>
Subject: [PATCH v4 0/2] userdiff: extend Scheme support to cover other Lisp dialects
Date: Wed, 15 Apr 2026 02:27:41 +0000	[thread overview]
Message-ID: <pull.2000.v4.git.1776220063.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.2000.v3.git.1768519120.gitgitgadget@gmail.com>

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.

Johannes Sixt (1):
  userdiff: tighten word-diff test case of the scheme driver

Scott L. Burson (1):
  userdiff: extend Scheme support to cover other Lisp dialects

 Documentation/gitattributes.adoc           |  3 ++-
 t/t4018/scheme-lisp-defun-a                |  4 ++++
 t/t4018/scheme-lisp-defun-b                |  4 ++++
 t/t4018/scheme-lisp-eval-when              |  4 ++++
 t/t4018/{scheme-module => scheme-module-a} |  0
 t/t4018/scheme-module-b                    |  6 ++++++
 t/t4034/scheme/expect                      |  5 +++--
 t/t4034/scheme/post                        |  3 ++-
 t/t4034/scheme/pre                         |  3 ++-
 userdiff.c                                 | 22 ++++++++++++++++------
 10 files changed, 43 insertions(+), 11 deletions(-)
 create mode 100644 t/t4018/scheme-lisp-defun-a
 create mode 100644 t/t4018/scheme-lisp-defun-b
 create mode 100644 t/t4018/scheme-lisp-eval-when
 rename t/t4018/{scheme-module => scheme-module-a} (100%)
 create mode 100644 t/t4018/scheme-module-b


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

Range-diff vs v3:

 1:  e20ac5b6a6 = 1:  8e0b1e3d01 userdiff: tighten word-diff test case of the scheme driver
 2:  fb4c8dc5d4 ! 2:  0bd51e02ba userdiff: extend Scheme support to cover other Lisp dialects
     @@ Commit message
      
       ## Documentation/gitattributes.adoc ##
      @@ Documentation/gitattributes.adoc: patterns are available:
     + 
       - `rust` suitable for source code in the Rust language.
       
     - - `scheme` suitable for source code in the Scheme language.
     -+Also handles Emacs Lisp, Common Lisp, and most other dialects.
     +-- `scheme` suitable for source code in the Scheme language.
     ++- `scheme` suitable for source code in most Lisp dialects,
     ++  including Scheme, Emacs Lisp, Common Lisp, and Clojure.
       
       - `tex` suitable for source code for LaTeX documents.
       
     @@ t/t4034/scheme/expect
         ; This is a <RED>really<RESET><GREEN>(moderately)<RESET> cool function.
         (<RED>this\place<RESET><GREEN>that\place<RESET> (+ 3 4))
      -  (define <RED>|the greeting|<RESET><GREEN>|a greeting|<RESET> "hello")
     -+  (define <RED>|the \greeting|<RESET><GREEN>|a \greeting|<RESET> |hello there|)
     ++  (define <RED>|the \| \greeting|<RESET><GREEN>|a \greeting|<RESET> |hello there|)
         ({<RED>}<RESET>(([<RED>]<RESET>(func-n)<RED>[<RESET>]))<RED>{<RESET>})
         (let ((c (<RED>+ a b<RESET><GREEN>add1 first<RESET>)))
           (format "one more than the total is %d" (<RED>add1<RESET><GREEN>+<RESET> c <GREEN>second<RESET>))))
     @@ t/t4034/scheme/pre
         ; This is a really cool function.
         (this\place (+ 3 4))
      -  (define |the greeting| "hello")
     -+  (define |the \greeting| |hello there|)
     ++  (define |the \| \greeting| |hello there|)
         ({}(([](func-n)[])){})
         (let ((c (+ a b)))
           (format "one more than the total is %d" (add1 c))))

-- 
gitgitgadget

  parent reply	other threads:[~2026-04-15  2:27 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-15 10:17 [PATCH] diff: "lisp" userdiff_driver Scott L. Burson via GitGitGadget
2025-11-15 17:06 ` Johannes Sixt
2025-11-15 23:32   ` Scott L. Burson
2025-11-20 16:47     ` D. Ben Knoble
2025-11-27  2:10       ` Scott L. Burson
2025-11-16  5:30   ` Junio C Hamano
2025-11-17 23:23     ` Scott L. Burson
2025-11-18  4:38       ` Junio C Hamano
2025-11-27  2:38 ` [PATCH v2 0/2] userdiff: extend Scheme support to cover other Lisp dialects Scott L. Burson via GitGitGadget
2025-11-27  2:38   ` [PATCH v2 1/2] diff: "lisp" userdiff_driver Scott L. Burson via GitGitGadget
2025-11-27 10:32     ` Scott L. Burson
2025-11-27 10:51       ` Johannes Sixt
2025-11-27  2:38   ` [PATCH v2 2/2] merge with Scheme regexp; fix bugs Scott L. Burson via GitGitGadget
2025-11-27 16:09     ` Johannes Sixt
2025-12-02 10:27       ` Johannes Sixt
2026-01-14  6:18         ` Scott L. Burson
2026-01-14  8:40           ` Johannes Sixt
2026-01-15 23:18   ` [PATCH v3 0/2] userdiff: extend Scheme support to cover other Lisp dialects Scott L. Burson via GitGitGadget
2026-01-15 23:18     ` [PATCH v3 1/2] userdiff: tighten word-diff test case of the scheme driver Johannes Sixt via GitGitGadget
2026-01-15 23:18     ` [PATCH v3 2/2] userdiff: extend Scheme support to cover other Lisp dialects Scott L. Burson via GitGitGadget
2026-01-16  8:49       ` Johannes Sixt
2026-01-17  2:09         ` Scott L. Burson
2026-01-17  8:15           ` Johannes Sixt
2026-04-15  2:27     ` Scott L. Burson via GitGitGadget [this message]
2026-04-15  2:27       ` [PATCH v4 1/2] userdiff: tighten word-diff test case of the scheme driver Johannes Sixt via GitGitGadget
2026-04-15  2:27       ` [PATCH v4 2/2] userdiff: extend Scheme support to cover other Lisp dialects Scott L. Burson via GitGitGadget
2026-04-15  6:54       ` [PATCH v4 0/2] " Johannes Sixt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pull.2000.v4.git.1776220063.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=Scott@sympoiesis.com \
    --cc=avarab@gmail.com \
    --cc=ben.knoble@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j6t@kdbg.org \
    --cc=jaydeepjd.8914@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox