4

我目前使用 Emacs 作为开发 Haskell 代码的主要 IDE,到目前为止我真的很满意。但目前我无法弄清楚一个小细节,即如何将缩进宽度自定义为 4 而不是 2。

目前我已经打开了haskell-indentationin haskell-mode,但我不知道我必须设置什么变量来自定义缩进宽度。到目前为止,我已经尝试设置'(haskell-indent-spaces 4),但这似乎根本没有任何效果......

提前谢谢您的帮助!

4

2 回答 2

6

haskell-indentation-mode提供了几个旋钮,您可以转动它们来自定义缩进偏移:

haskell-indentation-layout-offset
haskell-indentation-starter-offset
haskell-indentation-left-offset
haskell-indentation-ifte-offset
haskell-indentation-where-pre-offset
haskell-indentation-where-post-offset

所有这些都是自定义变量,因此您可以执行M-x customize-option RET和自定义其中任何一个,或者如果您更喜欢以编程方式:

(custom-set-variables
 ;; Customization related to indentation.
 '(haskell-indentation-layout-offset 4)
 '(haskell-indentation-starter-offset 4)
 '(haskell-indentation-left-offset 4)
 '(haskell-indentation-where-pre-offset 4)
 '(haskell-indentation-where-post-offset 4)
 )
于 2015-09-16T14:44:03.743 回答
3

根据的来源haskell-indentation它看起来像是2在文件中硬编码,因此您必须手动编辑它。

于 2015-09-07T09:52:27.477 回答