abicky / nodejs-repl.el

Run Node.js REPL and communicate with the process
190 stars 38 forks source link

Add some buffer interaction commands #6

Closed PuercoPop closed 8 years ago

PuercoPop commented 9 years ago

Oi, First let me thank you for this, being able to run the node repl from inside emacs was 90% of what I was looking for.

I've added some buffer interaction commands like, load-file, send-region, send-last-sexp, etc. Ideally one would bind them to the js mode one uses, for example

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

A controversional change in the PR was to coalesce the arguments passed to the nodejs process. Feel free to drop it if you disagree with it.

One thing I haven't decided is, if load-file should use nodejs's .load file command.

CestDiego commented 8 years ago

@abicky I think this is a much needed addition to the package.

abicky commented 8 years ago

@PuercoPop I'm sorry my soooooooo late reply :bow: and thank you for your PR!

Feel free to drop it if you disagree with it.

Currently, I want to keep compatibility of custom variables, so I'll drop https://github.com/PuercoPop/nodejs-repl.el/commit/2095ca735412f52bb2b5b5bf9057808232f33200.

One thing I haven't decided is, if load-file should use nodejs's .load file command.

I think the name of nodejs-repl-load-file you have implemented should be nodejs-repl-send-buffer and it shouldn't use .load command because the content of the buffer which is not saved can be differ from the saved content.