[Haskell-cafe] ANN: hi2 -- a better indentation mode for Emacs' haskell-mode

Gergely Risko gergely at risko.hu
Fri Aug 9 12:53:56 CEST 2013


Hi,

In the last 2-3 weeks I've been working on Haskell indentation inside
Emacs.  I had some annoyances for a long time and fixed some of them.

The new mode is called hi2, it's heavily based on the current
haskell-indentation (part of haskell-mode).  The changes are mainly to
the UI, although, I plan to have a look on the parser too.

The code can be found on github: https://github.com/errge/hi2.  Feel
free to send me feedback, bug reports, pull requests, etc.

It's also hosted on MELPA.

The most notable changes so far are the following:

  - DEL and C-d is not mapped: if you want to indent backwards, you can
    use S-TAB.  This means no random jumping on backspace anymore.

  - TAB steps to the right as before, but when the end is reached, it
    starts going to the left instead of wrapping around.

  - TAB stays inside the code, instead of going to the beginning of the
    line.  As in pyhton-mode and perl-mode.

  - Region indentation common case is supported: TAB and S-TAB is simply
    moving the whole region to the left/right by 1-column.  Can be
    pressed repeatedly.

  - The current indentations are shown as underscores in the current
    line.  So you have some visual indication on what's gonna happen.
    Also useful while hacking on the parser and want to see the results.
    Can be turned off by setting hi2-show-indentations to nil in your
    init file or calling hi2-disable-show-indentations from the buffer.
    If there are collisions with other overlay hacking modes
    (e.g. fill-column-indicator), try to turn off
    hi2-show-indentations-after-eol.

  - The buffer is not changed when indentation is not changed (so there
    are no undo points created and no dirty flag in the buffer if
    pressing TAB had no effect).

  - The code for all this is somewhat commented and cleaned.

I'm not trying to fork haskell-mode, it's maintained very actively on
github and the maintainers were always friendly through code reviews.
But the current haskell-indentation-mode required so many fixes that it
became unpleasant to contribute patch-by-patch, I wanted to move fast.
When (and if) hi2 gets stable and better in every respect than
haskell-indentation-mode, I'm happy to merge and contribute it back.

Gergely





More information about the Haskell-Cafe mailing list