Saturday, June 17, 2006

Welcome to the Church of Emacs

Thanks to Tristan for his post about emacs abbreviations for LaTeX. It got me to try out emacs as my default editor for coding and such. So I decided that I will document any tips or tricks that I stumble upon during my journey.

The first tip is going to be how to get a mode for C# programming.

To start off you need to download the code for C# mode that can be obtain here.

If you don't have a version of CC Mode of 5.30.x or greater you will need to get a newer version from here.

To check what version of CC Mode you currently have open a C file with emacs and use Mx c-version.

To install csharp mode run the following commands:
mkdir -p ~/elisp
cp csharp-mode.el ~/elisp

Now to enable csharp mode you need to add the following to your .emacs file:

(add-to-list 'load-path "~/elisp")
(autoload 'csharp-mode "csharp-mode-0.5.0" "Major mode for editing C# code." t)
(setq auto-mode-alist (append '(("\\.cs$" . csharp-mode)) auto-mode-alist))

If you have any questions about this just add a comment. Look for tips on customizing your emacs environment in the upcoming post.

No comments: