Skip to content

Commit c35297a

Browse files
committed
Merge branch 'release/0.2.0'
2 parents d0b4e56 + 78f98c5 commit c35297a

File tree

4 files changed

+198
-131
lines changed

4 files changed

+198
-131
lines changed

.travis.yml

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
11
language: node_js
22
node_js:
3-
- "0.6"
4-
- "0.8"
5-
- "0.10"
6-
- "0.12"
7-
- "4"
8-
- "5"
9-
- "6"
10-
- "node"
3+
- 6
4+
- 8
5+
- 10
116

127
env:
13-
- EVM_EMACS=emacs-24.1-travis
14-
- EVM_EMACS=emacs-24.2-travis
15-
- EVM_EMACS=emacs-24.3-travis
16-
- EVM_EMACS=emacs-24.4-travis
178
- EVM_EMACS=emacs-24.5-travis
189
- EVM_EMACS=emacs-25.1-travis
10+
- EVM_EMACS=emacs-25.2-travis
11+
- EVM_EMACS=emacs-25.3-travis
12+
- EVM_EMACS=emacs-26.1-travis
13+
14+
matrix:
15+
exclude:
16+
- node_js: 6
17+
env: EVM_EMACS=emacs-25.1-travis
18+
- node_js: 6
19+
env: EVM_EMACS=emacs-25.2-travis
20+
- node_js: 6
21+
env: EVM_EMACS=emacs-25.3-travis
22+
- node_js: 6
23+
env: EVM_EMACS=emacs-26.1-travis
1924

2025
before_install:
2126
- curl -fsSkL https://gist.github.com/rejeep/ebcd57c3af83b049833b/raw > x.sh && source ./x.sh

README.md

Lines changed: 41 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,59 @@ Description
88

99
This program is derived from comint-mode and provides the following features.
1010

11-
* token completion, same as Node.js REPL
12-
* file name completion in string
13-
* incremental history search
14-
* sending JavaScript codes to REPL
11+
* token completion, same as Node.js REPL
12+
* file name completion in string
13+
* incremental history search
14+
* sending JavaScript codes to REPL
1515

1616
Usage
1717
-----
1818

1919
Put this file in your Emacs lisp path (e.g. ~/.emacs.d/site-lisp)
2020
and add the following line to your .emacs:
2121

22-
(require 'nodejs-repl)
22+
```elisp
23+
(require 'nodejs-repl)
24+
```
2325

2426
Type `M-x nodejs-repl` to run Node.js REPL.
2527
See also `comint-mode` to check key bindings.
2628

2729
You can define key bindings to send JavaScript codes to REPL like below:
2830

29-
(add-hook 'js-mode-hook
30-
(lambda ()
31-
(define-key js-mode-map (kbd "C-x C-e") 'nodejs-repl-send-last-expression)
32-
(define-key js-mode-map (kbd "C-c C-j") 'nodejs-repl-send-line)
33-
(define-key js-mode-map (kbd "C-c C-r") 'nodejs-repl-send-region)
34-
(define-key js-mode-map (kbd "C-c C-l") 'nodejs-repl-load-file)
35-
(define-key js-mode-map (kbd "C-c C-z") 'nodejs-repl-switch-to-repl)))
36-
31+
```elisp
32+
(add-hook 'js-mode-hook
33+
(lambda ()
34+
(define-key js-mode-map (kbd "C-x C-e") 'nodejs-repl-send-last-expression)
35+
(define-key js-mode-map (kbd "C-c C-j") 'nodejs-repl-send-line)
36+
(define-key js-mode-map (kbd "C-c C-r") 'nodejs-repl-send-region)
37+
(define-key js-mode-map (kbd "C-c C-l") 'nodejs-repl-load-file)
38+
(define-key js-mode-map (kbd "C-c C-z") 'nodejs-repl-switch-to-repl)))
39+
```
40+
41+
When a version manager such as nvm is used to run different versions
42+
of Node.js, it is often desirable to start the REPL of the version
43+
specified in the .nvmrc file per project. In such case, customize the
44+
`nodejs-repl-command` variable with a function symbol. That function
45+
should query nvm for the Node.js command to run. For example:
46+
47+
```elisp
48+
(require 'nodejs-repl)
49+
(defun nvm-which ()
50+
(let* ((shell (concat (getenv "SHELL") " -l -c 'nvm which'"))
51+
(output (shell-command-to-string shell)))
52+
(cadr (split-string output "[\n]+" t))))
53+
(setq nodejs-repl-command #'nvm-which)
54+
```
55+
56+
The `nvm-which` function can be simpler, and perhaps can run faster,
57+
too, if using Bash:
58+
59+
```elisp
60+
(defun nvm-which ()
61+
(let ((output (shell-command-to-string "source ~/.nvm/nvm.sh; nvm which")))
62+
(cadr (split-string output "[\n]+" t))))
63+
```
3764

3865
Author
3966
------
@@ -44,7 +71,7 @@ Takeshi Arabiki (abicky)
4471
Copyright and License
4572
---------------------
4673

47-
Copyright (C) 2012-2017 Takeshi Arabiki (abicky)
74+
Copyright (C) 2012-2018 Takeshi Arabiki (abicky)
4875

4976
This program is free software: you can redistribute it and/or modify
5077
it under the terms of the GNU General Public License as published by

0 commit comments

Comments
 (0)