I’m using Fsharp mode in emacs.
The key of ^C x is mapped to Run ... command which is as follows.
(defun fsharp-run-executable-file ()
(interactive)
(let ((name (buffer-file-name)))
(if (string-match "^\\(.*\\)\\.\\(fs\\|fsi\\)$" name)
(shell-command (concat (match-string 1 name) ".exe")))))
The problem is that it tries to run bash something.exe, whereas I need to run the command of mono something.exe. I got error message of /bin/bash ...exe: cannot execute binary file.
How can I come up with a new elisp command to launch mono, and then get the result to show it to *compilation* buffer?
You can redefine fsharp-run-executable-file and use this one instead:
There are two changes: 1) concat
monobefore the command (as petebu wrote); 2) use thecompilefunction so that the output is in the*compilation*buffer.To test quickly, just evaluate the above function (add it in your Emacs init file for a permanent change). Note that you shouldn’t modify fsharp.el file, at I might update at some point (you don’t want to lost your changes).
Edit
One issue with the previous function is that it modifies the last compilation command. This might might annoying if you compile your code with
compileorrecompilecommands. Here is a fix: