* File-specific cc-mode settings
@ 2007-08-22 19:37 Alexander Kotelnikov
0 siblings, 0 replies; 2+ messages in thread
From: Alexander Kotelnikov @ 2007-08-22 19:37 UTC (permalink / raw)
To: help-gnu-emacs
Hello.
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:
*/
in the end of such file and
(setq c-style-java nil)
(setq safe-local-variable-values '((c-style-java . t)) )
(add-hook 'c-mode-hook
'(lambda ()
(if c-style-java
(progn
(c-set-style "java")
(message "java")
)
(message "not java")
)
)
)
to ~/.emacs
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).
Is there a way to achieve the result I want?
Thanks,
--
Alexander Kotelnikov
Saint-Petersburg, Russia
^ permalink raw reply [flat|nested] 2+ messages in thread
[parent not found: <mailman.5135.1187812509.32220.help-gnu-emacs@gnu.org>]
* Re: File-specific cc-mode settings
[not found] <mailman.5135.1187812509.32220.help-gnu-emacs@gnu.org>
@ 2007-08-23 8:24 ` Johan Bockgård
0 siblings, 0 replies; 2+ messages in thread
From: Johan Bockgård @ 2007-08-23 8:24 UTC (permalink / raw)
To: help-gnu-emacs
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-08-23 8:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-22 19:37 File-specific cc-mode settings Alexander Kotelnikov
[not found] <mailman.5135.1187812509.32220.help-gnu-emacs@gnu.org>
2007-08-23 8:24 ` Johan Bockgård
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.