33; ; Copyright (C) 2012-2017 Takeshi Arabiki
44
55; ; Author: Takeshi Arabiki
6- ; ; Version: 0.2.0
6+ ; ; Version: 0.2.1
77
88; ; This program is free software: you can redistribute it and/or modify
99; ; it under the terms of the GNU General Public License as published by
7373 " Run Node.js REPL and communicate the process."
7474 :group 'processes )
7575
76- (defconst nodejs-repl-version " 0.2.0 "
76+ (defconst nodejs-repl-version " 0.2.1 "
7777 " Node.js mode Version." )
7878
7979(defcustom nodejs-repl-command " node"
@@ -94,6 +94,10 @@ such as nvm."
9494 :group 'nodejs-repl
9595 :type 'string )
9696
97+ (defcustom nodejs-repl-use-global " false"
98+ " useGlobal option of Node.js REPL method repl.start"
99+ :group 'nodejs-repl
100+ :type 'string )
97101
98102(defcustom nodejs-repl-input-ignoredups t
99103 " If non-nil, don't add input matching the last on the input ring.
@@ -135,8 +139,8 @@ See also `comint-process-echoes'"
135139
136140(defvar nodejs-repl-code-format
137141 (concat
138- " require('repl').start('%s', null, null, true, false, "
139- " require('repl')['REPL_MODE_' + '%s'.toUpperCase()])" ))
142+ " require('repl').start({prompt: '%s', useGlobal: %s, replMode: "
143+ " require('repl')['REPL_MODE_' + '%s'.toUpperCase()] } )" ))
140144
141145(defvar nodejs-repl-extra-espace-sequence-re " \\ (\x 1b\\ [[0-9]+[GJK]\\ )" )
142146
@@ -526,7 +530,7 @@ otherwise spawn one."
526530 (shell-command-to-string (concat node-command " --version" ))))
527531 (let* ((repl-mode (or (getenv " NODE_REPL_MODE" ) " magic" ))
528532 (nodejs-repl-code (format nodejs-repl-code-format
529- nodejs-repl-prompt repl-mode )))
533+ nodejs-repl-prompt nodejs- repl-use-global repl-mode )))
530534 (pop-to-buffer
531535 (apply 'make-comint nodejs-repl-process-name node-command nil
532536 `(,@nodejs-repl-arguments " -e" , nodejs-repl-code )))
0 commit comments