Hello,

Just my two cents - #light-mode F# does not like Tabs, which Tuareg mode sometimes (rarely) inserts. One way to avoid that is to have

1
2
3
4
(add-hook 'tuareg-mode-hook
          '(lambda ()
             # .... your customizations .....
             (setq indent-tabs-mode nil)))

By the way, anyone got code completion to work? Some limited form perhaps?

My line of thinking here is if I could get all F# pervasives and libs listed in one file like

1
2
Seq.of_list
Seq.to_array

then having that file open would enable dabbrev-completion with M-/ keystrokes, which would be at least something to start.

What else - well perhaps running an inferior process that uses .NET reflection?

--Anton

By on 11/14/2008 12:14 PM ()

Hi all;

I think F# 2008 September is best supported by Visual Studio 2008 or Visual Studio 2008 Shell. However, I also feel like developing an F# program on a Linux / MacOS environment with mono 2.0 supports.

Well, DeeJay explained some time ago about how we can construct an emacs environment as an extension of Tuareg. However, I could not use his code for compile.el, although I could define the Tuareg support for .fs files. I wonder that there might be some typos or grammar mistakes in the previous post. Maybe I should write something like this;

1
2
3
4
5
6
(add-hook 'tuareg-mode-hook
  (lambda ()
    (set (make-local-variable 'compile-command)
      (cons "fsc \""
        (file-name-nondirectory buffer-file-name)
          "\""))))

But, please note that I am not sure whether I should write "set" or "setq" in Lisp language. I still have a permanent error while reading .fs file by emacs, which implies that we could not include "compile" command.

Any help?

Best Wishes

By on 11/7/2008 10:49 PM ()

Hi,

I've written an F# mode for Emacs, as mentioned here: [link:cs.hubfs.net]

I suggest you to use it. It's far from perfect, but hopefully some people will contribute.

Laurent.

By on 11/8/2008 1:44 AM ()

Hi,

Thanks a lot, it was helpful.
I succeeded, but there was a warning on the back slash.

Filham

By on 11/8/2008 2:14 AM ()

Hi all;

I think F# 2008 September is best supported by Visual Studio 2008 or Visual Studio 2008 Shell. However, I also feel like developing an F# program on a Linux / MacOS environment with mono 2.0 supports.

Well, DeeJay explained some time ago about how we can construct an emacs environment as an extension of Tuareg. However, I could not use his code for compile.el, although I could define the Tuareg support for .fs files. I wonder that there might be some typos or grammar mistakes in the previous post. Maybe I should write something like this;

1
2
3
4
5
6
(add-hook 'tuareg-mode-hook
  (lambda ()
    (set (make-local-variable 'compile-command)
      (cons "fsc \""
        (file-name-nondirectory buffer-file-name)
          "\""))))

But, please note that I am not sure whether I should write "set" or "setq" in Lisp language. I still have a permanent error while reading .fs file by emacs, which implies that we could not include "compile" command.

Any help?

Best Wishes

By on 11/7/2008 10:49 PM ()

Instead of modifying existing tuareg.el you can use elisp advice facility.

Below is my customization of tuareg mode for F# (in ~/.emacs.d/init.el)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
;; fsharp

(setq auto-mode-alist (cons '("\\.fs\\w?" . tuareg-mode) auto-mode-alist))

(defadvice tuareg-find-alternate-file (around fsharp-find-alternate-file)
  "Switch Implementation/Interface."
  (interactive)
  (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"))))))
(defconst tuareg-error-regexp-fs
  "^\\([^(\n]+\\)(\\([0-9]+\\),\\([0-9]+\\)):"
  "Regular expression matching the error messages produced by fsc.")
(add-hook 'tuareg-mode-hook
          '(lambda ()
             (ad-activate 'tuareg-find-alternate-file)
             (setq tuareg-interactive-program "fsi")
             (if (boundp 'compilation-error-regexp-alist)
                 (or (assoc tuareg-error-regexp-fs
                            compilation-error-regexp-alist)
                     (setq compilation-error-regexp-alist
                           (cons (list tuareg-error-regexp-fs 1 2 3)
                                 compilation-error-regexp-alist))))))
By on 12/8/2007 12:29 AM ()

Using plain old caml mode, I got highlighting to work by doing the following:

1) Add the following after the existing comments regexp in caml-font.el

1
2
3
4
5
;comments
   '("\\(^\\|[^\"]\\)\\((\\*[^*]*\\*+\\([^)*][^*]*\\*+\\)*)\\)"
     2 font-lock-comment-face)
;fs comments
   '("//.*" . font-lock-comment-face)

2) Comment out the following code farther down in the same file:

1
2
3
4
5
6
7
8
9
10
11
12
;(setq caml-mode-hook
;      '(lambda ()
;         (cond
;          ((fboundp 'global-font-lock-mode)
;           (make-local-variable 'font-lock-defaults)
;           (setq font-lock-defaults
;                 '(caml-font-lock-keywords nil nil ((?' . "w") (?_ . "w")))))
;          (t
;           (setq font-lock-keywords caml-font-lock-keywords)))
;         (make-local-variable 'font-lock-keywords-only)
;         (setq font-lock-keywords-only t)
;         (font-lock-mode 1)))
By on 3/27/2007 6:59 AM ()

Hi DeeJay!

I use emacs too now and then [:$] I still find it the best way to quickly open and search log files, and I also use it to develop the Visual Studio mode when something I've done has busted it!

For F# code I use a version of an emacs OCaml mode ("caml-mode") I've been using for years - I haven't modified it for F#. James Margetson also uses emacs and uses a modified version of Tuareg. It would be great to get the bits and pieces to make a decent mode together.

The F# VS Plugins won't work with VS Express editions, alas. I would love to work with the community to help someone develop an extension to CSharpDevelop by plugging into the F# Compiler APIs for interactive syntax highlighting, type checking and intellisense (we would help you with the API side, others would have to be responsible for developing the plugin that uses the API, "owning" the plugin over the long term, testing it, announcing it etc.). I actually suspect we could have something up and running very quickly if someone puts their mind to it.

Cheers!

Don

By on 5/29/2006 9:01 AM ()

Seems like a 'polished' emacs mode wouldn't be too much more effort... and I'd be up for being a part of that.

Is a language even a reality if it doesn't have an emacs mode ;). I guess what I'm getting at is having a freely available editor with good support for said language can only help adoption. F# merges two worlds and one of those worlds is used to, and typically owns VS.net and the other does not. I am from the latter, and I can see people being turned away if it appears that a commercial tool is the only one with specific support.

Boo and Nemerle are other .net languages developed by 3rd parties
Boo has SharpDevelop and JEdit
Nemerle has loads ([link:nemerle.org]

Having a ShapDevelop addin as well as an emacs mode would be great too.

I spose I should really be spending more time revising... and I've signed myself for an intership this summer, however I'm more than willing to spend every other waking moment contributing to this (and yes if you haven't guessed already, I'm a CS ugrad).

By on 5/29/2006 10:34 AM ()

Great! Let me know if/when you want to start taking a crack at the SharpDevelop plug-in. We can talk through the relevant functionality and APIs. You could probably start on a project system by copying an existing sample.

Cheers!

Don

By on 5/30/2006 5:59 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper