unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: bug-cc-mode@gnu.org, emacs-devel@gnu.org
Subject: Re: lexical-binding in CC-mode
Date: Tue, 6 Apr 2021 16:19:08 +0000	[thread overview]
Message-ID: <YGyJ/C/ZoMCcHv9b@ACM> (raw)
In-Reply-To: <jwvzgyclhja.fsf-monnier+emacs@gnu.org>

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).



  reply	other threads:[~2021-04-06 16:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-05 18:38 lexical-binding in CC-mode Stefan Monnier
2021-04-06 16:19 ` Alan Mackenzie [this message]
2021-04-06 16:49   ` Stefan Monnier
2021-04-06 18:42   ` Dmitry Gutov
2021-04-06 20:35     ` Filipp Gunbin
2021-04-10 19:47 ` Alan Mackenzie
2021-04-10 20:21   ` Stefan Monnier

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=YGyJ/C/ZoMCcHv9b@ACM \
    --to=acm@muc.de \
    --cc=bug-cc-mode@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).