2012-06-11

emacs 24: {beginning-of-defun, end-of-defun} in {C, C++} modes

Perm URL with updates: http://xahlee.org/emacs/emacs24_features.html

There's some changes on how the cursor moves when you call {beginning-of-defunCtrl+Alt+Home】, end-of-defunCtrl+Alt+End】} in {C,C++} modes in emacs.

Now, it move the cursor just one level up of a nested block. Before, it moves several levels up to actual function/class definition, out of several nested blocks of code if necessary.

Here's a sample C++ template code you can test on.

namespace my_namespace {

  void func1() {
  }

  void func2() {
  }
  
  class MyClass {
  public:
    MyClass() {
    }

    void method1() {
    }

    void method2() {
    }
  };

}

Here's a video showing the difference. (Thanks a lot to David Capello.)

〈C++ navigation in Emacs 23.4 vs Emacs 24.1〉, by David Capello