Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Customize indentation width in haskell-indentation mode

I am currently using Emacs as my primary IDE for developing Haskell code and I am really satisfied so far. But at the moment I can't figure out one little detail, namely how to customize the indentation width to be 4 instead of 2.

Currently I have turned on the haskell-indentation in haskell-mode, but I can't figure out what variable I have to set to customize the indentation width. So far I have tried to set '(haskell-indent-spaces 4) but this doesn't seem to have any effect at all...

Thx in advance for any help!

like image 570
bmk Avatar asked Jan 08 '23 15:01

bmk


2 Answers

haskell-indentation-mode offers a couple of knobs you can turn to customize indentation offsets:

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

All of those are customization variables so you can do M-x customize-option RET and customize any of those, or if you prefer programatically:

(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)
 )
like image 90
Gracjan Polak Avatar answered Jan 24 '23 02:01

Gracjan Polak


Based on the source of haskell-indentation, it looks like 2 is hardcoded in the file so you'll have to edit it manually.

like image 33
gallais Avatar answered Jan 24 '23 04:01

gallais