0

nodejs-repl command starts a *nodejs* commit-buffer. How to send the contents of a javascript buffer to the *nodejs* buffer using a key binding. Is there a command in commint-mode which does that.

Talespin_Kit
  • 20,830
  • 29
  • 89
  • 135
  • 1
    Probably! You can get a list of keybindings available in a given buffer with `C-h m` or `M-x describe-mode RET`; most likely, you'll find what you are looking for there. – Aaron Miller Mar 31 '14 at 14:55

1 Answers1

0

i thought i had send-to-node-repl bound to a key by default just a few days ago, but today it was gone. maybe i gave up searching too soon, but writing this seemed quicker:

(defun send-region-to-nodejs-repl-process (start end)
  "Send region to `nodejs-repl' process."
  (interactive "r")
  (save-selected-window
    (save-excursion (nodejs-repl)))
  (comint-send-region (get-process nodejs-repl-process-name)
                      start end))

(define-key js3-mode-map (kbd "C-c C-r") 'send-region-to-nodejs-repl-process)

replace js3-mode-map with some other keymap if that isn't where you want it available.

jsvnm
  • 676
  • 6
  • 10