如何在Windows上的Emacs中交互地运行node.js

我认为这将工作:

(defun my-node () (interactive) (pop-to-buffer (make-comint "my-node" "node"))) 

但是当我做Mx my-node并且在comint缓冲区中input1+1时,它不显示任何输出。

这是在Windows 7上的Emacs 24.0.50.1,NodeJS没有任何特殊的configuration。

像在Mx compile RET node hello-world.js RET一样非交互调用node.js Mx compile RET node hello-world.js RET工作正常。 在cmd交互方式运行node工作正常。

这可能是相关的:当我运行Mx shell并在shell缓冲区中inputnode ,然后input1+1 ,它不显示结果。 我必须错过一些非常基本的东西。

更新:

可能相关: emacs / Python:在行缓冲模式和块缓冲模式下运行python-shell – 堆栈溢出

将node.js(使用node v0.8.1进行testing)作为Emacs下的低级shell的最简单方法是使用js-comint包。 然后,设置(setq inferior-js-program-command "node --interactive")强制节点以交互模式运行。 命令Mx run-js将打开解释器。

同样,你可以很容易地validationnode --interactive交互在一个eshell内工作。

http://www.gnu.org/software/emacs/windows/Sub_002dprocesses.html ,它看起来好像是可能发生的是输出被节点缓冲。 如果有一个修改缓冲的选项,你可以尝试通过。

假设这是一个缓冲问题,可能还有其他解决方法,但是我的Windows知识还不够完整。 举个例子,我会喜欢在Windows平台上的一个通用的解决scheme,这是一个恼人的问题,当它出现。

我find了一个解决scheme

创build一个启动JavaScript REPL接口的节点脚本。

节点在-的node.js:

 var repl = require("repl"); repl.start(); 

将“节点path\”传递给\ node-in-node.js中的make-comint而不是简单的“node”。

 (defun my-node-shell () (interactive) (pop-to-buffer (make-comint "Node Shell" "node" nil "C:\\run\\node-in-node.js"))) 

运行Mx my-node-shell shell在Windows Emacs中运行JavaScript shell。 我不知道为什么这个工作。 标签填写,语法高亮显示,通过Shift + Enter的多行input不起作用。