开发者

Display nested function with which-function-mode in Emacs

Turning which-function-mode on in Emacs displays the function name in the status bar of the current function where the cursor is at. However, when there're nested functions or method inside class, only the outer most function is displayed.

For example, I have the following class in C++.


class Foo
{
   void func1()
  开发者_JAVA百科 {
      ...
   }
};

When the cursor is inside func1(), the class name Foo is displayed on the status bar. How do I make it to display Foo plus func1? Something like Foo.func1 or Foo::func1 would be good.


The which-func feature uses imenu features by default to get it's display name. I don't think there is a way to get the feature you're looking for by default.

If you install CEDET, it can override the which-func feature to get names using it's parser system, then it will do exactly what you describe, though it uses "." by default.


You might try it with library imenu+.el loaded as well. Dunno whether that will help. Otherwise, you can try tweaking the definition of which-function so that it uses a function such as symbol-name-near-point, which is in library thingatpt+.el. See also Thing At Point+.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜