假设代码:
Command provisionHostCommand = new Command() {
@Override
public void execute() {
final List<Host> hosts = new ArrayList<Host>(display.getSelectionModel().getSelectedSet());
eventBus.fireEvent(new ProvisioningHostEvent(hosts));
}
};
看一下凹痕。 Command匿名类有4个空格。我将我的c-basic-offset设置为2.如何减少匿名类中的缩进空间?
感谢。
答案 0 :(得分:3)
嗯,这似乎对我有用:
(c-set-offset 'inexpr-class 0)
我不太清楚为什么,我看了documentation,似乎暗示匿名类只应缩进c-basic-offset
。也许他们因为开口大括号而缩进两次?
修改:http://www.mail-archive.com/jde@sunsite.auc.dk/msg01159.html的解决方法怎么样?
(add-hook 'c-mode-common-hook
'(lambda ()
(c-set-offset 'substatement-open 0)
(if (assoc 'inexpr-class c-offsets-alist)
(c-set-offset 'inexpr-class 0))))