Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Emacs Lisp Haskell

Merge pull request #7 from craigcitro/hoogle-cleanup

Improve printing of hoogle output.
latest commit 071cb6ffbe
@pheaver authored
Failed to load latest commit information.
.gitignore Add back haskell-site-file.el until further discussion.
Makefile Added import jumping/navigation.
NEWS Finalized 2.8.0 Minor doc formatting tweaks
fontlock.hs Add code to test as/hiding/qualified.
ghc-core.el Remember to include ghc-core.el
haskell-align-imports.el Import formatting utilities.
haskell-c.el New file.
haskell-cabal.el Extend cabal font-lock keywords to support more section keywords
haskell-checkers.el Add haskell-checkers module that provides support for hs-lint and hs-…
haskell-decl-scan.el Various fixes for Emacs 21.
haskell-doc.el Add missing `:group's to defcustoms.
haskell-font-lock.el Avoid treating -->, etc., as comments
haskell-ghci.el Set comint-process-echoes to nil. Which is the default.
haskell-hugs.el Allow non-ASCII names.
haskell-indent.el Add missing `:group's to defcustoms.
haskell-indentation.el Make available cl's `incf` definition in `haskell-indentation.el`
haskell-mode.el Merge pull request #7 from craigcitro/hoogle-cleanup
haskell-move-nested.el Added haskell-move-nested.
haskell-navigate-imports.el Added import jumping/navigation.
haskell-package.el Simple interface for reading to Cabal packages.
haskell-simple-indent.el Unindent support for simple-indent.
haskell-site-file.el Add back haskell-site-file.el until further discussion.
haskell-sort-imports.el Import formatting utilities.
indent.hs Turn off adaptive fill, until it's fixed
inf-haskell.el tweak comint-prompt-regexp to avoid locking in certain situations.

Haskell Mode for Emacs

This is the Haskell mode package for Emacs. Its use should be mostly self-explanatory if you're accustomed to Emacs.

When Emacs is started up, it normally runs a file called ~/.emacs located in your home directory. This file should contain all of your personal customisations written as a series of Elisp commands. In order to install the Haskell mode, you have to tell Emacs where to find it. This is done by adding some commands to the init file.


  • If you are using XEmacs, the haskell-mode package may be available for installation through the XEmacs package UI.

  • If you are using Debian, you may be able to install the package haskell-mode with a command like "apt-get install haskell-mode".


  • Download and unpack the basic mode and modules into a suitable directory, e.g. ~/lib/emacs/haskell-mode/ where ~ stands for your home directory.

  • If you are using Emacs 21, you need an additional library, "syntax", from a later version of Emacs. The one you can get as*checkout*/emacs/emacs/lisp/emacs-lisp/syntax.el?rev=1.16 definitely works.

  • Assuming you have placed the basic mode haskell-mode.el and the modules you want to use in the directory ~/lib/emacs/haskell-mode/, add the following command to your init file (~/.emacs):

    (load "~/lib/emacs/haskell-mode/haskell-site-file")

    This only loads the bare-bones haskell-mode. To make it useful, you need additional modules; you can use the haskell customize-group to edit the Haskell mode hook or, if you prefer manual setup, try adding the following lines according to which modules you want to use:

    (add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode)
    (add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)
    ;;(add-hook 'haskell-mode-hook 'turn-on-haskell-indent)
    ;;(add-hook 'haskell-mode-hook 'turn-on-haskell-simple-indent)

    Note that the three indentation modules are mutually exclusive - add at most one. Note that the line of code for simple indentation is commented out (using a preceeding ;) in preference for the more advanced indentation module. Installation is now complete!

The other modules are automatically loaded when needed in the following way:

  • Font locking: just turn it on via global-font-lock-mode or do (add-hook 'haskell-mode-hook 'font-lock-mode)

  • Declaration scanning: just use M-x imenu or bind imenu to a key. E.g. (global-set-key [(control meta down-mouse-3)] 'imenu) or you can also add it to the menubar with (add-hook 'haskell-mode-hook 'imenu-add-menubar-index)

  • Interaction with inferior Haskell interpreter: just hit C-c C-z or C-c C-l.


Normally, inf-haskell automatically finds ghci or hugs in your PATH, but if that's not the case (common under Windows), or if you need to specify your preference, just tell Emacs which executable to use with:

(setq haskell-program-name "/some/where/ghci.exe")

If you want to use different settings when you use Cygwin Emacs and NTEmacs, you can test the value of system-type:

(setq haskell-program-name
      (if (eq system-type 'cygwin)

Note that Cygwin binaries tend to interact poorly with NTEmacs, especially w.r.t signal-handling.


Most customizations are on the functionality of a particular module. See the documentation of that module for information on its customisation.

There is also a wiki page listing tips and tricks.

Known problems

It seems that some versions of XEmacs come without the fsf-compat package (which provides functions such as line-end-position) and it seems that even if your XEmacs does have the fsf-compat package installed it does not autoload its part. Thus you may have to install the fsf-compat package and add (require 'goto-addr) in your .emacs.

Multi-mode editing

For LaTeX-based literate Haskell, you might be interested in the multiple major mode package haskell-latex.el (plus multi-mode.el) from


Something went wrong with that request. Please try again.