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

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

Re: distinguish .h files


From: Richard Riley
Subject: Re: distinguish .h files
Date: Wed, 08 Dec 2010 15:32:35 -0000
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.2 (gnu/linux)

Andrea Crotti <andrea.crotti.0@gmail.com> writes:

> It's a bit annoying that the header files .h BUT for c++ are not
> automatically recognized (but of course understandable).
>
> I tried the following approach but it doesn't work, maybe the function
> is executed too early?
> Or what else can be the problem?
>
>
>
>
> --8<---------------cut here---------------start------------->8---
>   (defun is-cpp-header-file ()
>     "enable c++-mode when finding classes"
>     (when (re-search-forward "class ")
>       (c++-mode)))
>
>   ;;(add-hook 'c-mode-common-hook 'is-cpp-header-file)
> --8<---------------cut here---------------end--------------->8---
>

Something like this will do it for you - add the following as a first
line :-

/* -*-c++-*- */

regards

r.


reply via email to

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