2011-06-01 66 views
4

我碰巧知道单声道的CSharpRepl,有没有emacs csharp模式,用它在一个窗口中运行REPL,并在python模式下编译/运行其他窗口中的C#代码?CSharpRepl emacs集成?

+0

我从来没有听说过这样的事情。您可以查看SLIME项目,因为它非常相似。 – 2011-06-01 22:22:48

回答

2

您可以创建一个lisp函数来调用CSharpRepl,并在处理C#代码时分配一个键来调用它。例如,你可以把你的Emacs初始化文件中的以下(假设CSharpRepl可执行“CSHARP”在PATH):

(defun csharp-repl() 
    "Open a new side-by-side window and start CSharpRepl in it." 
    (interactive) 
    (split-window-side-by-side) 
    (other-window 1) 
    (comint-run "csharp")) 

(global-set-key [f11] 'csharp-repl) 

所以,如果你正在编辑一个C#程序(使用你喜欢的任何方式),现在可以按F11,CSharpRepl将在新窗口中打开,以便您可以交互式评估C#代码。

2

略微增加了接受的答案。如果存在缓冲区,则显示现有的缓冲区。

(defun csharp-repl() 
    "Switch to the CSharpRepl buffer, creating it if necessary." 
    (interactive) 
    (let ((buf (get-buffer "*csharp*"))) 
    (if buf 
     (pop-to-buffer buf) 
     (progn 
      (split-window) 
      (other-window 1) 
      (comint-run "csharp"))))) 

(define-key csharp-mode-map (kbd "C-c C-z") 'csharp-repl)