-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed a merge conflict between stash
- Loading branch information
Showing
11 changed files
with
7,310 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
== F# mode for Emacs == | ||
|
||
Version 0.3 - June 2010 | ||
|
||
|
||
|
||
1) Installation | ||
|
||
|
||
When Emacs is started up, it normally runs a file called ~/.emacs located | ||
in your home directory. This file should contain all of your personal | ||
customisations written as a series of Elisp commands. In order to install | ||
the F# mode, you have to tell Emacs where to find it. This is done by | ||
adding some commands to the init file. | ||
|
||
Assuming you have placed the mode in your "~/.emacs.d" directory and you | ||
now have a "~/.emacs.d/fsharp" directory, copy the following lines to your | ||
init file (usually "~/.emacs"). | ||
|
||
(setq load-path (cons "~/.emacs.d/fsharp" load-path)) | ||
(setq auto-mode-alist (cons '("\\.fs[iylx]?$" . fsharp-mode) auto-mode-alist)) | ||
(autoload 'fsharp-mode "fsharp" "Major mode for editing F# code." t) | ||
(autoload 'run-fsharp "inf-fsharp" "Run an inferior F# process." t) | ||
|
||
If "fsc" and "fsi" are in your path, that's all you need. Otherwise, | ||
you can add these two following lines to set the path to the compiler | ||
and interactive F#. | ||
|
||
On Windows (adapt the path if needed): | ||
|
||
(setq inferior-fsharp-program "\"c:\\Program Files\\Microsoft F#\\v4.0\\Fsi.exe\"") | ||
(setq fsharp-compiler "\"c:\\Program Files\\Microsoft F#\\v4.0\\Fsc.exe\"") | ||
|
||
On Unix (adapt the path if needed): | ||
|
||
(setq inferior-fsharp-program "mono ~/fsi.exe --readline-") | ||
(setq fsharp-compiler "mono ~/fsc.exe") | ||
|
||
|
||
Reload your init file or reopen Emacs. If you open a ".fs" file, the | ||
fsharp-mode will be used automatically. | ||
|
||
|
||
|
||
2) Features | ||
|
||
- Interactive F# buffer | ||
- Indentation | ||
- Syntax highlighter | ||
|
||
|
||
|
||
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 | ||
|
||
To interrupt the interactive mode, use "C-c C-c". This is useful if your | ||
code does an infinite loop or a very long computation. | ||
|
||
If you want to shift the region by 2 spaces, use: M-2 C-c r | ||
|
||
In the interactive buffer, use M-RET to send the code without | ||
explicitly adding the ";;" thing. | ||
|
||
|
||
4) Contact | ||
|
||
If you have problems using this mode, please ask on a F# forum, e.g. | ||
http://cs.hubfs.net or http://stackoverflow.com | ||
|
||
If you don't have answers, you can send me an email, I will try to reply | ||
on the thread, as it could be useful to other people. | ||
|
||
If you can help improving this mode, feel free to contact me! I can | ||
give you SVN access on Sourceforge if you'd like to contribute. For | ||
bugs and feature requests, please use Sourceforge tracker. | ||
|
||
|
||
Contact: laurent [at] le-brun.eu | ||
|
||
-- | ||
Laurent. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
;(***********************************************************************) | ||
;(* *) | ||
;(* Objective Caml *) | ||
;(* *) | ||
;(* Jacques Garrigue and Ian T Zimmerman *) | ||
;(* *) | ||
;(* Copyright 1997 Institut National de Recherche en Informatique et *) | ||
;(* en Automatique. All rights reserved. This file is distributed *) | ||
;(* under the terms of the GNU General Public License. *) | ||
;(* *) | ||
;(***********************************************************************) | ||
|
||
;(* $Id: fsharp-font.el,v 1.19 2004/08/20 17:04:35 doligez Exp $ *) | ||
|
||
;; useful colors | ||
|
||
(cond | ||
((x-display-color-p) | ||
(require 'font-lock) | ||
(cond | ||
((not (boundp 'font-lock-type-face)) | ||
;; make the necessary faces | ||
(make-face 'Firebrick) | ||
(set-face-foreground 'Firebrick "firebrick") | ||
(make-face 'RosyBrown) | ||
(set-face-foreground 'RosyBrown "RosyBrown") | ||
(make-face 'Purple) | ||
(set-face-foreground 'Purple "Purple") | ||
(make-face 'MidnightBlue) | ||
(set-face-foreground 'MidnightBlue "MidnightBlue") | ||
(make-face 'DarkGoldenRod) | ||
(set-face-foreground 'DarkGoldenRod "DarkGoldenRod") | ||
(make-face 'DarkOliveGreen) | ||
(set-face-foreground 'DarkOliveGreen "DarkOliveGreen4") | ||
(make-face 'CadetBlue) | ||
(set-face-foreground 'CadetBlue "CadetBlue") | ||
; assign them as standard faces | ||
(setq font-lock-comment-face 'Firebrick) | ||
(setq font-lock-string-face 'RosyBrown) | ||
(setq font-lock-keyword-face 'Purple) | ||
(setq font-lock-function-name-face 'MidnightBlue) | ||
(setq font-lock-variable-name-face 'DarkGoldenRod) | ||
(setq font-lock-type-face 'DarkOliveGreen) | ||
(setq font-lock-reference-face 'CadetBlue))) | ||
; extra faces for documention | ||
(make-face 'Stop) | ||
(set-face-foreground 'Stop "White") | ||
(set-face-background 'Stop "Red") | ||
(make-face 'Doc) | ||
(set-face-foreground 'Doc "Red") | ||
(setq font-lock-stop-face 'Stop) | ||
(setq font-lock-doccomment-face 'Doc) | ||
)) | ||
|
||
|
||
(defconst fsharp-font-lock-keywords | ||
(list | ||
;stop special comments | ||
'("\\(^\\|[^\"]\\)\\((\\*\\*/\\*\\*)\\)" | ||
2 font-lock-stop-face) | ||
;doccomments | ||
'("\\(^\\|[^\"]\\)\\((\\*\\*[^*]*\\([^)*][^*]*\\*+\\)*)\\)" | ||
2 font-lock-doccomment-face) | ||
;comments | ||
'("\\(^\\|[^\"]\\)\\((\\*[^*]*\\*+\\([^)*][^*]*\\*+\\)*)\\)" | ||
2 font-lock-comment-face) | ||
|
||
;; '("(\\*IF-OCAML\\([^)*][^*]*\\*+\\)+ENDIF-OCAML\\*)" | ||
;; 2 font-lock-comment-face) | ||
|
||
;; '("\\(^\\|[^\"]\\)\\((\\*[^F]\\([^)*][^*]*\\*+\\)+)\\)" | ||
;; . font-lock-comment-face) | ||
; '("(\\*.*\\*)\\|(\\*.*\n.*\\*)" | ||
; . font-lock-comment-face) | ||
|
||
|
||
;character literals | ||
(cons (concat "'\\(\\\\\\([ntbr'\\]\\|" | ||
"[0-9][0-9][0-9]\\)\\|.\\)'" | ||
"\\|\"[^\"\\]*\\(\\\\\\(.\\|\n\\)[^\"\\]*\\)*\"") | ||
'font-lock-string-face) | ||
|
||
'("//.*" . font-lock-comment-face) | ||
|
||
;modules and constructors | ||
'("`?\\<[A-Z][A-Za-z0-9_']*\\>" . font-lock-function-name-face) | ||
;definition | ||
|
||
(cons (concat "\\(\\<" | ||
(mapconcat 'identity | ||
'( | ||
;; F# keywords | ||
"abstract" "and" "as" "assert" "base" "begin" | ||
"class" "default" "delegate" "do" "done" "downcast" | ||
"downto" "elif" "else" "end" "exception" "extern" | ||
"false" "finally" "for" "fun" "function" "global" | ||
"if" "in" "inherit" "inline" "interface" "internal" | ||
"lazy" "let" "match" "member" "module" "mutable" | ||
"namespace" "new" "null" "of" "open" "or" "override" | ||
"private" "public" "rec" "return" "sig" "static" | ||
"struct" "then" "to" "true" "try" "type" "upcast" | ||
"use" "val" "void" "when" "while" "with" "yield" | ||
|
||
;; F# reserved words for future use | ||
"atomic" "break" "checked" "component" "const" | ||
"constraint" "constructor" "continue" "eager" | ||
"fixed" "fori" "functor" "include" "measure" | ||
"method" "mixin" "object" "parallel" "params" | ||
"process" "protected" "pure" "recursive" "sealed" | ||
"tailcall" "trait" "virtual" "volatile" | ||
) | ||
"\\>\\|\\<") | ||
"\\>\\)") | ||
'font-lock-type-face) | ||
|
||
;blocking | ||
;; '("\\<\\(begin\\|end\\|module\\|namespace\\|object\\|sig\\|struct\\)\\>" | ||
;; . font-lock-keyword-face) | ||
;control | ||
(cons (concat | ||
"\\<\\(asr\\|false\\|land\\|lor\\|lsl\\|lsr\\|lxor" | ||
"\\|mod\\|new\\|null\\|object\\|or\\|sig\\|true\\)\\>" | ||
"\\|\|\\|->\\|&\\|#") | ||
'font-lock-reference-face) | ||
;labels (and open) | ||
'("\\<\\(assert\\|open\\|include\\|module\\|namespace\\|extern\\|void\\)\\>\\|[~?][ (]*[a-z][a-zA-Z0-9_']*" | ||
. font-lock-variable-name-face))) | ||
|
||
(defconst inferior-fsharp-font-lock-keywords | ||
(append | ||
(list | ||
;inferior | ||
'("^[#-]" . font-lock-comment-face) | ||
'("^>" . font-lock-variable-name-face)) | ||
fsharp-font-lock-keywords)) | ||
|
||
;; font-lock commands are similar for fsharp-mode and inferior-fsharp-mode | ||
(add-hook 'fsharp-mode-hook | ||
'(lambda () | ||
(cond | ||
((fboundp 'global-font-lock-mode) | ||
(make-local-variable 'font-lock-defaults) | ||
(setq font-lock-defaults | ||
'(fsharp-font-lock-keywords nil nil ((?' . "w") (?_ . "w"))))) | ||
(t | ||
(setq font-lock-keywords fsharp-font-lock-keywords))) | ||
(make-local-variable 'font-lock-keywords-only) | ||
(setq font-lock-keywords-only t) | ||
(font-lock-mode 1))) | ||
|
||
(defun inferior-fsharp-mode-font-hook () | ||
(cond | ||
((fboundp 'global-font-lock-mode) | ||
(make-local-variable 'font-lock-defaults) | ||
(setq font-lock-defaults | ||
'(inferior-fsharp-font-lock-keywords | ||
nil nil ((?' . "w") (?_ . "w"))))) | ||
(t | ||
(setq font-lock-keywords inferior-fsharp-font-lock-keywords))) | ||
(make-local-variable 'font-lock-keywords-only) | ||
(setq font-lock-keywords-only t) | ||
(font-lock-mode 1)) | ||
|
||
(add-hook 'inferior-fsharp-mode-hooks 'inferior-fsharp-mode-font-hook) | ||
|
||
(provide 'fsharp-font) |
Oops, something went wrong.