Emacs 中两种模式下更好的缩进
我正在使用 Emacs 来修改 Perl 和 Verilog 交错的代码。我正在使用 two-mode-mode
在两者之间切换,这按预期工作。问题是 Perl 代码是用 //;
逐行指示的,如下所示:
This is verilog code
// This is a verilog comment
//; This is perl code
//; This is more perl code
This is verilog code again.
虽然两模式识别它是 Perl,但它是逐行执行的为基础,所以 缩进等跨行没有意义。
我想做的是让 Perl 代码像往常一样格式化,但忽略 //;
字符(它们应该单独留在行的开头,然后像往常一样格式化 Perl )。有什么简单的方法可以做到这一点吗?我刚刚开始查看模式文件,它们很复杂,所以任何提示将不胜感激!
I am using Emacs to modify code which is interleaving Perl and Verilog. I am using two-mode-mode
to switch between the two, which works as expected. The problem is that the perl code is indicated on a line by line basis with //;
as shown here:
This is verilog code
// This is a verilog comment
//; This is perl code
//; This is more perl code
This is verilog code again.
While the two-mode-mode recognizes that it's Perl, it does it on a line by line basis, so
indentation and such is not meaningful across lines.
What I would like to do is have the Perl code be formatted as usual, but ignoring the //;
characters (they should just be left alone at the start of the line, then the Perl formatted as usual). Any ideas of an easy way to do this? I've just started peeking at the mode files and they are understandably complicated, so any hint would be appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用不同的多模式模式可能会更好:
http://www.emacswiki.org/emacs/多种模式
AFAIK,mumamo 是目前最活跃的一种。
You might have better luck with a different multi-mode mode:
http://www.emacswiki.org/emacs/MultipleModes
AFAIK, mumamo is the most active one these days.