在haskell-indentation模式下自定义缩进宽度

时间:2015-09-05 10:35:10

标签: haskell emacs haskell-mode

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

目前我已打开haskell-indentation中的haskell-mode,但我无法弄清楚我必须设置哪个变量来自定义缩进宽度。 到目前为止,我已经尝试设置'(haskell-indent-spaces 4),但这似乎没有任何影响......

提前获取任何帮助!

2 个答案:

答案 0 :(得分:5)

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)
 )

答案 1 :(得分:3)

基于haskell-indentation的{​​{3}},文件中的2似乎是硬编码的,因此您必须手动编辑它。