I’m using csharp-mode in Emacs 23 on OS X. I’d like to get the flymake syntax checking working but I’m not familiar enough with emacs lisp to know where to change things in the csharp-mode.el file to change the compiler. Any assistance would be appreciated.
Share
If you add the following to your Emacs init file, that should do the job:
From EmacsWiki:
In order to change the compiler, you can add a comment at the top of your C# code:
For more detail on options for changing the compiler, see the comments in the csharp-mode.el source file (search for “csharp-flymake-get-cmdline”).
EDIT: Ok, based on your comment below about not wanting to put the flymake comment line in your C# code, I’ve come up with an alternative solution. Put the following code in your Emacs init file. Change the
(setq my-csharp-default-compiler "mono @@FILE@@")line to whatever compile line you want. Now, whenever you open a C# file, you should be able to use flymake without adding the comment line into your C# source. If, at some later stage, you want to use the standard csharp-mode mechanism (of looking for a flymake comment in the C# source file), you just have to change the statement to (setq my-csharp-default-compiler nil).