Question

Ok, so I just got the F# extension working for emacs. I now need to figure out how to make the scripts I write actually execute. In Visual Studio, to run them you just highlight, right click, and choose "Send to Interactive". I do not expect that emacs has that or anything similar, but I have no idea how to make an f# script interact with with fsi. So, in essence, how do you run a script after writing it, using emacs or terminal?

EDIT: For clarification, I am running emacs on a mac.

EDIT2: Because I am running on a mac, emacs has no way to execute the script, since fsi doesn't exist as a usable thing for macs. Apparently. How sad. I will just choose the most voted answer as correct.

Était-ce utile?

La solution

I'm not an Emacs user myself, but Laurent Le Brun has done some work on F# mode for Emacs, which is probably the most comfortable way to use F# from Emacs. His blog post talks about Alt+Enter, so I suppose the F# mode adds handling for this keyboard shortcut.

If you don't want to install this, then I guess you'll just need to run fsi.exe as a normal console application in another buffer and copy your F# intput there (appending ;; to the end, to send the command to fsi.exe).

Autres conseils

According to this page the readme file included with the package should document the keystrokes available. And, according to that readme, these are the keystrokes in question:

3) Bindings

If you are new to Emacs, you might want to use the menu (call
menu-bar-mode if you don't see it). However, it's usually faster to learn
a few useful bindings:

- C-c C-r       Evaluate region
- C-c C-e       Evaluate current toplevel phrase
- C-M-x         Evaluate current toplevel phrase
- C-M-h         Mark current toplevel phrase
- C-c C-s       Show interactive buffer
- C-c C-c       Compile with fsc
- C-c x         Run the executable
- C-c C-a       Open alternate file (.fsi or .fs)
- C-c l         Shift region to left
- C-c r         Shift region to right
- C-c <up>      Move cursor to the beginning of the block

So I'm guessing you want the Ctrl-c Ctrl-r combo.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top