tibbe / haskell-style-guide

A style guide for Haskell code.
959 stars 75 forks source link

Add hi2 support #12

Closed iquiw closed 11 years ago

iquiw commented 11 years ago

Add same configuration for hi2 [1], [2] as haskell-indentation.

[1] https://github.com/errge/hi2 [2] http://www.haskell.org/pipermail/haskell-cafe/2013-August/108290.html

iquiw commented 11 years ago

It causes "assignment to free variable" warning at byte compile, but it is not harmful, I think.

The warning can be avoided by using eval-after-load, but I don't know we should do.

 (eval-after-load 'hi2
    '(progn
       (setq hi2-layout-offset 4
             hi2-left-offset 4
             hi2-ifte-offset 4)))

Maybe, better to keep this pending until someone gives an advice?

tibbe commented 11 years ago

Maybe, better to keep this pending until someone gives an advice?

Sounds good.

hvr commented 11 years ago

@iquiw eval-after-load should be perfectly fine, as it makes sure the setq is evaluated as soon as hi2 gets loaded (and thus the defcustoms declaring the variables have been seen).

However, the progn is not needed here, as setq is a single command, i.e. just use

(eval-after-load 'hi2
  '(setq hi2-layout-offset 4
         hi2-left-offset 4
         hi2-ifte-offset 4))
hvr commented 11 years ago

@tibbe why did you add that global(!) tab-width override?

tibbe commented 11 years ago

why did you add that global(!) tab-width override?

Because I have very little to no understanding of elisp. :)

hvr commented 11 years ago

@tibbe I see :-)

in any case, setting tab-width to 4 for Haskell source files is very bad, as the Haskell report hardcodes the tab width to 8 characters; see Haskell 2010, section 10.3 which states

  • Tab stops are 8 characters apart.
  • A tab character causes the insertion of enough spaces to align the current position with the next tab stop.

and in Emacs tab-width defines how an actual \t in the text file is interpreted.

PS: The haskell-mode initialization code sets the tab-width expliclity to 8 for this reason.

tibbe commented 11 years ago

@hvr this was a failed attempts to have the tab key generate 4 spaces.

iquiw commented 11 years ago

I added this configuration in my local init.el. So closing this pull request for now.