GNU bug report logs -
#15577
24.3; dir-local variables not applied when switching major-mode
Previous Next
Reported by: yary <not.com <at> gmail.com>
Date: Wed, 9 Oct 2013 20:15:01 UTC
Severity: normal
Merged with 23407
Found in version 24.3
Done: Alan Mackenzie <acm <at> muc.de>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> For sub-issue #1 "dir-locals not being applied in the new mode,"
> divide the responsibility for setting file-locals and dir-locals
> between `normal-mode find-file=t' and `define-derived-mode'. Just have
> `define-derived-mode' call
> `(hack-dir-local-variables)(hack-local-variables-apply)' unless it is
> being called as a result of `normal-mode t'. There's no change needed
> for the normal-mode function or anything it calls, except perhaps
> setting something that the define-derived-mode macro can check.
Yes, as mentioned earlier, a possible fix is to move the file-local and
dir-local setup code from normal-mode to after-change-major-mode-hook.
> a. Get all of that mode's customizable buffer-locals.
Not sure what that is.
> Ideally the minor-mode, or emacs core, would provide a function for
> that purpose.
It's probably not possible (not reliably at least) with the way minor
modes are defined currently. Tho depending on what you mean it might be
a non-issue.
> b. Mark those variables as permanent-local
There's no such thing, currently (we instead have to use a hack with
change-major-mode-hook, along the lines of what you did).
For minor-modes, what we could do is to check which buffer-local
minor-modes are enabled, and to "simply" re-enable them in
after-change-major-mode-hook.
But there are some issues:
- we have to find out which buffer-local minor-modes are enabled, which
presumes we have some kind of list of minor-modes. We can probably
use minor-mode-list for that, tho.
- some minor modes are mode-specific; e.g. it doesn't make much sense to
preserve reftex-mode when switching from latex-mode to haskell-mode.
Stefan
This bug report was last modified 9 years and 13 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.