在Emacs中使用Node.js和JS-comint [英] Using Node.js with JS-comint in Emacs
问题描述
js-mode
.net /rel =noreferrer> MELPA ,执行 run-js
,现在在REPL而不是>
sign我有这个乱码: ^ [[1G> ^ [[0K ^ [[3G
在不利的Javascript模式下,REPL本身工作正常,只是>
符号已更改。如果输入未完成的表达式,它甚至打印 ^ [[1G ... ^ [[0K ^ [[5G
。 ^ [
是不复制粘贴的系统字符,我添加它们,让您有一个想法。
在我的init文件中:
(require'js-comint)
(setq inferior-js程序命令nodejs)
终端调用 nodejs
生成工作REPL。
为什么要以这种方式行事?
(setq inferior-js-mode-钩子
(lambda()
;;我们喜欢漂亮的颜色
(ansi-color-for-comint-mode-on)
;;处理一些提示废话
(add-to-list
'comint-preoutput-filter-functions
(lambda(output)
(replace-regexp-in-string\033\\ [[[ 0-9] + [GK]输出)))))
\033
是它作为 ^ [
]打印的转义字符。
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
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.
In my init-file:
(require 'js-comint)
(setq inferior-js-program-command "nodejs")
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 "\033\\[[0-9]+[GK]" "" output)))))
\033
is the escape character it prints as ^[
.
这篇关于在Emacs中使用Node.js和JS-comint的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!