Subject: bug#15577: 24.3; dir-local variables not applied when switching major-mode

From: yary <[email-masked]>
Date: Thu, 10 Oct 2013 19:12:22 -0400

@Glenn "slightly impolite to post the same question to two different
places" -Understood, but this is a bug report, different purpose from
Stackoverflow question- and thus "are you happy with the answers you
have, or do you want Emacs to change?"- both! The answers are a
workaround for the current situation, but are slightly imperfect, and
as Stefan just wrote the current scheme is "at least undesirable
behavior."

The problem with the "(add-hook 'after-change-major-mode-hook
'hack-local-variables)" workaround and its variants, is when a
major-mode is set by a file-local variable- changing major mode will
reload the local variables, which will revert the major-mode again!

And the trouble with current Emacs out-of-the-box behavior is not
gaining the relevant file-local and dir-local variables for a new
major-mode when changing to that major-mode. I'd like to see a
well-thought-out solution in some future release.