Disable Indentation #90

Closed
jbsiddall opened this Issue Nov 6, 2012 · 8 comments

Comments

Projects
None yet
9 participants
@jbsiddall

Hi,
Is there anyway you can disable the haskell-mode indentation, so why you hit TAB it inserts a tab characters, no spaces, no aligning with previous line?

@ivan-m

This comment has been minimized.

Show comment Hide comment
@ivan-m

ivan-m Nov 6, 2012

Contributor

Use haskell-simple-indent?

Though you shouldn't have TAB insert literal tab characters; whilst the Haskell spec allows for it (with a tab character being the width of 8 spaces), most Haskellers agree on using spaces rather than tabs (and Cabal disallows literal tab characters in .cabal files).

Contributor

ivan-m commented Nov 6, 2012

Use haskell-simple-indent?

Though you shouldn't have TAB insert literal tab characters; whilst the Haskell spec allows for it (with a tab character being the width of 8 spaces), most Haskellers agree on using spaces rather than tabs (and Cabal disallows literal tab characters in .cabal files).

@listx

This comment has been minimized.

Show comment Hide comment
@listx

listx Mar 18, 2013

Yes, you can disable haskell-mode's indentation behavior with:

; Haskell {{{
; adopted from http://sequence.complete.org/node/365
(load-library "haskell-site-file")
(add-to-list 'auto-mode-alist '("\\.hs\\'" . haskell-mode))
(remove-hook 'haskell-mode-hook 'turn-on-haskell-indent)
; 4-space tabs
(add-hook 'haskell-mode-hook
    (lambda ()
        (setq tab-width 4)
        (setq indent-tabs-mode t)
    )
)

This version makes each literal TAB character become 4 spaces wide.

listx commented Mar 18, 2013

Yes, you can disable haskell-mode's indentation behavior with:

; Haskell {{{
; adopted from http://sequence.complete.org/node/365
(load-library "haskell-site-file")
(add-to-list 'auto-mode-alist '("\\.hs\\'" . haskell-mode))
(remove-hook 'haskell-mode-hook 'turn-on-haskell-indent)
; 4-space tabs
(add-hook 'haskell-mode-hook
    (lambda ()
        (setq tab-width 4)
        (setq indent-tabs-mode t)
    )
)

This version makes each literal TAB character become 4 spaces wide.

@chrisdone chrisdone closed this May 19, 2013

@rightfold

This comment has been minimized.

Show comment Hide comment
@rightfold

rightfold Oct 10, 2015

@ivan-m haskell-simple-indent does more than just inserting tabs.

@ivan-m haskell-simple-indent does more than just inserting tabs.

mx4492 pushed a commit to mx4492/dotfiles that referenced this issue Mar 3, 2016

Disable haskell-indentation-mode
The current fix [1] did not work for Emacs 24.5.1 and haskell-mode
20160117.1345. The default hook does not have turn-on-haskell-indent
in there anymore. Instead, when haskell-mode is loaded it calls
(haskell-indentation-mode) by default (expecting it to be overridden
by items in the hook).

[1] haskell/haskell-mode#90 (comment)
@mx4492

This comment has been minimized.

Show comment Hide comment
@mx4492

mx4492 Mar 3, 2016

The fix mentioned in #90 (comment) did not work for Emacs 24.5.1 and haskell-mode 20160117.1345. The default hook does not have turn-on-haskell-indent in there anymore. Instead, when haskell-mode is loaded it calls (haskell-indentation-mode) by default (expecting it to be overridden by items in the hook).

The following alternative worked for me -- it explicitly disables the haskell-indentation-mode minor mode.

(add-hook 'haskell-mode-hook (lambda ()
            (make-local-variable 'tab-stop-list)
            (setq tab-stop-list (number-sequence 4 80 4))
            (setq indent-line-function 'indent-relative)
            (haskell-indentation-mode 0)))

mx4492 commented Mar 3, 2016

The fix mentioned in #90 (comment) did not work for Emacs 24.5.1 and haskell-mode 20160117.1345. The default hook does not have turn-on-haskell-indent in there anymore. Instead, when haskell-mode is loaded it calls (haskell-indentation-mode) by default (expecting it to be overridden by items in the hook).

The following alternative worked for me -- it explicitly disables the haskell-indentation-mode minor mode.

(add-hook 'haskell-mode-hook (lambda ()
            (make-local-variable 'tab-stop-list)
            (setq tab-stop-list (number-sequence 4 80 4))
            (setq indent-line-function 'indent-relative)
            (haskell-indentation-mode 0)))

@geraldus geraldus added the indentation label Mar 3, 2016

@jarmitage

This comment has been minimized.

Show comment Hide comment
@jarmitage

jarmitage Jul 5, 2016

Hi, I've tried everything listed here but cannot get haskell-indentation-mode to turn off by default. Any other ideas?

Hi, I've tried everything listed here but cannot get haskell-indentation-mode to turn off by default. Any other ideas?

@gracjan

This comment has been minimized.

Show comment Hide comment
@gracjan

gracjan Jul 5, 2016

Contributor

(haskell-indentation-mode -1)

Contributor

gracjan commented Jul 5, 2016

(haskell-indentation-mode -1)

@jarmitage

This comment has been minimized.

Show comment Hide comment
@jarmitage

jarmitage Jul 8, 2016

@gracjan I'm afraid that doesn't work

@gracjan I'm afraid that doesn't work

@listx

This comment has been minimized.

Show comment Hide comment
@listx

listx Jul 8, 2016

Too bad that the fix I mentioned does not work any more; I have since moved on to my own minor mode called "kakapo-mode" (it's on MELPA) that handles indentation for me, so I cannot really comment how/why my fix from 3 years ago (yikes!) doesn't work any more.

listx commented Jul 8, 2016

Too bad that the fix I mentioned does not work any more; I have since moved on to my own minor mode called "kakapo-mode" (it's on MELPA) that handles indentation for me, so I cannot really comment how/why my fix from 3 years ago (yikes!) doesn't work any more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment