use cooper theme -- end of git, I am trying livemesh
[srid.dotfiles.git] / emacs / dot-emacs-parts / lang-fsharp.el
bloba97b30a44787a0e4770cf0881fb7f7565e817576
1 ;; Tuareg mode for F#
3 (add-to-list 'load-path (concat extdir "tuareg"))
5 (require 'tuareg)
6 (setq auto-mode-alist (cons '("\\.fs\\w?" . tuareg-mode) auto-mode-alist))
8 (add-hook 'tuareg-mode-hook
9 '(lambda ()
10 (set (make-local-variable 'compile-command)
11 (concat "fsc \""
12 (file-name-nondirectory buffer-file-name)
13 "\""))))
15 (defadvice tuareg-find-alternate-file (around fsharp-find-alternate-file)
16 "Switch Implementation/Interface."
17 (interactive)
18 (let ((name (buffer-file-name)))
19 (if (string-match "\\`\\(.*\\)\\.fs\\(i\\)?\\'" name)
20 (find-file (concat (tuareg-match-string 1 name)
21 (if (match-beginning 2) ".fs" ".fsi"))))))
23 (defvar tuareg-interactive-program "fsi"
24 "*Default program name for invoking a FSharp toplevel from Emacs.")
26 (defconst tuareg-error-regexp-fs
27 "^\\([^(\n]+\\)(\\([0-9]+\\),\\([0-9]+\\)):"
28 "Regular expression matching the error messages produced by fsc.")
30 (add-hook 'tuareg-mode-hook
31 '(lambda ()
32 (ad-activate 'tuareg-find-alternate-file)
33 (setq tuareg-interactive-program "fsi")
34 (if (boundp 'compilation-error-regexp-alist)
35 (or (assoc tuareg-error-regexp-fs
36 compilation-error-regexp-alist)
37 (setq compilation-error-regexp-alist
38 (cons (list tuareg-error-regexp-fs 1 2 3)
39 compilation-error-regexp-alist))))))