Skip to content

Turn-on-haskell-indentation hook won't enable haskell-indentation #654

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

Closed
dredozubov opened this issue May 18, 2015 · 9 comments · Fixed by #673
Closed

Turn-on-haskell-indentation hook won't enable haskell-indentation #654

dredozubov opened this issue May 18, 2015 · 9 comments · Fixed by #673

Comments

@dredozubov
Copy link

After recent updates(at least i think it's related to them) i experience following error when emacs tries to indent a haskell source:

You tried to do an indentation command, but an indentation mode has not been enabled yet.

Run M-x describe-variable haskell-mode-hook for a list of such modes.

Inspecting haskell-mode-hook shows:

haskell-mode-hook is a variable defined in `haskell-mode.el'.
Its value is
(company-mode haskell-auto-insert-module-template flymake-hlint-load
              (lambda nil
                (ghc-init))
              interactive-haskell-mode turn-on-haskell-indentation)


  This variable may be risky if used as a file-local variable.

Documentation:
Hook run after entering Haskell mode.
No problems result if this variable is not bound.
`add-hook' automatically binds it.  (This is true for all hook variables.)

I have a (add-hook 'haskell-mode-hook 'turn-on-haskell-indentation) line in my ~/.emacs and it worked until recently. Running M-x haskell-indentation-mode manually helps with this issue(and then it repeats with other buffers).

@geraldus
Copy link
Contributor

I've faced same issue, but I thought it was my fault.

@geraldus
Copy link
Contributor

I'm not sure is this related to issue subject, but in past interactive-mode always asked me to start a new session or select existing one when I open haskell source file from new location (i.e. project). And now if I open .hs file interactive-mode will be activated silently, and will ask nothing.

@dredozubov
Copy link
Author

@gracjan thanks for clarification on the matter.

It should be enabled as (add-hook 'haskell-mode-hook 'haskell-indentation-mode), not (add-hook 'haskell-mode-hook 'turn-on-haskell-indentation).

Docs are not up to date with this and i was thinking of fixing it and opening a PR quickly, but it seems that it is a bigger issue. Isn't turn-on- counterparts supposed to go if they're not working anymore? It seems unintentional that these functions do not work automatically as hooks, maybe it should be fixed w/o updating docs?

@gracjan
Copy link
Contributor

gracjan commented May 19, 2015

You are right on both points:

  1. Documentation should be updated.
  2. Old functions should still work (marked as deprecated).

I'm not sure why they stopped working.

@geraldus
Copy link
Contributor

In my case M-x turn-on-haskell-indentation works, but does it silently.

@geraldus
Copy link
Contributor

@dredozubov is it still relevant (sorry I've missid Gitter notifications)?

@biboudis
Copy link

Just a small remark because I struggled with this for a couple of minutes. Order matters.

(add-hook 'haskell-mode-hook 'haskell-indentation-mode)
(add-hook 'haskell-mode-hook 'interactive-haskell-mode)

Not the other way around.

@gracjan
Copy link
Contributor

gracjan commented Aug 30, 2015 via email

@biboudis
Copy link

Thx. I will investigate this with my colleague who is a more advanced emacs user than me. I will post findings here /cc @gbalats.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants