bug#3808: 23.1.50; CC-mode: Impossible to set c-cleanup-list

Jan Djärv <[email protected]>
Newsgroups gmane.emacs.bugs,gmane.emacs.pretest.bugs
Message-ID <[email protected]>

Alan Mackenzie skrev:
> Hi, Jan!
> 
> On Fri, Jul 10, 2009 at 01:14:45PM +0200, Jan D. wrote:
>> I customize c-cleanup-list.  This is then the full contents of my
>> .emacs:
>> (custom-set-variables
>>   ;; custom-set-variables was added by Custom.
>>   ;; If you edit it by hand, you could mess it up, so be careful.
>>   ;; Your init file should contain only one such instance.
>>   ;; If there is more than one, they won't work right.
>>  '(c-cleanup-list (quote (scope-operator space-before-funcall))))
>> (custom-set-faces
>>   ;; custom-set-faces was added by Custom.
>>   ;; If you edit it by hand, you could mess it up, so be careful.
>>   ;; Your init file should contain only one such instance.
>>   ;; If there is more than one, they won't work right.
>>  )
> 
>> I start emacs with --no-site-file, open a .c-file.
> 
> Just done this, in a new userid, having copied your .emacs.  To be sure,
> I tried on a freshly updated CVS Emacs.
> 
>> Check the value of c-cleanup-list:
> 
>> c-cleanup-list is a variable defined in `cc-vars.el'.
>> Its value is (scope-operator)
> 
> I can't reproduce the problem; I get:
> 
>     Its value is
>     (scope-operator space-before-funcall)
> 
> , just as desired.
> 
>> Local in buffer xftfont.c; global value is 
>> (scope-operator space-before-funcall)
> 
> Well, that looks OK.  :-)
> 
> Might it be that there's a local variables section at the end of
> xftfont.c which is overriding c-cleanup-list?
> 

No, but since this is in the emacs source tree, there is a .dir-locals.el
at the root of the source tree, and that comes in effect.  So it is not that 
it doesn't work, it is just this situation (setting c-file-style as a file 
local variable has the same effect).

So what happens is:
c-mode sets style to GNU.
My customization is applied.
.dir-locals.el sets style to GNU, thus erasing my customization.

>> And indeed, space-before-funcall is not in effect.  It seems impossible to
>> set this variable.  I also tried setting c-old-style-variable-behavior to t,
>> but it made no difference.
> 
>> The manual needs to explain how to set variables in a manner that works,
>> an example with lisp to add to .emacs would be nice also.
> 
> "The manual" being the CC Mode manual, of course.  In the appendix
> "Sample .emacs File", there's an example of c-cleanup-list being set in a
> style.  The instructions on how to set "style variables" in general (of
> which c-cleanup-list is one) are on the page "Configuration Basics" and
> its sup-page "Style Variables".
> 
> So I think the information is there, but perhaps it's not easy enough to
> find.  Could you, perhaps, reconstruct how you went about looking for the
> info?  Maybe the manual needs an extra hint or two somewhere.  Thanks!
> 

The situation above, i.e. how to preserve my customization when .dir-locals.el 
or file variables are in effect is not described.

I tried the mode hook, it didn't work either.  Is there a c-set-style hook?

	Jan D.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.