3 (add-to-list 'load-path
(concat extdir
"tuareg"))
6 (setq auto-mode-alist
(cons '("\\.fs\\w?" . tuareg-mode
) auto-mode-alist
))
8 (add-hook 'tuareg-mode-hook
10 (set (make-local-variable 'compile-command
)
12 (file-name-nondirectory buffer-file-name
)
15 (defadvice tuareg-find-alternate-file
(around fsharp-find-alternate-file
)
16 "Switch Implementation/Interface."
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
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
))))))