简体   繁体   English

emacs缓冲区中的node.js没有进程-更好的系统在emacs中交互执行js

[英]node.js in emacs buffer has no process---better system to execute js interactively in emacs

I am trying to set up a nodejs dev environment in emacs, but having some trouble navigating the differences between: 我正在尝试在emacs中设置一个nodejs开发环境,但是在导航之间的区别时遇到了一些麻烦:

  • node-repl 节点代表
  • nodejs-repl nodejs-repl
  • nodejs-repl-mode and nodejs-repl-mode和
  • javascript-mode javascript模式

...and how I should combine these to have command line execution, syntax highlighting, and autocomplete---the sort of things I have set up with say, python or generally using emacs for development. ...以及如何将它们结合起来以具有命令行执行,语法突出显示和自动完成功能-这些都是我用python设置的,或者通常使用emacs进行开发的东西。

I think I am currently using nodejs-mode with REPL. 我目前在REPL中使用nodejs-mode。

I have the following script I am trying to execute, just to see if I can get simple Cc Cc evaluation to work. 我尝试执行以下脚本,以查看是否可以进行简单的Cc Cc评估工作。 It seems, however, that my javascript-editing buffer, right pane, is not connected to my nodejs execution buffer, left pane: 但是,似乎我的javascript编辑缓冲区右窗格未连接到我的nodejs执行缓冲区左窗格:

在此处输入图片说明

I understand I could probably just rebind some keys so Cc Cc sends to the interactive nodejs buffer---but it's unclear to me how to generally attach that process, or even what that function would be called. 我知道我可能可以重新绑定一些键,以便Cc Cc发送到交互式nodejs缓冲区-但我不清楚如何一般附加该进程,甚至该函数将被调用。 (And it makes me suspect someone has probably done this before much better than I would!) (这使我怀疑有人可能比我做的要好得多!)

I have configured my setup for node.js a few days ago. 几天前,我已经为node.js配置了我的设置。 I use: 我用:

They are both available through MELPA . 它们都可以通过MELPA获得

After you install js-comint add: 安装js-comint之后,添加:

(require 'js-comint)
(setq inferior-js-program-command "nodejs")
(setenv "NODE_NO_READLINE" "1")

and for the keys: 和键:

(add-hook 'js2-mode-hook 
          '(lambda ()
            (local-set-key (kbd "C-x C-e") 'js-send-last-sexp)
            (local-set-key (kbd "C-x C-r") 'js-send-region)
            (local-set-key (kbd "C-M-x") 'js-send-last-sexp-and-go)
            (local-set-key (kbd "C-c b") 'js-send-buffer)
            (local-set-key (kbd "C-c C-b") 'js-send-buffer-and-go)))

You can run the REPL with Mx run-js . 您可以使用Mx run-js运行REPL。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM