[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bug#347: C mode asks twice about local variables
From: |
Stefan Monnier |
Subject: |
Re: bug#347: C mode asks twice about local variables |
Date: |
Wed, 11 Jun 2008 10:41:38 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) |
[ Moving this over to emacs-devel. ]
>> >> Can you try and call `c-file-style' with some extra "don't override"
>> >> (when called from that hack-local-variables-hook) argument so that any
>> >> variable that already has a buffer-local binding will not be
>> >> overridden?
>> Any comment about this suggestion?
> YUCK!!! ;-)
> I don't know off-hand what the significance of buffer locality is in CC
> Mode styles.
Could you ask the CC mode maintainer, maybe?
> But trying to get a "don't override" parameter to work
> would be horrendous. hack-local-variables is actually called after the
> language hook, isn't it? By that time, the CC Mode style will already
> have been set, and the pertinent variables will already be buffer local.
> At least I think so.
I see, yes, it might be messy or even impossible.
>> Non-portability might indeed be a problem (tho, it's obviously "your"
>> problem rather than mine), but introducing a new hook in Emacs-23 won't
>> help you there, so it's not relevant to this discussion.
> What I had in mind was using an (if (boundp 'before-hack-local-variables)
> ...) to separate out new strategy from old.
I'm sure we can come up with a good test to decide whether :safe
will do the right thing.
> Oh, and the hook would need documenting in the Elisp manual, but I can
> manage that.
> Hey, this is so easy and obviously the right thing. Let's do it!
It's going in the right direction but I'm still not completely satisfied.
How 'bout something like the following:
Some variables can be flagged as being special, in that when they apper
in the file-local list of settings, they "get set" by calling
a function. E.g. `mode' is globally special and "setting it" will
actually call the corresponding mode.
Then `c-mode' can define `c-file-style' and `c-file-offsets' as being
special so that setting them actually calls a function of yours
(probably a function that could also be used for the :set in defcustom,
BTW).
Of course, the interesting bit is that hack-local-variables will be
careful to reorder the file-local settings such that special variables
are set first.
Stefan
- Re: bug#347: C mode asks twice about local variables,
Stefan Monnier <=