Skip to content

Commit 3c8748c

Browse files
committed
Merge pull request #976 from gracjan/pr-move-docs-from-wiki-to-manual
Move some docs from wiki to manual
2 parents bb95ef5 + e54982a commit 3c8748c

File tree

1 file changed

+123
-1
lines changed

1 file changed

+123
-1
lines changed

doc/haskell-mode.texi

Lines changed: 123 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,58 @@ control @code{font-lock-mode}.
209209
@image{anim/font-lock}
210210
@end ifhtml
211211

212+
@section Managing imports
213+
214+
There are a few functions for managing imports.
215+
216+
@subsection Jump to imports
217+
218+
To jump to your import list, run
219+
220+
@code{M-x haskell-navigate-imports}
221+
222+
It's nicer to have a keybinding to do this, for example:
223+
224+
@lisp
225+
(define-key haskell-mode-map [f8] 'haskell-navigate-imports)
226+
@end lisp
227+
228+
You can hit it repeatedly to jump between groups of imports. It will
229+
cycle.
230+
231+
@subsection Format imports
232+
233+
To generally format (sort, align) your imports, you can run
234+
235+
@code{M-x haskell-mode-format-imports}
236+
237+
Or @kbd{C-c C-.}.
238+
239+
@subsection Sort imports
240+
241+
To just sort imports, jump to an import section and run
242+
243+
@code{M-x haskell-sort-imports}
244+
245+
@subsection Align imports
246+
247+
To just align imports, jump to an import section and run
248+
249+
@code{M-x haskell-align-imports}
250+
251+
@subsection Entering imports
252+
253+
If you have Haskell Interactive Mode enabled and a session open,
254+
you can write
255+
256+
@code{import}
257+
258+
And then hit @kbd{SPC} (running @code{M-x haskell-mode-contextual-space})
259+
which will prompt a list of all modules, either installed modules or
260+
local project directory files. Then it'll insert it and then format that
261+
module section.
262+
263+
212264
@section Completion support
213265

214266
@code{haskell-mode} can complete symbols, pragma directives and language
@@ -434,6 +486,64 @@ need to add the following to your Emacs initialization:
434486
'(add-to-list 'which-func-modes 'haskell-mode))
435487
@end lisp
436488

489+
@section Speedbar
490+
491+
Haskell-mode comes with declaration scanning support. This means that if you enable Haskell support for speedbar:
492+
493+
@lisp
494+
(speedbar-add-supported-extension ".hs")
495+
@end lisp
496+
497+
And open speedbar with
498+
499+
@code{M-x speedbar}
500+
501+
It gives a listing of each module and under each module:
502+
503+
@example
504+
Imports
505+
Instances
506+
Data types
507+
Classes
508+
Bindings
509+
@end example
510+
511+
You will get a bar that looks like this:
512+
513+
@verbatim
514+
~/Projects/ace/src/ACE/
515+
0:<+> Types
516+
0:[+] Combinators.hs
517+
0:[-] Datalog.hs
518+
1: {-} Classes
519+
2: > ToTerm
520+
1: {-} Imports
521+
2: > ACE.Types.Syntax
522+
2: > Database.Datalog
523+
1: {-} Instances
524+
2: {+} ToTerm A
525+
2: {+} ToTerm Co to ToTerm Gen
526+
2: {+} ToTerm Intransitive to ToTerm N
527+
2: {+} ToTerm P
528+
2: {+} ToTerm Quotation to ToTerm Un
529+
2: {+} ToTerm V
530+
0:[-] Html.hs
531+
1: {+} Imports
532+
1: {+} Instances
533+
1: > mtoMarkup
534+
1: > toMarkupm
535+
1: > wrap
536+
0:[-] Parsers.hs
537+
1: {+} Imports
538+
1: {-} Datatypes
539+
2: > ACEParser
540+
0:[+] Pretty.hs
541+
0:[+] Tokenizer.hs
542+
@end verbatim
543+
544+
The hierarchy is expandable/collapsible and each entry will jump to the
545+
line in the right file when clicked/selected.
546+
437547
@node Compilation
438548
@chapter Compilation
439549

@@ -589,7 +699,19 @@ associated with at most one GHCi session, so when you call
589699
no session associated yet, you're asked which GHCi session to create or
590700
associate with.
591701

592-
TODO/WRITEME
702+
@section Using GHCi-ng
703+
704+
Put @code{:set +c} in your @code{.ghci} or run it in the REPL. Then use
705+
these keybindings:
706+
707+
@lisp
708+
(define-key interactive-haskell-mode-map (kbd "M-.") 'haskell-mode-goto-loc)
709+
(define-key interactive-haskell-mode-map (kbd "C-c C-t") 'haskell-mode-show-type-at)
710+
@end lisp
711+
712+
You have to load the module before it works, after that it will remember
713+
for the current GHCi session.
714+
593715

594716
@node Editing Cabal files
595717
@chapter Editing Cabal files

0 commit comments

Comments
 (0)