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



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

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

提前感谢任何帮助!

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

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

最新更新