2

I am using configuration.nix to install both emacs and haskellMode package in a way:

environment.systemPackages = with pkgs; [
  (haskellPackages.ghcWithPackages (self : [
     self.cabalInstall
     self.happy
     self.alex
     self.ghcMod
  ]))
  emacs
  emacs24Packages.haskellMode
];

My .emacs file contains:

(require 'haskell-mode)
(add-hook 'haskell-mode-hook 'turn-on-hi2)

Emacs then starts with no errors (so I assume that it can find haskell-mode), but it doesn't go to Haskell minor mode when I open .hs files.

~/.nix-profile/share/emacs/site-lisp/haskell-.... files do exist in my profile, if it matters...

So, how do I make it work?

Alexey Raga
  • 7,457
  • 1
  • 31
  • 40
  • Can you manually enable the mode with `M-x haskell-mode RET`? – ChrisGPT was on strike Apr 03 '15 at 15:12
  • Hi @Chris , when I do that I have the following error from Emacs: `Error in post-command-hook (global-font-lock-mode-check-buffers): (void-variable haskell-font-lock-choose-keywords)`. Any idea of what it means? – Alexey Raga Apr 04 '15 at 00:14
  • Looks like `haskell-mode.el` should provide `haskell-font-lock-choose-keywords`, but it seems to be not defined, so `haskell-mode` has not been loaded for some reason? – Alexey Raga Apr 04 '15 at 00:19
  • It does look like something didn't get built properly, but unfortunately I've never used NixOS and I'm not sure how `environment.systemPackages` is meant to work. I install virtually everything through `package.el` and MELPA now that it is in widespread use. Perhaps that would give you better results? – ChrisGPT was on strike Apr 04 '15 at 00:55
  • Yes, MELPA worked for me too, I just wanted it to be part of my "declarative configuration" which is a nice Nixos feature. – Alexey Raga Apr 04 '15 at 09:17

1 Answers1

2

I have experienced the same issue trying to use haskell-indent instead of hi2. Anyways the output you get by doing M-x haskell-mode RET alerts that haskell font-lock is missing.

Solve this by declaring that you (require 'haskell-font-lock).

Then if your .emacs file have the following:

(require 'haskell-mode) (add-hook 'haskell-mode-hook 'turn-on-hi2)

You should add (require 'hi2) as it's pointed here.

(require 'haskell-mode)
(require 'haskell-font-lock)
(require 'hi2)
(add-hook 'haskell-mode-hook 'turn-on-hi2)

Note that hi2.el is not provided by haskell-mode package.

Hope this helps!

arguser
  • 53
  • 9