help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: File-specific cc-mode settings


From: Johan Bockgård
Subject: Re: File-specific cc-mode settings
Date: Thu, 23 Aug 2007 10:24:48 +0200
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1.50 (gnu/linux)

Alexander Kotelnikov <sacha@myxomop.com> writes:

> I have cc-mode configuration which suits my needs, but for certain
> files I'd like to get specific settings. So what I tried was putting
>
> /*
> Local Variables:
> mode:c
> c-style-java: t
> End:
> */

(info "(ccmode)File Styles")

   -- Variable: c-file-style
        Set this variable to a style name string in the Local Variables
       list.  From now on, when you visit the file, CC Mode will
       automatically set the file's style to this one using `c-set-style'.

(The java style is used by default for *.java files, btw.)

> But is does not help (I think, due to c-style-java is buffer local and
> c-mode-hook is processed in another context, I see "not java" in
> *Messages* buffer).

The mode is set before processing file local variables, so
`c-style-java' has the old value at this point.

(CC mode uses hack-local-variables-hook to set the style from
c-file-style.)

-- 
Johan Bockgård


reply via email to

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