Subject: Re: bug#23476: 25.0.93; Visiting C files on master signals an error

From: Alan Mackenzie <[email-masked]>
Date: Mon, 9 May 2016 11:07:13 +0000

Hello, Eli.

On Sun, May 08, 2016 at 06:48:23PM +0300, Eli Zaretskii wrote:
> > Date: Sat, 7 May 2016 20:40:22 +0000
> > Cc: [email-masked]
> > From: Alan Mackenzie <[email-masked]>

> > > One way is to turn on by default the feature that fontifies these
> > > macros correctly.  Why does it have to be off by default?

> > The feature is dependent on _configuration_: the '("IF_LINT") is that
> > configuration.

> But the IF_LINT part is AFAIU the _only_ part of the configuration
> that the user needs to supply.  All the rest, including the forms to
> evaluate, doesn't have to be in file-local variables.  Right?

Right.  I've amended C(etc.) Mode to use the new :after-hook parameter
to define-derived-mode which I committed yesterday.  The eval form which
used to be in .dir-locals.el is now run by C Mode after the mode hooks
(and file/dir local variables stuff) have been done.

> And a list of strings can easily be a safe local variable, so if you
> devise a variable that will accept lists like '("IF_LINT"), it could
> easily be specified without prompting those annoying questions.

Done.  So now, Emacs master will now accept the "IF_LINT" value from
.dir-locals.el without asking the user any questions.  (I haven't
commited the change yet, though.)

However, visiting a master C source file using the emacs-25 branch would
still ask the question.  One way to get round this would be to add the
safe-local-variable stuff into emacs-25, but nobody wants to change
emacs-25 at this late stage.

> Moreover, we could support these particular macros by default: I doubt
> that Paul invented them for Emacs, and even if he did, they are by now
> probably used elsewhere, so it should be good to have their support
> built-in.

To me, this doesn't feel like the Right Thing to do.  A user might
easily define a macro (or even a variable) called IF_LINT and be puzzled
as to why it wasn't fontifying or indenting correctly.

> Am I missing something?

For the master branch, making IF_LINT a noise macro by default wouldn't
gain us anything.  For visiting a master branch C file from the emacs-25
branch, this wouldn't help.

> > I've reverted the change to .dir-locals.el which caused the problem.
> > This should take the pressure off, so that we can find a good solution.

> Thanks.  I hope the considerations above will allow to restore the
> feature soon.

Just how bad would it be to get the question about unsafe local
variables when visiting master C files from emacs-25 emacs -Q?  If the
answer is "not too bad", I can also commit the change to .dir-locals.el.
Otherwise, probably the best thing is just to commit the changes to CC
Mode for now, and amend .dir-locals.el after the Emacs 25 release, when
people will mostly be using the code in the master branch for
development.

What do you say?

-- 
Alan Mackenzie (Nuremberg, Germany).