[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Emacs *-mode add-hook functions (not working>)
From: |
3246251196ryan |
Subject: |
Re: Emacs *-mode add-hook functions (not working>) |
Date: |
Mon, 10 Nov 2014 09:37:59 -0800 (PST) |
User-agent: |
G2/1.0 |
On Monday, 10 November 2014 15:49:34 UTC, 3246251...@gmail.com wrote:
> On Sunday, 9 November 2014 23:15:06 UTC, 3246251...@gmail.com wrote:
> > I will test out whether or not the hook function gets called tomorrow.
>
> Okay, the hook function is actually working which is strange. So the problem
> remains:
>
>
> That I must firstly open a C++ file in order to get CEDET to parse the
> headers. Once I do that I there is no problem opening up a .h file, it works.
> However, if I start emacs and firstly open a .h file I am forced to do M-x
> c-mode - but once that is done everything is fine thereafter.
>
> Just trying to figure out why this is the case.
To mark this as SOLVED:
I have got this working by including a simple clause in the function called on
hook.
(if (string= "c-mode" major-mode)
(progn
(c++-mode))) ;; Switch C mode to C++ mode (because we use .h!)
Now things just work. I also forgot failed to realise how useful it is to
switch to C++-mode when looking at a C++ .h file: the emacs colouring is all
correct when in C++-mode, eg:
static void MyStatFunc();
the keyword were not being read correctly, so void would be the colour of the
method name etc.
All good now with this hack, but still wondering why I needed to do M-x c-mode
again in the first place to get things to run.
Message not available