|
From: Sezaru <se...@gm...> - 2013-05-22 21:08:45
|
cc-mode sometimes loose the indentation when working with c++ header files,
there is another thread with some similar problem here but the workaround
shown there does not work and it was said that in emacs-24.3 it was fixed,
which is the version I'm using and it still have the problem, so I decided
to create a new thread as it look like a diferent issue is causing the
problem.
I've tested this problem in my gentoo emacs 24.3 build and in a vanilla one
download from the official website. The bug persists in both even when
using the built-in cc-mode or the lastest direct from the repositories. It
also persistis when using -q option, so it is not another mode conflicting
with cc-mode.
I've made a little example to reproduce the problem:
#ifndef TEST_H_
#define TEST_H_
class Test
{
public:
Test(void);
Foo(void);
Bar(void);
};
#endif // TEST_H_
Save this code as test.hpp, now open it, and there will be 3 empty lines
between #define TEST_H and class Test, in the second empty line paste this:
#include <iostream>
Now the indentation will fail and every line you try to indentate will not.
Beware that you need to paste the #include <iostream> in the code and not
simply write it, if you write character by character the indentation will
still works as it should, it only breaks when you paste it (or at least it
was the only way I've found to reproduce it)
Thanks!
|