如何在Windows上的Emacs中交互地运行node.js [英] how to run node.js interactively in Emacs on Windows

查看:145
本文介绍了如何在Windows上的Emacs中交互地运行node.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以为这可以工作:

 (defun my-node()
(interactive)
(pop-to-buffer(make-comintmy-nodenode))

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



这是在Windows 7上的Emacs 24.0.50.1中,NodeJS安装没有任何特殊配置。



node.js非交互式,如 Mx编译RET节点hello-world.js RET 工作正常。 c code code code code code code code code code $ c $可能是相关的:当我运行 Mx shell 并在shell缓冲区中输入 node ,然后输入 1 + 1 ,它不显示结果。我必须错过非常基本的东西。



更新:



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

解决方案

我找到了一个解决方案。



创建一个启动JavaScript REPL界面的节点脚本。



node-in-node.js:

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

将节点路径\toto\\\
ode-in-node.js传递给make-comint而不是简单的节点。

 (defun my-node-shell()
(interactive)
(pop-to-buffer(make-comintNode ShellnodenilC:\\\run\\\\
ode-in-node.js)))

运行 Mx my-node-shell 在Windows Emacs中运行JavaScript shell。我不知道为什么这个工作。选项卡完成,语法高亮,通过Shift + Enter的多行输入不起作用。


I thought this would work:

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

But when I do M-x my-node and enter 1+1 in the comint buffer, it does not display any output.

This is in Emacs 24.0.50.1 on Windows 7 and NodeJS is installed without any special configuration.

Calling node.js non-interactively as in M-x compile RET node hello-world.js RET works fine. Running node interactively in cmd works fine.

This might be related: when I run M-x shell and enter node in the shell buffer and then enter 1+1, it doesn't display the result. I must be missing something very basic.

Update:

Probably related: emacs/Python: running python-shell in line buffered vs. block buffered mode - Stack Overflow

解决方案

I found one solution.

Make a node script which starts a JavaScript REPL interface.

node-in-node.js:

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

Pass "node path\to\node-in-node.js" to make-comint instead of simply "node".

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

Run M-x my-node-shell to run a JavaScript shell in Windows Emacs. I don't know why this works. Tab completion, syntax highlight, multiline input via Shift+Enter does not work.

这篇关于如何在Windows上的Emacs中交互地运行node.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆