Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 150 lines (105 sloc) 5.688 kb
367c8fe @tibbe Convert README to markdown
tibbe authored
1 Haskell Mode for Emacs
2 ----------------------
3
4 This is the Haskell mode package for Emacs. Its use should be mostly
5 self-explanatory if you're accustomed to Emacs.
6
7 When Emacs is started up, it normally runs a file called ~/.emacs located in
8 your home directory. This file should contain all of your personal
9 customisations written as a series of Elisp commands. In order to install
10 the Haskell mode, you have to tell Emacs where to find it. This is done by
11 adding some commands to the init file.
12
13 Installation
14 ------------
15
16 - If you are using XEmacs, the haskell-mode package may be available for
17 installation through the XEmacs package UI.
18
19 - If you are using Debian, you may be able to install the package
20 haskell-mode with a command like "apt-get install haskell-mode".
21
22 Otherwise:
23
24 - Download and unpack the basic mode and modules into a suitable directory,
25 e.g. ~/lib/emacs/haskell-mode/ where ~ stands for your home directory.
26
27 - If you are using Emacs 21, you need an additional library, "syntax", from
28 a later version of Emacs. The one you can get as
29 http://cvs.savannah.gnu.org/viewcvs/*checkout*/emacs/emacs/lisp/emacs-lisp/syntax.el?rev=1.16
30 definitely works.
31
32 - Assuming you have placed the basic mode haskell-mode.el and the modules
33 you want to use in the directory ~/lib/emacs/haskell-mode/, add the
34 following command to your init file (~/.emacs):
35
36 (load "~/lib/emacs/haskell-mode/haskell-site-file")
37
38 This only loads the bare-bones haskell-mode. To make it useful, you
bc8ee6d @tibbe Minor doc formatting tweaks
tibbe authored
39 need additional modules; you can use the haskell `customize-group`
367c8fe @tibbe Convert README to markdown
tibbe authored
40 to edit the Haskell mode hook or, if you prefer manual setup, try
41 adding the following lines according to which modules you want to use:
42
43 (add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode)
44 (add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)
45 ;;(add-hook 'haskell-mode-hook 'turn-on-haskell-indent)
46 ;;(add-hook 'haskell-mode-hook 'turn-on-haskell-simple-indent)
47
48 Note that the three indentation modules are mutually exclusive - add at
49 most one. Note that the line of code for simple indentation is commented
bc8ee6d @tibbe Minor doc formatting tweaks
tibbe authored
50 out (using a preceeding `;`) in preference for the more advanced
367c8fe @tibbe Convert README to markdown
tibbe authored
51 indentation module. Installation is now complete!
52
53 The other modules are automatically loaded when needed in the following way:
54
55 - Font locking: just turn it on via `global-font-lock-mode` or do
56 `(add-hook 'haskell-mode-hook 'font-lock-mode)`
57
58 - Declaration scanning: just use M-x imenu or bind `imenu` to a key. E.g.
59 `(global-set-key [(control meta down-mouse-3)] 'imenu)` or you can also add
60 it to the menubar with `(add-hook 'haskell-mode-hook 'imenu-add-menubar-index)`
61
62 - Interaction with inferior Haskell interpreter: just hit C-c C-z or C-c C-l.
63
64
65 Setup
66 -----
67
68 Normally, inf-haskell automatically finds ghci or hugs in your PATH, but if
69 that's not the case (common under Windows), or if you need to specify your
70 preference, just tell Emacs which executable to use with:
71
72 (setq haskell-program-name "/some/where/ghci.exe")
73
74 If you want to use different settings when you use Cygwin Emacs and NTEmacs,
75 you can test the value of `system-type`:
76
77 (setq haskell-program-name
78 (if (eq system-type 'cygwin)
79 "/cygdrive/c/ghc/ghc-6.8.1/bin/ghcii.sh"
80 "c:/ghc/ghc-6.8.1/bin/ghci.exe"))
81
82 Note that Cygwin binaries tend to interact poorly with NTEmacs, especially
83 w.r.t signal-handling.
84
2fc2392 @chrisdone Document haskell-intercative-mode.
chrisdone authored
85 Setup for new interactive mode
86 ------------------------------
87
88 A new mode for the REPL and GHCi sessions is called
89 haskell-interactive-mode, it intends to replace inferior-haskell-mode,
90 but comes with different features.
91
92 There are new modules for handling the following things:
93
94 * Separate sessions per Cabal project (haskell-session.el).
95 * A new inferior Haskell process handling code (haskell-process.el).
96 * New REPL (haskell-interactive-mode.el).
97 * Bunch of new features based upon the above three things.
98
99 To make use of them, try out the instructions in
100 `examples/init.el`. WARNING: The features expressed in here are new
101 and many are Linux-specific.
102
103 Note: These features are entirely orthogonal to the older
104 inferior-haskell-mode, and therefore keybindings which work for
105 inferior-haskell-mode will not magically work for the above new
106 modules.
107
367c8fe @tibbe Convert README to markdown
tibbe authored
108
109 Customization
110 -------------
111
112 Most customizations are on the functionality of a particular module.
113 See the documentation of that module for information on its
114 customisation.
115
116 There is also a [wiki page listing tips and
117 tricks](http://www.haskell.org/haskellwiki/Haskell_mode_for_Emacs).
118
119 Known problems
120 --------------
121
122 It seems that some versions of XEmacs come without the fsf-compat package
123 (which provides functions such as `line-end-position`) and it seems that
124 even if your XEmacs does have the fsf-compat package installed it does not
125 autoload its part. Thus you may have to install the fsf-compat package and
126 add `(require 'goto-addr)` in your .emacs.
127
128
129 Multi-mode editing
130 ------------------
131
132 For LaTeX-based literate Haskell, you might be interested in the
133 multiple major mode package haskell-latex.el (plus multi-mode.el) from
134 http://www.loveshack.ukfsn.org/emacs/.
135
136
137 Support
138 -------
139
140 - [Github homepage](https://github.com/haskell/haskell-mode)
141 - [Mailing list](http://projects.haskell.org/cgi-bin/mailman/listinfo/haskellmode-emacs)
c906ee1 @chrisdone Linked to Contributing page on Github wiki.
chrisdone authored
142
143 Contributing
144 ------------
145
146 For submitting pull requests, please see the wiki
147 [page on contributing](https://github.com/haskell/haskell-mode/wiki/Contributing). You
148 don't have to follow this guide, but please make sure your pull
149 requests are at least properly rebased and up to date.
Something went wrong with that request. Please try again.