在emacs中编辑C或C ++文件时,我希望能够转到包含的代码块的开头。我原本希望找到一个c-beginning-of-block函数,但是,据我所知,不存在这样的函数。例如,我可能正在编辑以下丑陋的C代码:
void myFunction()
{
if (something) { //<--- I want to jump to this brace!
// do lots of stuff
if (stuff) {
// stuff
}
// more stuff
// ...
// I want to put my cursor somewhere on this line <---
// (anywhere just outside the following if) and call c-beginning-of-block
// and jump to the brace marked above (skipping "sibling" statements)
if (pizza_is_good) {
// do something
// wait, where am I?
}
// way more stuff
// ...
if (i_love_pizza) {
// eat pizza
}
}
}
如果这不是emacs的一部分,我将感到非常惊讶,我只是在任何地方都找不到它...
fortran模式有 fortran-beginning-of-block
程序模式有 promela-find-start-of-containing-block