can't use "S" in normal mode with haskell-mode

Linus Arver linusarver at
Wed Mar 20 01:52:04 CET 2013

On Tue, Mar 19, 2013 at 06:32:24PM +0100, Michael Markert wrote:
> On Tue, Mar 19 2013 (18:13), Linus Arver <linusarver at> wrote: 
> > So I guess haskell-mode-hook is responsible for this. I've looked at
> > haskell-mode.el and it appears that this function is responsible:
> >
> >     (defun haskell-mode-suggest-indent-choice ()
> >       "Ran when the user tries to indent in the buffer but no indentation mode has been selected.
> >     Brings up the documentation for haskell-mode-hook."
> >       (describe-variable 'haskell-mode-hook))
> Yes, well the easy way is: Configure your haskell mode correctly and
> turn on an indentation mode.

I've tried all of haskell-mode's indentation modes, and I despise them
all. =( I like to use my own, very simple indentation style that's *not*
obsessed with exactly lining up the current line within the context of
whatever is on the previous line. And plus, I like to use tabs, unlike
all other Haskellers out there...

Actually, the *only* reason why I use haskell-mode is for syntax
highlighting support.

> > Maybe evil-change-whole-line for "S" (and also "cc", as this triggers the
> > same behavior) has some indenting code in it, which ends up triggering
> > haskell-mode-suggest-indent-choice?
> Actually not direct, but when it does when entering insert-state, this
>     (add-hook haskell-mode-hook (lambda () (setq evil-auto-indent nil)))
> should work around it.

This works wonderfully! Thank you very much.

For what it's worth, here is my current Haskell-specific code for
dead-simple indentation in my ~/.emacs:

    ; custom indentation function: copy the indentation of the previous line
    ; adopted from
    (defun newline-and-indent-relative ()
        (indent-to-column (save-excursion
            (forward-line -1)
    ; Haskell {{{
    ; adopted from
    (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 evil-auto-indent nil)
            (setq tab-width 4)
            (setq indent-tabs-mode t)
    ; make indentation saner when inserting new lines, whether from insert mode or normal mode
    (evil-declare-key 'insert haskell-mode-map (kbd "RET") 'newline-and-indent-relative)
    (evil-declare-key 'normal haskell-mode-map "o"
        (lambda ()
            (evil-append-line 1)
    (evil-declare-key 'normal haskell-mode-map "O"
        (lambda ()
            (evil-append-line 1)


More information about the implementations-list mailing list