tags:

views:

99

answers:

3

I've got the Haskell interpreter running in Emacs.

With this I've got the typical Emacs setup of 2 open windows,

  • the source file I'm editing
  • the Haskell interpreter

Using the command :edit file in the interpreter it will open the file I tell it to, but it will open it in Notepad.

Is there a way to map the :edit command to use Emacs instead of Notepad.

It looks like the .hs extension is mapped to to ghci on my machine.

+4  A: 

The command you are looking for is :set editor emacs. Using :edit will open up a new emacs process.

For me, it's more convenient to simply edit the files in their own buffers and then :load and :reload them as necessary rather than calling up the editor from within ghci.

Michael Steele
Great answer, thanks:)
chollida
+9  A: 

I'm guessing that the Haskell interpreter will honor the following:

:set editor emacsclient

and from Emacs do

M-x start-server

and then when you do

:edit file

the file will pop up in your Emacs session. C-x # will tell Emacs to tell Haskell to consume the file.

pajato0
You get my upvote for this.
Michael Steele
Thanks for the response.
chollida
Is it possible to have it do this for every session of GHCI?
Jonno_FTW
A: 

Why not just re-assign .hs to emacs, and run ghci from it?

Alex Ott
I'd rather not do that when there is a proper solution already mentioned that will do what I want.
chollida