Subject: Re: [PATCH] diff: "lisp" userdiff_driver

From: Junio C Hamano <[email-masked]>
Date: Mon, 17 Nov 2025 20:38:34 -0800

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

> ...  The greater
> potential for false positives comes from the rule (in my proposal)
> that a left parenthesis in column 0 is taken as indicating a top-level
> definition, without even looking at the following characters.

I didn't respond to that part as I didn't know if you were serious
or joking ;-).

> Although Lisp dialects certainly vary, I have not seen one in which
> standard indentation practice does not indent internal expressions;
> certainly, Lisp mode in Emacs indents them.  And, I think the rule
> really does need to be that broad, because top-level forms don't
> always begin with "def"; indeed, one can put any executable expression
> at top level in a source file to perform load-time initializations.

Exactly, but the more important question is are they considered as
the beginning of an important, and sematically distinct, block, just
like the beginning of a function is.  I am somewhat negative to the
"anything not indented is a beginning of a significant group", as I
do not know how well it meshes with the "(defXX is a beginning of a
function", when they are used together.

> One solution would be to add an aliasing mechanism to the
> driver table.  Perhaps there would be other use cases for it.  If you
> would consider a patch along these lines, I can code it up.

It is not a particularly interesting part of the problem, simply
because as the first approximation, we can just advertise "you can
mark your lisp files as 'scheme'".  A more interesting issue is if
we can indeed come up with such a superset of patterns that can
cover all Lisp variants that matter.