Subject: Re: bug#49278: 28.0.50; Lisp Mode is for Common Lisp

From: João Távora <[email-masked]>
Date: Wed, 30 Jun 2021 13:45:58 +0100

On Wed, Jun 30, 2021 at 1:35 PM Eli Zaretskii <[email-masked]> wrote:
>
> > From: João Távora <[email-masked]>
> > Date: Tue, 29 Jun 2021 19:25:45 +0100
> > Cc: [email-masked], Stefan Monnier <[email-masked]>
> >
> > > > -  Lisp mode is the major mode for editing programs written in
> > > > -general-purpose Lisp dialects, such as Common Lisp.  Its mode command
> > > > -is @kbd{M-x lisp-mode}.  Emacs uses Lisp mode automatically for files
> > > > -whose names end in @file{.l}, @file{.lsp}, or @file{.lisp}.
> > > > +  Lisp mode is the major mode for editing programs written in Common
> > > > +Lisp or its ancestor dialects.  Its mode command is @kbd{M-x
> > > > +lisp-mode}.  Emacs uses Lisp mode automatically for files whose names
> > > > +end in @file{.l}, @file{.lsp}, or @file{.lisp}.
> > >
> > > This basically doesn't change anything, and the original text does
> > > mention CL.  If mentioning the ancestor dialects is important, we
> > > could add that.
> >
> > The point is to make sure that noone is misinformed to think that
> > lisp-mode is a suitable ancestor for, say, scheme-mode or clojure-mode or
> > my-2021-lisp-mode.
>
> We can mention Scheme and Clojure there (as examples of languages that
> are NOT handled), if that's the issue.  Or maybe you can describe
> those dialects that you'd like to exempt in some more general way?

Here's a very good  way: dialects that are _not_ Common Lisp or its
ancestors.  Which is what I wrote.  But Stefan goes even farther and
would probably phrase it: dialetcts that are _not_ Common Lisp _period_.
He's probably right.  Lisp mode is only for Common Lisp (or for some
language you invent that is a superset of Common Lisp).

> > So it's not true that this doesn't change anything: it removes an
> > ambiguity.
>
> Not in my eyes, no.  I think you assign too much significance to the
> "ancestor" part, and rely on the reader to understand that
> significance.

`lisp-mode` shuoldn't be used for editing other things than Common Lisp.
It's _that_ simple. Neither should it be used as an ancestor for derived
modes which aim to edit languages that are not a superset of Common
Lisp.  I think it's pretty obvious that current phrasing makes this action
plausible, when in reality it's a mistake.  It will bring problems to this
hypothetical developer.

Don't know how else to explain it.

> > > >  (define-derived-mode lisp-mode lisp-data-mode "Lisp"
> > > > -  "Major mode for editing Lisp code for Lisps other than GNU Emacs Lisp.
> > > > +  "Major mode for editing Common Lisp code.
> > >
> > > Here I'd prefer to mention CL without un-mentioning the other Lisps.
> > > There's no reason to deny they exist or existed.
> >
> > That's true, I guess.  The point is to make sure that no one gets the
> > temptation to derive new Lisp-ish modes based on lisp-mode for
> > languages that have no relation to CL.  So what to you say to:
> >
> > "Major mode for editing Common Lisp and historically related Lisps"
> >
> > "Major mode for editing Common Lisp and its ancestors"
> >
> > "Major mode for editing code historically related to Common Lisp"
>
> Again, I'd like to understand better what misunderstandings are you
> trying to prevent.

Case in point: Phil Hagelberg in this discussion developed a Lisp-like
language, called "fennel" I believe.  I believe he developed it in the
recent past. He used `lisp-mode` as the ancestor in `define-derived-mode`.
Because other long-running extensions for Common Lisp specifically
rely on lisp-mode-hook (which again, is for Common Lisp exclusively),
the presence of those extensions introduces problems that Phil has to
work around in this fennel-mode.el file.  He also has to write more
code than we would have needed if he had used lisp-data-mode.

As far as I can tell, Phil used lisp-mode as an ancestor because
no lisp-data-mode was available/visible to him and because he
wanted to reuse some Lisp-editing code.  A worthy goal. But because
of lisp-mode's proven specificity to Common Lisp, he also bought
himself some conflicts (that somehow the developers of Scheme mode
and Clojure mode managed to avoid). So the docstring fixes aim to
prevent that mistake.

João