emacs-devel
[Top][All Lists]
Advanced

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

Re: Mode loaded twice with Local Variables


From: Stuart D. Herring
Subject: Re: Mode loaded twice with Local Variables
Date: Wed, 10 May 2006 12:59:43 -0700 (PDT)
User-agent: SquirrelMail/1.4.3a-11.EL3

>   I didn't  think it  was the right  fix for  one reason :  some modes
>   /may/  behave  differently  on  startup  if  /some/  variables  have
>   /certain/  values.  In  other   words,  Local  Variables  would  set
>   variables  to  some  value  before  launching  the  mode,  expecting
>   a specified behavior.
>
>   My change provides this feature, AFAIK, but I do agree that it could
>   be too... dangerous to patch normal-mode, and not so needed.

I'm not sure that's how major modes are supposed to behave.  I don't
expect them to _do_ too much on startup; they ought to define commands and
bindings which may depend on variables, but which will execute later (well
after the application of local variables).  Additionally, major modes run
`kill-all-local-variables', so it would currently be disastrous to
exchange those two activities (I now realize).

But the very existence of major mode hooks makes me doubt myself.  WDOT? 
If it'd be better to set up the mode last, perhaps `normal-mode' ought to:
1. Somehow discover what major mode should be set (via variable or
otherwise).
2. `kill-all-local-variables' if the major mode is going to change.
3. `hack-local-variables' without setting the mode.
4. Set the mode, if it changed.

But this is very much more complicated than just preventing double-loading
the mode, so should probably happen later if ever.

Davis

PS - For amusement, load a file with this:
-*- mode: normal; -*-

-- 
This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.




reply via email to

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