-
Notifications
You must be signed in to change notification settings - Fork 349
Description
I am attempting to add a dependency automatically to a cabal file. However, after the insertion, the cabal file is completely broken. This happens if indent-tabs-mode is set to true, even if it is set to false for haskell-cabal mode.
Steps to reproduce
Start with default auto-generated minimal cabal file.
With that file in the current buffer run:
(setq-default indent-tabs-mode t)
(haskell-cabal-add-dependency "foo" "3" nil nil)
Answer yes to prompts
Expected result
name: test
version: 0.1.0.0
license-file: LICENSE
build-type: Simple
cabal-version: >=1.10
executable test
main-is: Main.hs
build-depends: foo >= 3
, base >=4.7 && <4.8
default-language: Haskell2010
Actual result
name: test
version: 0.1.0.0
license-file: LICENSE
build-type: Simple
cabal-version: >=1.10
executable test
main-is: Main.hs
build-depends: foo >= 3
, 4.8
default-language: Haskell2010
Note that the weird indentation and lack of base is verbatim copied from my editor. The whitespace between build-depends: and foo is tabs, not spaces.
Notes
As mentioned above, this happens if tabs are turned on, even if they are turned off for all haskell related modes. Adding more dependencies after this only makes the file wonkier.
If I undo the (haskell-cabal-add-dependency "foo" "3" nil nil) command, set indent-tabs-mode to nil, and re-add the dependency, it is inserted correctly this time.