#95: GHCi editor binding with ":e"
--------------------------------+-------------------------------------------
Reporter: martijnislief | Owner: nobody
Type: feature request | Status: assigned
Priority: normal | Milestone: 6.8 branch
Component: GHCi | Version: None
Severity: minor | Resolution: None
Keywords: | Difficulty: Easy (1 hr)
Os: Unknown | Testcase:
Architecture: Unknown |
--------------------------------+-------------------------------------------
Comment (by claus):
starting somewhere in 6.7, you can define something like that yourself.
the trick is to have a :redirErr command that allows you to capture ghci
command error output. then you do a :l or :r, capture the errors, and use
:e to edit the first one.
a slight complication is that :l/:r invalidate all variable bindings, so
we need to define a temporary :afterCmd, in order to restore stderr and to
read the errors after the :l/:r.
please note that many editors support quick compile/edit cycles (in vim,
try :help quickfix; emacs should also support something similar), which
will do this kind of thing more easily in most cases.
add the attached le.ghci to your .ghci, or source it with :cmd readFile
"le.ghci". then, :le <mod> will :load and :edit, and :le on its own will
:reload and :edit. adapt the code to your needs.
there is a patch pending for ghc head that will allow us to avoid having
to compress ghci definitions into single lines, which will make things
like this a lot more readable and maintainable..
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/95>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs