CSharpRepl emacs 集成?

发布于 2024-11-13 07:53:11 字数 163 浏览 11 评论 0原文

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

I happen to know mono's CSharpRepl, are there emacs csharp mode that use this to run REPL in one window, and compile/run the C# code in the other window just like python mode?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

—━☆沉默づ 2024-11-20 07:53:11

您只需创建一个 lisp 函数来调用 CSharpRepl,并在处理 C# 代码时分配一个键来调用它。例如,您可以将以下内容放入您的 Emacs init 文件中(假设 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# 代码。

You could just create a lisp function to call the CSharpRepl and assign a key to call it when you're working on C# code. For example, you could put the following in your Emacs init file (assuming the CSharpRepl executable "csharp" is in your 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)

So, if you're editing a C# program (using whatever mode you prefer), you can now press F11 and the CSharpRepl will open up in a new window so that you can interactively evaluate C# code.

隱形的亼 2024-11-20 07:53:11

对已接受的答案稍加补充。调出现有缓冲区(如果存在)。

(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)

A slight addition to the accepted answer. Brings up an existing buffer if it exists.

(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)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文