科技动态

Using Node.js with JS-comint in Emacs

微信扫一扫,分享到朋友圈

Using Node.js with JS-comint in Emacs
0

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?

Problem courtesy of: Mirzhan Irkegulov

Solution

(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)))))

33
is the escape character it prints as ^[
.

Solution courtesy of: user797257

阅读原文...


Node.js Recipes

XRP Price – Bull Trap on a Sunday

上一篇

Moose Extends More Tests

下一篇

您也可能喜欢

评论已经被关闭。

插入图片
Using Node.js with JS-comint in Emacs

长按储存图像,分享给朋友