在 Emacs 中使用 Node.js 和 JS-comint [英] Using Node.js with JS-comint in Emacs
问题描述
我使用 Emacs 24.2.我已经从 MELPA<安装了 js-comint
和 js-mode
/a>,执行 run-js
,现在在 REPL 而不是 >
符号我有这个胡言乱语:
I use Emacs 24.2. I've installed js-comint
and js-mode
from MELPA, executed run-js
, and now in REPL instead of >
sign i have this gibberish:
^[[1G> ^[[0K^[[3G
REPL 本身在 Inferior Javascript 模式下工作得很好,只是 >
符号被改变了.如果您输入未完成的表达式,它甚至会打印 ^[[1G... ^[[0K^[[5G
].^[
是系统字符,不是用复制粘贴复制的,我把它们加起来让你有想法.
The REPL itself in Inferior Javascript mode works just fine, just the >
sign is changed. If you enter unfinished expression, it even prints ^[[1G... ^[[0K^[[5G
. The ^[
are system characters, that are not copied with copy-paste, i add them for you to have an idea.
在我的初始化文件中:
(require 'js-comint)
(setq inferior-js-program-command "nodejs")
在终端调用 nodejs
产生工作 REPL.
In terminal calling nodejs
produces working REPL.
为什么提示会这样?我应该怎么做才能纠正这个问题?
Why prompt behaves this way? What should i do to correct this?
推荐答案
(setq inferior-js-mode-hook
(lambda ()
;; We like nice colors
(ansi-color-for-comint-mode-on)
;; Deal with some prompt nonsense
(add-to-list
'comint-preoutput-filter-functions
(lambda (output)
(replace-regexp-in-string " 33\[[0-9]+[GK]" "" output)))))