Subject: Re: bug#8586: 23.3.50; Directory-local variable ignored when file-local variables set mode

From: Glenn Morris <[email-masked]>
Date: Mon, 23 May 2011 13:04:34 -0400

Reuben Thomas wrote:

> While it would fix this bug, I'm not sure I approve: it looks as
> though it makes things more complicated, and when the "real fix"
> eventually arrives, would presumably have to remain in place for those
> who'd adopted this partial solution in the mean time...not great.

These comments don't apply. This isn't a partial solution, and no-one
needs to "adopt" anything.

I'm making set-auto-mode respect mode: cookies whether they be at the
start or end of the file. That's how it should work, IMO. It also
removes the "major mode must be specified first" restriction (bug#5239).

The only issue I see with it is that normal-mode will be less efficient
than it could be, because set-auto-mode and hack-local-variables may
parse similar regions of the file in similar ways.

Ideally, the file would be parsed only once to get coding:, mode: and
variables, which would then be applied (also allowing bug#7169 to be
fixed). But this is not straightforward to do, because these features
are currently spread over at least 4 functions, so I don't see it
happening any time soon.