Skip to content

Small docs improvements #1233

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 27, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 47 additions & 41 deletions doc/haskell-mode.texi
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,13 @@ gmane.comp.lang.haskell.emacs} newsgroup.
If you have discovered a bug or wish to request a new feature, you can
@uref{https://github.com/haskell/haskell-mode/issues/new, file a new
issue} with Haskell Mode's issue tracker. When filing a bug, please
state your currently used software version (@kbd{M-x haskell-version},
@kbd{M-x version}) and what steps to perform in order to reproduce the
bug you're experiencing. Finally, if you happen to be proficient in
@ref{Top,Emacs Lisp,,elisp} you are welcome to submit patches via
@uref{https://help.github.com/articles/using-pull-requests, GitHub Pull
Requests}.
state your currently used software version (@kbd{M-x}
@code{haskell-version}, @kbd{M-x} @code{version}) and what steps to
perform in order to reproduce the bug you're experiencing. Finally, if
you happen to be proficient in @ref{Top,Emacs Lisp,,elisp} you are
welcome to submit patches via
@uref{https://help.github.com/articles/using-pull-requests, GitHub
Pull Requests}.

@node Getting Started
@chapter Getting Started
Expand All @@ -146,29 +147,30 @@ Make sure you have this in your @uref{http://www.gnu.org/software/emacs/manual/h

Then run Emacs, and evaluate:

@code{M-x package-refresh-contents}
@kbd{M-x} @code{package-refresh-contents}

and then follow by

@code{M-x package-install RET haskell-mode}
@kbd{M-x} @code{package-install} @kbd{RET} @code{haskell-mode}

Voila! @code{haskell-mode} is installed! You should be able to edit Haskell
source code in color now.
Voila! @code{haskell-mode} is installed! You should be able to edit
Haskell source code in color now.

@section Installation - more information

@code{haskell-mode} supports GNU Emacs versions 24 and upcoming 25
(snapshot).

@code{haskell-mode} is available from @uref{http://stable.melpa.org,melpa-stable (releases)} and @uref{http://melpa.org, melpa
(git snapshots)}.
@code{haskell-mode} is available from
@uref{http://stable.melpa.org,melpa-stable (releases)} and
@uref{http://melpa.org, melpa (git snapshots)}.

Other means of obtaining @code{haskell-mode} include
@uref{https://github.com/dimitri/el-get, el-get},
@uref{https://github.com/bbatsov/prelude, Emacs Prelude} and @uref{https://packages.debian.org/search?keywords=haskell-mode, Debian package}.

Last version of @code{haskell-mode} that supported Emacs 23 is @code{haskell-mode}
13.18 available at
Last version of @code{haskell-mode} that supported Emacs 23 is
@code{haskell-mode} 13.18 available at
@uref{https://github.com/haskell/haskell-mode/releases/tag/v13.18}.

@section Customizing
Expand Down Expand Up @@ -200,17 +202,17 @@ customize-variable @key{RET} haskell-mode-hook}.
@dfn{Haskell Mode} is actually a collection of so-called major
modes@footnote{for more information about the concept of @dfn{major
modes} @pxref{Major Modes,,,emacs}} one of which is called
@code{haskell-mode}. To avoid confusion, when referring to this package
the name ``Haskell mode'' is written in a normal font, whereas when
referring the major mode of the same name @code{haskell-mode} written
with a dash in-between in a typewriter font is used.
@code{haskell-mode}. To avoid confusion, when referring to this
package the name ``Haskell mode'' is written in a normal font, whereas
when referring the major mode of the same name @code{haskell-mode}
written with a dash in-between in a typewriter font is used.

As one might guess, @code{haskell-mode} is the (programming
language@footnote{@code{haskell-mode} is derived from @code{prog-mode}})
major mode for editing (non-literate) Haskell source
code. @code{haskell-mode} is associated with the file extensions listed
below by default@footnote{for more information about file associations,
@pxref{Choosing Modes,,,emacs}}.
language@footnote{@code{haskell-mode} is derived from
@code{prog-mode}}) major mode for editing (non-literate) Haskell
source code. @code{haskell-mode} is associated with the file
extensions listed below by default@footnote{for more information about
file associations, @pxref{Choosing Modes,,,emacs}}.

@table @file
@item .hs
Expand Down Expand Up @@ -267,7 +269,7 @@ There are a few functions for managing imports.

To jump to your import list, run

@code{M-x haskell-navigate-imports}
@kbd{M-x} @code{haskell-navigate-imports}

It's nicer to have a keybinding to do this, for example:

Expand All @@ -282,30 +284,31 @@ cycle.

To generally format (sort, align) your imports, you can run

@code{M-x haskell-mode-format-imports}
@kbd{M-x} @code{haskell-mode-format-imports}

Or @kbd{C-c C-.}.

@subsection Sort imports

To just sort imports, jump to an import section and run

@code{M-x haskell-sort-imports}
@kbd{M-x} @code{haskell-sort-imports}

@subsection Align imports

To just align imports, jump to an import section and run

@code{M-x haskell-align-imports}
@kbd{M-x} @code{haskell-align-imports}

@subsection stylish-haskell

As an alternative to the elisp functions described above, haskell-mode
can use the program @url{
http://hackage.haskell.org/package/stylish-haskell, stylish-haskell}
to format imports. You can set this behavior by typing: @kbd{M-x}
@code{customize-variable} @kbd{RET} @code{haskell-stylish-on-save}.
You can install @code{stylish-haskell} by running @code{stack install
can use the program
@url{http://hackage.haskell.org/package/stylish-haskell,
stylish-haskell} to format imports. You can set this behavior by
typing: @kbd{M-x} @code{customize-variable} @kbd{RET}
@code{haskell-stylish-on-save}. You can install
@code{stylish-haskell} by running @code{stack install
stylish-haskell}, or if you have not installed @code{stack},
@code{cabal install stylish-haskell}.

Expand All @@ -323,20 +326,22 @@ Haskell buffers only).

@section Completion support

@code{haskell-mode} can complete symbols, pragma directives and
language extensions out-of-box. @code{haskell-mode} completes
identifiers using tags (see @xref{Tags}), however you can get more
precise completions with @code{haskell-interactive-mode}. In
interactive mode completion candidates are produced by querying GHCi
REPL.
@code{haskell-mode} can complete symbols, pragma directives, language
extensions, and language keywords out-of-box. @code{haskell-mode}
completes identifiers (symbols) using tags (see ``Tags''), however you
can get more precise completions with @code{haskell-interactive-mode}.
In interactive mode completion candidates are produced by querying
GHCi REPL.

@ifhtml
@image{anim/company-mode-language-pragma}
@end ifhtml

If haskell-interactive-mode is enabled and working haskell mode
If @code{haskell-interactive-mode} is enabled and working Haskell mode
provides completions for import statements taking into account
currently loaded and available packages.
currently loaded and available packages. Also it completes symbols
querying REPL with @code{:complete} command, hence completion
candidate list also includes symbols from imported modules.

@ifhtml
@image{anim/company-mode-import-statement}
Expand All @@ -352,7 +357,8 @@ completion candidates from completion-at-point function
@code{company-mode} provides special backend for dabbrev code
completions, namely @code{company-dabbrev-code}. To combine
completions from diffrent backends you can create grouped backends, it
is very easy — a grouped backend is just a list of backends:
is very easy — a grouped backend is just a list of backends, for
example:

@lisp
(add-hook 'haskell-mode-hook
Expand Down