[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

From: Stefan Monnier
Subject: bug#15577: 24.3; dir-local variables not applied when switching major-mode
Date: Fri, 18 Oct 2013 21:18:39 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

> 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

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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]