Skip to content

Commit

Permalink
Merge branch 'release/0.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
abicky committed Sep 17, 2018
2 parents d0b4e56 + 78f98c5 commit c35297a
Show file tree
Hide file tree
Showing 4 changed files with 198 additions and 131 deletions.
29 changes: 17 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
language: node_js
node_js:
- "0.6"
- "0.8"
- "0.10"
- "0.12"
- "4"
- "5"
- "6"
- "node"
- 6
- 8
- 10

env:
- EVM_EMACS=emacs-24.1-travis
- EVM_EMACS=emacs-24.2-travis
- EVM_EMACS=emacs-24.3-travis
- EVM_EMACS=emacs-24.4-travis
- EVM_EMACS=emacs-24.5-travis
- EVM_EMACS=emacs-25.1-travis
- EVM_EMACS=emacs-25.2-travis
- EVM_EMACS=emacs-25.3-travis
- EVM_EMACS=emacs-26.1-travis

matrix:
exclude:
- node_js: 6
env: EVM_EMACS=emacs-25.1-travis
- node_js: 6
env: EVM_EMACS=emacs-25.2-travis
- node_js: 6
env: EVM_EMACS=emacs-25.3-travis
- node_js: 6
env: EVM_EMACS=emacs-26.1-travis

before_install:
- curl -fsSkL https://gist.github.com/rejeep/ebcd57c3af83b049833b/raw > x.sh && source ./x.sh
Expand Down
55 changes: 41 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,59 @@ Description

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

* token completion, same as Node.js REPL
* file name completion in string
* incremental history search
* sending JavaScript codes to REPL
* token completion, same as Node.js REPL
* file name completion in string
* incremental history search
* sending JavaScript codes to REPL

Usage
-----

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

(require 'nodejs-repl)
```elisp
(require 'nodejs-repl)
```

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

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

(add-hook 'js-mode-hook
(lambda ()
(define-key js-mode-map (kbd "C-x C-e") 'nodejs-repl-send-last-expression)
(define-key js-mode-map (kbd "C-c C-j") 'nodejs-repl-send-line)
(define-key js-mode-map (kbd "C-c C-r") 'nodejs-repl-send-region)
(define-key js-mode-map (kbd "C-c C-l") 'nodejs-repl-load-file)
(define-key js-mode-map (kbd "C-c C-z") 'nodejs-repl-switch-to-repl)))

```elisp
(add-hook 'js-mode-hook
(lambda ()
(define-key js-mode-map (kbd "C-x C-e") 'nodejs-repl-send-last-expression)
(define-key js-mode-map (kbd "C-c C-j") 'nodejs-repl-send-line)
(define-key js-mode-map (kbd "C-c C-r") 'nodejs-repl-send-region)
(define-key js-mode-map (kbd "C-c C-l") 'nodejs-repl-load-file)
(define-key js-mode-map (kbd "C-c C-z") 'nodejs-repl-switch-to-repl)))
```

When a version manager such as nvm is used to run different versions
of Node.js, it is often desirable to start the REPL of the version
specified in the .nvmrc file per project. In such case, customize the
`nodejs-repl-command` variable with a function symbol. That function
should query nvm for the Node.js command to run. For example:

```elisp
(require 'nodejs-repl)
(defun nvm-which ()
(let* ((shell (concat (getenv "SHELL") " -l -c 'nvm which'"))
(output (shell-command-to-string shell)))
(cadr (split-string output "[\n]+" t))))
(setq nodejs-repl-command #'nvm-which)
```

The `nvm-which` function can be simpler, and perhaps can run faster,
too, if using Bash:

```elisp
(defun nvm-which ()
(let ((output (shell-command-to-string "source ~/.nvm/nvm.sh; nvm which")))
(cadr (split-string output "[\n]+" t))))
```

Author
------
Expand All @@ -44,7 +71,7 @@ Takeshi Arabiki (abicky)
Copyright and License
---------------------

Copyright (C) 2012-2017 Takeshi Arabiki (abicky)
Copyright (C) 2012-2018 Takeshi Arabiki (abicky)

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

0 comments on commit c35297a

Please sign in to comment.