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: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
Subject: Re: lexical-binding is turned on in more use cases
Date: Mon, 9 Mar 2020 20:22:59 +0000	[thread overview]
Message-ID: <20200309202259.GA16294@ACM> (raw)
In-Reply-To: <jwvtv2ysa6p.fsf-monnier+emacs@gnu.org>

Hello, Stefan.

On Sun, Mar 08, 2020 at 19:41:44 -0400, Stefan Monnier wrote:
> > .  This complained about c-syntactic-context being unbound, so I
> > tried:

> >    M-: (let ((c-syntactic-context (c-guess-basic-syntax)))
> >    (c-align-cpp-indent-to-body))

> > , and was puzzled that c-syntactic-context was _still_ unbound.  So I
> > checked the spelling, and was more puzzled.  Eventually I used setq,
> > which worked, but caused me further problems later on in my Emacs
> > session.

> Indeed `c-syntactic-context` is only declared as dynamically scoped in
> some files but not globally, for some reason.

That reason appearing to be a misfeature of defvar.  Why is (defvar foo)
a no-op?  Why does it not set the declared_special bit inside the symbol?
This would be sensible and consistent (even if unacceptable for Emacs
27).

> It's rather unusual.

Even if that's the case, it doesn't make it unimportant.  Let binding
from the minibuffer should work consistently, its effect not varying
chaotically between dynamic and lexical binding.

[ .... ]

> > Furthermore, c-syntactic-context is explicitly declared a dynamic
> > variable by a defvar form.

> But a `defvar` with no 2nd arg (i.e. no default value), which means it
> only affects the current file (not sure if this is part of the reason
> why you have `(defvar c-syntactic-context)` both `cc-cmds.el` and in
> `cc-vars.el`, but it would explain it tho the `(cc-bytecomp-defvar
> c-syntactic-context)` in `cc-vars.el` makes the whole situation much
> more murky).

See above.  defvar should not be a no-op.  It shouldn't be necessary to
write (defvar foo) in more than one file.

> > THIS IS A MAJOR BACKWARD STEP FOR EMACS!!!!

> ;-)

> > Looking at the git log, it appears this change was made nearly a year ago.

> Indeed, it's a wonder you managed to survive with such a majorly broken
> Emacs for so long ;-)

Why did you not initiate a discussion on emacs-devel before committing
this patch?  Also the title of the patch is highly misleading, since the
patch has nothing to do with defaults, only with forced lexical binding,
whether wanted or not.

How about making this lexical binding optional, controlled by a
customisable variable?  It would not be difficult.

>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).



  parent reply	other threads:[~2020-03-09 20:22 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-07 11:29 lexical-binding is turned on in more use cases Eli Zaretskii
2020-03-08 16:35 ` Stefan Monnier
2020-03-08 17:01   ` Eli Zaretskii
2020-03-08 17:33     ` Stefan Monnier
2020-03-08 17:43       ` Eli Zaretskii
2020-03-08 18:20         ` Stefan Monnier
2020-03-08 18:34           ` Eli Zaretskii
2020-03-08 19:30             ` Alan Mackenzie
2020-03-08 19:40               ` Eli Zaretskii
2020-03-08 19:56                 ` Alan Mackenzie
2020-03-08 20:06                   ` Eli Zaretskii
2020-03-08 20:15                     ` Alan Mackenzie
2020-03-11  2:59                       ` Richard Stallman
2020-03-11 12:44                       ` Stefan Monnier
2020-03-08 23:41                 ` Stefan Monnier
2020-03-08 23:41               ` Stefan Monnier
2020-03-09 20:10                 ` John Wiegley
2020-03-09 21:18                   ` Stefan Monnier
2020-03-09 21:27                     ` Drew Adams
2020-03-09 21:43                       ` Stefan Monnier
2020-03-09 22:30                     ` John Wiegley
2020-03-10 19:13                     ` Alan Mackenzie
2020-03-10 19:49                       ` Andrea Corallo
2020-03-10 20:16                         ` Alan Mackenzie
2020-03-10 20:54                           ` Andrea Corallo
2020-04-07 23:28                             ` Bruno Félix Rezende Ribeiro
2020-03-10 20:41                       ` Stefan Monnier
2020-03-10 21:02                         ` Michael Heerdegen
2020-03-10 21:02                         ` Alan Mackenzie
2020-03-10 21:33                           ` Stefan Monnier
2020-03-11  3:22                           ` Eli Zaretskii
2020-03-10 21:14                       ` Michael Heerdegen
2020-03-10 21:53                         ` Alan Mackenzie
2020-03-10 23:41                           ` Michael Heerdegen
2020-03-11  1:36                             ` Noam Postavsky
2020-03-11  2:02                               ` Michael Heerdegen
2020-03-13  0:46                                 ` Noam Postavsky
2020-03-11  3:06                             ` Richard Stallman
2020-03-11 12:47                               ` Stefan Monnier
2020-03-13  2:32                                 ` Michael Heerdegen
2020-03-11  2:11                           ` Stefan Monnier
2020-03-11 22:39                           ` John Wiegley
2020-03-09 20:22                 ` Alan Mackenzie [this message]
2020-03-09 22:05                   ` Stefan Monnier
2020-03-10 18:41                     ` Alan Mackenzie
2020-03-10 19:05                       ` Stefan Monnier
2020-03-10 19:41                         ` Alan Mackenzie
2020-03-10 20:26                           ` Stefan Monnier
2020-03-10 20:44                             ` Alan Mackenzie
2020-03-10 21:30                               ` Stefan Monnier
2020-03-11  3:06                               ` Richard Stallman
2020-03-08 19:39             ` 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=20200309202259.GA16294@ACM \
    --to=acm@muc.de \
    --cc=eliz@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).