From: Alan Mackenzie <acm@muc.de>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: yary <not.com@gmail.com>,
23407@debbugs.gnu.org, Dmitry Gutov <dgutov@yandex.ru>
Subject: bug#23407: .dir-local settings get obliterated on running a major mode function.
Date: Thu, 5 May 2016 11:39:25 +0000 [thread overview]
Message-ID: <20160505113925.GB1950@acm.fritz.box> (raw)
In-Reply-To: <jwv1t5jdnns.fsf-monnier+emacsbugs@gnu.org>
Hello, Stefan.
On Tue, May 03, 2016 at 02:10:45PM -0400, Stefan Monnier wrote:
> >> > + ;; delay-mode-hooks is set when `byte-compile-file' is the caller.
> >> > + ;; It is essential that we call `hack-local-variables' in order to
> >> > + ;; set up `lexical-binding', since `run-mode-hooks' is prevented
> >> > + ;; from doing its job.
> >> > + (when delay-mode-hooks
> >> > + (with-demoted-errors "File local-variables error: %s"
> >> > + (hack-local-variables 'no-mode))))
> >> But this seems terribly brittle. Do we care about delay-mode-hooks (as
> >> the code says) or about byte-compile-file (as the comment says)?
[ .... ]
> Hmm... so you're working around someone else's hack!
Yes, so is life.
> > if hack-local-variables isn't run, lexical-binding (for example) doesn't
> > get set up, and make bootstrap fails.
> Of course: hack-local-variables should be run unconditionally.
> >> If it's the former, then the comment needs to be fixed, if it's the
> >> latter, than we need to find some other way to tell this code what's
> >> going on.
> > I don't really understand the question. Sure, that bit of code is ugly.
> > But the comment both motivates ("it's `byte-compile-file''s fault") and
> > explains the problem (which is that `delay-mode-hooks' being set would
> > prevent `run-mode-hook', and thus `hack-local-variable' from running).
> > It is possible that other stuff might call `normal-mode' like this.
> > What sort of changes do you advocate for the comment (or for the code)?
> How 'bout doing
> (setq-local hack-local-variables--done t)
> in hack-local-variables, and then testing that instead of testing
> delay-mode-hooks?
That's even more horrible. What I've done is tidy up the comment (which
now makes no reference to byte-compile-file) and committed the change.
> Stefan
--
Alan Mackenzie (Nuremberg, Germany).
next prev parent reply other threads:[~2016-05-05 11:39 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-30 10:27 bug#23407: .dir-local settings get obliterated on running a major mode function Alan Mackenzie
2016-04-30 10:53 ` Dmitry Gutov
2016-04-30 18:50 ` Glenn Morris
2016-04-30 18:53 ` Glenn Morris
2016-05-01 21:28 ` Alan Mackenzie
2016-05-02 4:02 ` Stefan Monnier
2016-05-02 7:10 ` Alan Mackenzie
2016-05-03 18:10 ` Stefan Monnier
2016-05-05 11:39 ` Alan Mackenzie [this message]
2016-05-05 12:54 ` Stefan Monnier
[not found] ` <mailman.1598.1462012164.7477.bug-gnu-emacs@gnu.org>
2016-05-05 11:24 ` Alan Mackenzie
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160505113925.GB1950@acm.fritz.box \
--to=acm@muc.de \
--cc=23407@debbugs.gnu.org \
--cc=dgutov@yandex.ru \
--cc=monnier@IRO.UMontreal.CA \
--cc=not.com@gmail.com \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.