Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable Indentation #90

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

Disable Indentation #90

jbsiddall opened this issue Nov 6, 2012 · 8 comments

Comments

@jbsiddall
Copy link

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
Copy link
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
Copy link

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.

@rightfold
Copy link

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

@mx4492
Copy link

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

@jarmitage
Copy link

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

@gracjan
Copy link
Contributor

gracjan commented Jul 5, 2016

(haskell-indentation-mode -1)

@jarmitage
Copy link

@gracjan I'm afraid that doesn't work

@listx
Copy link

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
Projects
None yet
Development

No branches or pull requests

9 participants