我目前使用 Emacs 作为开发 Haskell 代码的主要 IDE,到目前为止我真的很满意。但目前我无法弄清楚一个小细节,即如何将缩进宽度自定义为 4 而不是 2。
目前我已经打开了haskell-indentation
in haskell-mode
,但我不知道我必须设置什么变量来自定义缩进宽度。到目前为止,我已经尝试设置'(haskell-indent-spaces 4)
,但这似乎根本没有任何效果......
提前谢谢您的帮助!
我目前使用 Emacs 作为开发 Haskell 代码的主要 IDE,到目前为止我真的很满意。但目前我无法弄清楚一个小细节,即如何将缩进宽度自定义为 4 而不是 2。
目前我已经打开了haskell-indentation
in haskell-mode
,但我不知道我必须设置什么变量来自定义缩进宽度。到目前为止,我已经尝试设置'(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
在文件中硬编码,因此您必须手动编辑它。