Search code examples
emacsfont-lockhaskell-mode

Haskell files are not recognize by `haskell-mode`


I am fairly new to Emacs - transitioning from Neovim. I have the following line in my config file:

(use-package haskell-mode)

When I open any Haskell file, I see no effect, e.g., no syntax highlighting and in the lower right corner it says my major mode is Fundamental instead of Haskell.


Solution

  • Likely a duplicate question - please search and delete if so.

    "Using a package" doesn't apply any mode to any particular buffers visiting any particular kind of file.

    If haskell-mode is a major mode then adjust the value of variable auto-mode-alist, so that it has one or more associations that turn it on when the relevant file types are visited.

    If it's a minor mode then enable it in on the major-mode hook, haskell-mode-hook.


    UPDATED after comments by OP that haskell-mode is in auto-mode-alist by default:

    If it appears to be in auto-mode-alist by default, then check whether something in your init file is causing this. Test by starting with emacs -Q (no init file).

    If you see haskell-mode in auto-mode-alist with your init file and you don't see it without your init file, then something in your init file is putting it there. ;-)

    If that's the case, and you don't see any syntax highlighting even when haskell-mode is used, then your question isn't about getting haskell-mode turned on; it's about not getting some highlighting that you expect even when that mode is on. Then check font-lock for that mode.