Subject: Re: bug#7767: 23.2.91; file-local-variables-alist should have the permanent-local property

From: Alex Harsanyi <[email-masked]>
Date: Sun, 2 Jan 2011 07:26:36 +0800

On 2 Jan 2011, at 3:38 AM, Stefan Monnier wrote:

>> I tried to debug the problem and it seems that `hack-local-variables'
>> will collect the local variables into `file-local-variables-alist' than
>> run the hook `before-hack-local-variables-hook' which containts the
>> function `c-before-hack-hook'.
>> `c-before-hack-hook' will see the `mode' variable and call `c++-mode'
>> which than will call `kill-all-local-variables' setting
>> `file-local-variables-alist' to nil so that the remaining variables are
>> not processed.
> 
> It sounds like cc-mode does something odd here.

On further investigation, this only happens when the mode setting 
changes the mode of the file.  That is, a file named "hello.c" with a 
"mode: c++" setting.  It does not happen otherwise, because 
`hack-one-local-variable' will not enable a major mode if it is 
already set for the file.

However, `c-before-hack-hook' does enable the mode itself via a call to 
`hack-one-local-variable'.

Best Regards,
Alex.