Subject: [PATCH] diff: "lisp" userdiff_driver

From: "Scott L. Burson via GitGitGadget" <[email-masked]>
Date: Sat, 15 Nov 2025 10:17:45 +0000

From: "Scott L. Burson" <[email-masked]>

The "scheme" driver doesn't quite work for Common Lisp.  This driver
is very generic and should work for almost any dialect of Lisp,
including Common Lisp.

Signed-off-by: Scott L. Burson <[email-masked]>
---
    diff: "lisp" userdiff_driver

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

 userdiff.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/userdiff.c b/userdiff.c
index fe710a68bf..e127b4a1f1 100644
--- a/userdiff.c
+++ b/userdiff.c
@@ -249,6 +249,14 @@ PATTERNS("kotlin",
 	 "|[.][0-9][0-9_]*([Ee][-+]?[0-9]+)?[fFlLuU]?"
 	 /* unary and binary operators */
 	 "|[-+*/<>%&^|=!]==?|--|\\+\\+|<<=|>>=|&&|\\|\\||->|\\.\\*|!!|[?:.][.:]"),
+PATTERNS("lisp",
+	 /* Either an unindented left paren, or a slightly indented line
+	  * starting with "(def" */
+	 "^((\\(|:space:{1,2}\\(def).*)$",
+	 /* Common Lisp symbol syntax allows arbitrary strings between vertical bars */
+	 "\\|([^\\\\]|\\\\\\\\|\\\\\\|)*\\|"
+	 /* All other words are delimited by spaces or parentheses/brackets/braces */
+	 "|([^][(){} \t])+"),
 PATTERNS("markdown",
 	 "^ {0,3}#{1,6}[ \t].*",
 	 /* -- */

base-commit: fd372d9b1a69a01a676398882bbe3840bf51fe72
-- 
gitgitgadget