【发布时间】:2013-11-28 20:33:10
【问题描述】:
我必须做一项非常具体的任务来一遍又一遍地重做,并希望将其永久保存在我的.emacs 文件中。但是我对 emacs-lisp 不够精通来管理它:
- Keystroke-1,比如
[F8]- 记住当前光标的列位置,例如
xtab
- 记住当前光标的列位置,例如
- Keystroke-2,说
[F9],而光标在其他行:- 在当前行中找到最左边的字符串
//,如果没有,哔并停止 - 插入尽可能多的空格,以便
//到达先前记住的列xtab,或者如果光标已经超出xtab,则不执行任何操作 - 向前搜索下一个
//并将光标放在上面
- 在当前行中找到最左边的字符串
我设法将它分配给一个临时键盘宏,但必须为每次更改 xtab 值重新记录它。
最终目标是我想在不同的代码段中轻松对齐 cmets,来自
int main() { // the enty function
int x = 100; // my new variable
for(int i=1; i<2012; ++i) { // loop a lot
x -= i;
}
} // end of all things
到
int main() { // the entry function
int x = 100; // my new variable
for(int i=1; i<2012; ++i) { // loop a lot
x -= i;
}
} // end of all things
知道如何实现自动化吗?我必须在我的 .emacs-file 中放入什么来存档这个 - 或类似的?
【问题讨论】:
标签: emacs comments alignment text-formatting