emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lexical-binding is turned on in more use cases


From: Stefan Monnier
Subject: Re: lexical-binding is turned on in more use cases
Date: Sun, 08 Mar 2020 19:41:44 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

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

It's rather unusual.  The more common pattern is to write

    (defvar c-syntactic-context nil)

which would not make you bump into this problem.

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

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


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]