Skip to content

Commit ca37035

Browse files
committed
Merge pull request #1058 from bergey/user-manual
User manual updates
2 parents c1afdd0 + 9af63c4 commit ca37035

File tree

3 files changed

+82
-61
lines changed

3 files changed

+82
-61
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ For setup instructions, please consult the integrated `haskell-mode`
4646
manual which can be accessed after installation via `M-x
4747
info-display-manual [RET] haskell-mode`. Alternatively, you can also
4848
direct your browser to the
49-
[the online haskell-mode manual](https://github.com/haskell/haskell-mode/wiki)
49+
[the online haskell-mode manual](http://haskell.github.io/haskell-mode/manual/latest/)
5050
for setup and user guide.
5151

5252

doc/haskell-mode.texi

+80-59
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,58 @@ Requests}.
126126
@node Getting Started
127127
@chapter Getting Started
128128

129-
If you are reading this, you have most likely already managed to install
130-
Haskell Mode in one way or another.
129+
@section Quick Installation
130+
131+
Make sure you have this in your @uref{http://www.gnu.org/software/emacs/manual/html_node/emacs/Init-File.html, init file} (usually `~/.emacs`). If you already have @code{custom-set-variables}, merge its contents:
132+
133+
@lisp
134+
(require 'package)
135+
(custom-set-variables
136+
;; custom-set-variables was added by Custom.
137+
;; If you edit it by hand, you could mess it up, so be careful.
138+
;; Your init file should contain only one such instance.
139+
;; If there is more than one, they won't work right.
140+
'(package-archives
141+
(quote
142+
(("gnu" . "http://elpa.gnu.org/packages/")
143+
("melpa-stable" . "http://stable.melpa.org/packages/")))))
144+
@end lisp
145+
146+
Then run emacs, and evaluate:
147+
148+
@code{M-x package-refresh-contents}
149+
150+
and then follow by
151+
152+
@code{M-x package-install RET haskell-mode}
153+
154+
Voila! @code{haskell-mode} is installed! You should be able to edit Haskell
155+
source code in color now.
156+
157+
@section Installation - more information
158+
159+
@code{haskell-mode} supports GNU Emacs versions 23, 24 and upcoming 25
160+
(snapshot).
161+
162+
@code{haskell-mode} is available from @uref{http://stable.melpa.org,melpa-stable (releases)} and @uref{http://melpa.org, melpa
163+
(git snapshots)}.
164+
165+
Other means of obtaining `haskell-mode` include
166+
@uref{https://github.com/dimitri/el-get, el-get},
167+
@uref{https://github.com/bbatsov/prelude, Emacs Prelude}) and @uref{https://packages.debian.org/search?keywords=haskell-mode, Debian package}.
168+
169+
Emacs23 requires an the use of @code{cl-lib}. cl-lib.el can be found in
170+
the tests/compat directory. Copy cl-lib.el to your emacs
171+
directory, e.g. ~/.emacs.d directory and put
172+
173+
@lisp
174+
(add-to-list 'load-path "~/.emacs.d/")
175+
(require 'cl-lib)
176+
@end lisp
177+
178+
in your .emacs file.
179+
180+
@section Customizing
131181

132182
@cindex customizing
133183
Most of Haskell Mode's settings are configurable via customizable
@@ -141,9 +191,7 @@ One of the important setting you should customize is the
141191
@code{haskell-mode-hook} variable (@pxref{Hooks,,,emacs}) which gets run
142192
right after the @code{haskell-mode} major mode is initialized for a
143193
buffer. You can customize @code{haskell-mode-hook} by @kbd{M-x
144-
customize-variable @key{RET} haskell-mode-hook}. It's highly recommended
145-
you set up indentation to match your preferences; @xref{Indentation},
146-
for more details about the indentation modes included with Haskell Mode.
194+
customize-variable @key{RET} haskell-mode-hook}.
147195

148196
@c TODO:
149197
@c provide basic instructions to get up and running with haskell-mode
@@ -260,6 +308,16 @@ which will prompt a list of all modules, either installed modules or
260308
local project directory files. Then it'll insert it and then format that
261309
module section.
262310

311+
@subsection stylish-haskell
312+
313+
As an alternative to the elisp functions described above, haskell-mode
314+
can use the program @url{
315+
http://hackage.haskell.org/package/stylish-haskell, stylish-haskell}
316+
to format imports. You can set this behavior by typing: @kbd{M-x
317+
customize-variable @key{RET} haskell-stylish-on-save}. You can
318+
install @code{stylish-haskell} by running @code{stack install
319+
stylish-haskell}, or if you have not installed @code{stack},
320+
@code{cabal install stylish-haskell}.
263321

264322
@section Completion support
265323

@@ -343,69 +401,32 @@ block structure@footnote{Haskell also supports braces and semicolons
343401
notation for conveying the block structure. However, most Haskell
344402
programs written by humans use indentation for block structuring.}.
345403

346-
As GNU Emacs' default indentation function (i.e. @code{indent-relative})
347-
is not designed for use with Haskell's layout rule, Haskell mode
348-
includes three different indentation minor modes with different
349-
trade-offs:
350-
351-
@ftable @code
352-
353-
@item haskell-indent-mode
354-
355-
Intelligent semi-automatic indentation for Haskell's layout rule. The
356-
basic idea is to have @key{TAB} cycle through possibilities indentation
357-
points based on some clever heuristics.
358-
359-
The rationale and the implementation principles are described in more
360-
detail in the article @cite{Dynamic tabbing for automatic indentation
361-
with the layout rule} published in the Journal of Functional Programming
362-
8.5 (1998).
363-
364-
@item haskell-indentation-mode
365-
366-
Improved variation of @code{haskell-indent-mode} indentation
367-
mode. Rebinds @key{RET} and @key{DEL}, so that indentations can be set
368-
and deleted as if they were real tabs.
369-
370-
@end ftable
404+
As GNU Emacs' default indentation function
405+
(i.e. @code{indent-relative}) is not designed for use with Haskell's
406+
layout rule, Haskell mode includes indentation rules adapted to
407+
Haskell. @code{haskell-indentation-mode} binds @key{TAB} to cycle
408+
through possible indentation points based on some clever heuristics.
409+
@key{SHIFT-TAB} cycles in the reverse direction, and @key{RET} moves
410+
to a new line and indents to the first possible indentation level.
371411

372-
To enable one of these three mutually exclusive indentation schemes, you
373-
just need call one (and only one!) of the @code{*-mode} commands
374-
while in the buffer you want the indentation scheme to be activated for.
412+
@section haskell-indent-mode
375413

376-
The recommended way is to add one of @code{*-mode} commands to
377-
@code{haskell-mode-hook}. This can be done either by using @kbd{M-x
378-
customize-variable @key{RET} haskell-mode-hook} which provides a
379-
convenient user interface or by adding @emph{one} of the following three
380-
lines to your @file{.emacs} file:
414+
If you want to use the obsolete @code{haskell-indent-mode}, the
415+
recommended way is to load it in @code{haskell-mode-hook}. This can be
416+
done either by using @kbd{M-x customize-variable @key{RET}
417+
haskell-mode-hook} which provides a convenient user interface or by
418+
adding the following line to your @file{.emacs} file:
381419

382420
@lisp
383421
(add-hook 'haskell-mode-hook 'haskell-indent-mode)
384-
(add-hook 'haskell-mode-hook 'haskell-indentation-mode)
385422
@end lisp
386423

387-
@section Interactive Block Indentation
388-
389-
By inserting the key bindings for @kbd{C-,} and @kbd{C-.} (these
390-
bindings are convenient on keyboard layouts where @key{,} and @key{.}
391-
are adjacent keys) as shown below you can interactively de/indent either
392-
the following nested block or, if a region is active while in Transient
393-
Mark Mode (@pxref{Disabled Transient Mark,,,emacs}), de/indent the
394-
active region.
424+
This will turn off @code{haskell-indentation-mode}.
395425

396-
By using a numeric prefix argument (@pxref{Prefix Command
397-
Arguments,,,elisp}) you can modify the shift-amount; for instance,
398-
@kbd{C-u C-,} increases indentation by 4 characters at once.
399-
400-
@findex haskell-move-nested-left
401-
@findex haskell-move-nested-right
426+
@section Interactive Block Indentation
402427

403-
@lisp
404-
(eval-after-load "haskell-mode"
405-
'(progn
406-
(define-key haskell-mode-map (kbd "C-,") 'haskell-move-nested-left)
407-
(define-key haskell-mode-map (kbd "C-.") 'haskell-move-nested-right)))
408-
@end lisp
428+
@code{haskell-indentation} can move whole blocks to the left or to the
429+
right. Just mark a block and then use @key{TAB} or @key{S-TAB}.
409430

410431
@section Rectangle Commands
411432

haskell.el

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
(line-beginning-position)))
101101
(list (match-beginning 0) (match-end 0) haskell-ghc-supported-options))
102102
;; Complete LANGUAGE, a list of completions comes from variable
103-
;; `haskell-ghc-supported-options'
103+
;; `haskell-ghc-supported-extensions'
104104
((and (nth 4 (syntax-ppss))
105105
(save-excursion
106106
(let ((p (point)))

0 commit comments

Comments
 (0)