Emacs 中两种模式下更好的缩进

发布于 2024-11-10 17:13:11 字数 568 浏览 3 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情绪操控生活 2024-11-17 17:13:11

使用不同的多模式模式可能会更好:

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文