Being one of the few people (it appears) for who F# is their first entrance into the .net ecosystem, I am not in possesion of visual studio and have been hacking away in emacs. Not that I'm complaining, emacs rocks ;). However as there is currently no specifically designed mode for F# in emacs I have been using "Tuareg-mode" and have recently started customising it for F#. So below are some of the changes I've made, and was hoping that other people may find them handy, or even have some of their own.
As an aside, the visual studio f# addin won't work with any of the express editions will it? and those are the only freely available versions?
in my .emacs file (along with the other things to setup tuareg mode)
(setq auto-mode-alist (cons '("\\.fs\\w?" . tuareg-mode) auto-mode-alist))
so tuareg mode will auto load when any f# file is loaded
(set (make-local-variable 'compile-command)
(concat "fsc \""
customising the compile command of emacs "compile.el" compilation macros.
So when you hit C-c C-c ...
comes up instead of the standard "make -k"
And here are some customizations inside tuareg.el ...
a rather quick hack that could be done better to support both f# and ocaml files. Just allows you to flick between .fs and .fsi files.
(defun tuareg-find-alternate-file ()
(let ((name (buffer-file-name)))
(if (string-match "\\`\\(.*\\)\\.fs\\(i\\)?\\'" name)
(find-file (concat (tuareg-match-string 1 name)
(if (match-beginning 2) ".fs" ".fsi"))))))
just comment out the original and add this in.
(defvar tuareg-interactive-program "fsi"
"*Default program name for invoking a FSharp toplevel from Emacs.")
Again in this insanely huge tuareg.el file
"Regular expression matching the error messages produced by fsc.")
(if (boundp 'compilation-error-regexp-alist)
(or (assoc tuareg-error-regexp-fs
(cons (list tuareg-error-regexp-fs 1 2 3)
allowing the compilation system to parse the error messages from the f# compiler so that you can jump to them in your file with M-x`
I've fiddled around with syntax highlighting and indentation... but nothing that works well and isn't an ugly hack. I've never written a language mode for emacs before... so really all I know is some lisp and a vague idea of what I want to do.
Things that would be nice to get sorted are...
supporting // style comments as well as (* *) style comments... which i believe involves modding the syntax table defined in the mode.
The haskell mode has few more good features that would be nice to shamelessly steal, like displaying types in the minibuffer.
I guess most people are using visual studio... but hopefully someone will find this useful or help me out.