Java模式缩进
Java 模式似乎是在方法声明后取消缩进而不是缩进。
我的意思是我希望看到这个:
class GoodExample {
public void method() {
allNicelyIndented();
noProblemsHere();
}
}
但是得到这个:
class CrazyIndenting {
public void method() { // ((inclass 134) (topmost-intro 326))
whyIsThisUnindented(); // ((defun-block-intro 379))
itsMessingWithMyHead(); // ((statement 454))
}
}
Mx c-set-style RET java
然后Cx h CM-\
确认它是对整个缓冲区使用java风格。
使用 cc-modes 交互功能,< code>Cc Cs 给出了我在格式错误的代码后面添加的注释中的符号,Cc Co
建议看起来合理的默认值。 (0、+ 和 0 按语句降序排列)
查看我的 .emacs,我看不到任何可能会扰乱 cc 模式的内容,所以我对下一步调查的方向有点困惑。语句的取消缩进小于方法声明的缩进(2 个“空格”而不是 4 个),所以也许存在一些制表符/空格混淆?
版本:Emacs 22.2.1、JDE 2.3.5.1 和 CC 模式 5.31.5。
Java-mode seems to be unindenting rather than indenting after a method declaration.
By which I mean I'd expect to see this:
class GoodExample {
public void method() {
allNicelyIndented();
noProblemsHere();
}
}
But instead get this:
class CrazyIndenting {
public void method() { // ((inclass 134) (topmost-intro 326))
whyIsThisUnindented(); // ((defun-block-intro 379))
itsMessingWithMyHead(); // ((statement 454))
}
}
M-x c-set-style RET java
and then C-x h C-M-\
confirms that it is using the java style for the whole buffer.
Using cc-modes interactive features, C-c C-s
gives the symbols I've put in comments after the wrongly formatted code, and C-c C-o
suggests default values that look sensible. (0, + and 0 in descending statement order)
Looking through my .emacs, I can't see anything that might be messing with cc-mode, so I'm a bit stuck for directions to investigate next. The unindent for the statement is less than the indent for the method declaration (2 "spaces" instead of 4), so perhaps there's some tab/space confusion?
Versions: Emacs 22.2.1, JDE 2.3.5.1 and CC-mode 5.31.5.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
虽然我不确定是什么导致了您的 JDEE 问题,但我建议您尝试 malabar-mode< /a> 相反。它是 Emacs 中唯一结合了现代内容(例如与 maven 和 groovy 集成)的 Java 模式,并且正在积极开发中......
除此之外 - 我很确定基本的 Java 缩进可以与 JDEE 一起使用(甚至与较旧的java模式),所以问题可能是由您的配置引起的(我猜尤其是cc模式配置)。
Although I'm not sure what's causing your problems with JDEE, I can suggest you to try out malabar-mode instead. It's the only Java mode in Emacs that's incorporating modern stuff(such as integration with maven and groovy) and is under active development...
Other than this - I'm pretty sure that basic Java indentation works ok with JDEE(and even with the older java-mode), so the problem is probably caused by you config(cc-mode configuration in particular I guess).