【问题标题】:CSharpRepl emacs integration?CSharpRepl emacs 集成?
【发布时间】:2011-09-06 14:47:35
【问题描述】:

我碰巧知道mono的CSharpRepl,是否有emacs csharp模式使用它在一个窗口中运行REPL,并像python模式一样在另一个窗口中编译/运行C#代码?

【问题讨论】:

  • 我从来没有听说过这样的事情。您可能会研究 SLIME 项目,因为它非常相似。

标签: c# emacs mono read-eval-print-loop


【解决方案1】:

您可以创建一个 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)
    

    【讨论】:

      猜你喜欢
      • 2012-01-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-08
      • 2011-05-04
      • 2011-06-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多