In emacs, I use C-M-a and C-M-e to go the beginning/end of functions in C++ code. However, this functionality no longer works if the function is enclosed in a namespace (it just jumps to the beginning or end of the namespace enclosure). Does anyone have a good solution for this?
This is a known bug. It has been fixed in Emacs 24.1 which has been released three days ago. Get it. Unfortunately that fix has never been back-ported and it is unlikely that this will happen anytime soon.
Getting Emacs 24.1 which fixes the issue is the best course. If you are stuck on an older version of Emacs, a common work around was to use a preprocessor macro.
#define NAMESPACE_BEGIN(X) namespace X {
#define NAMESPACE_END }
NAMESPACE_BEGIN(tools)
class Foo {
//...
};
NAMESPACE_END
Some practitioners of this had other reasons. I personally liked how it prevented the default Emacs settings from indenting namespace'd code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With