[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: lexical-binding in CC-mode
From: |
Alan Mackenzie |
Subject: |
Re: lexical-binding in CC-mode |
Date: |
Tue, 6 Apr 2021 16:19:08 +0000 |
Hello, Stefan.
On Mon, Apr 05, 2021 at 14:38:08 -0400, Stefan Monnier wrote:
> Hi Alan,
> We're getting to the last few remaining ELisp files in Emacs still using
> the old non-lexical dialect, so I looked at converting CC-mode to use
> the new dialect as well. AFAICT the code is basically already prepared
> for that, tho I did find some minor things in the patch below.
OK, it seems this can't be put off any longer. ;-)
I've been experimenting with lexical-binding in CC Mode for about two
years, now. There's no real advantage in l-b for it, but no real
disadvantages, either.
The only thing I worry about is that l-b might not work properly in a
previous Emacs release (for standalone CC Mode), and there doesn't
appear to be a way of switching it on/off according to any criterion.
In particular, the following doesn't seem to work, neither in Emacs 25.3
or Emacs 28:
-*- eval: (setq lexical-binding (>= emacs-major-version 26)) -*-
.. That incantation leaves lexical-binding at nil, regardless of Emacs
version.
> Of course, the change should be fully backward compatible (i.e. the
> code sticks to the common subset of the two dialects).
Do closures (for lambda forms) work in Emacs 25 and earlier?
> See below the result of my attempt in the form of 4 patches.
> 0001 and 0004 are the important ones. 0002 makes the code more regular
> (you already use `declare` at various places, so I think it's good to
> use it more systematically). 0003 is largely a question of taste (and we
> know we don't always agree on that), but I like the warnings it gives me
> when a function is marked obsolete or when I make a typo.
Thanks.
> As usual, take the parts you like,
OK, I'll get it done in the next day or two.
> Stefan
[ .... ]
--
Alan Mackenzie (Nuremberg, Germany).