nodejs-repl.el
nodejs-repl.el copied to clipboard
Error in process filter
Emacs version: 27.1 nodejs-repl version: 0.2.4 Node version: 14.10.1
Steps to reproduce: 1. Open any .js file 2. Execute M-x nodejs-repl 3. digit any expression on the repl (e.g. 5 + 8)
I installed this mode and when i execute any expression in the REPL buffer i get the following errors:
error in process filter: run-hook-with-args: End of buffer
error in process filter: End of buffer
and the RELP hang up a little bit, i don't now much about elisp so i was wondering if someone could help me with this?
This is the config i use, nothing especial:
(use-package nodejs-repl
:config
(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-c") 'nodejs-repl-send-buffer)
(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))))
I've also encountered this problem on Emacs 26.3 with nodejs-repl versions 0.2.4 and 0.2.3 and Node versions v14.12.0 and v12.18.4.
Hi, I've also had this problem with Node v16.9.1, nodejs-repl version 0.2.4, and emacs version 27.1
Found a fix on floscr's emacs config! IIRC map!
is a Doom Emacs thing so it might not work on vanilla or spacemacs.
https://github.com/floscr/emacs.d/blob/master/config.org
The specific thing I did was add the following snipped to the end of ~/.doom.d/config.el
:
(map!
:after comint
:map comint-mode-map
:ni "RET" (cmd! (comint-send-input nil t))
:n "<C-backspace>" #'comint-clear-buffer)
I think I have a workaround. It seems that culprit is nodejs-repl--delete-prompt
in comint-output-filter-functions
.
(defun dp/nodejs-repl-remove-broken-filter ()
(remove-hook 'comint-output-filter-functions 'nodejs-repl--delete-prompt t))
(add-hook 'nodejs-repl-mode-hook #'dp/nodejs-repl-remove-broken-filter)
This results in duplicated prompt from time to time. But it's better than freezing.
Found a fix on floscr's emacs config! IIRC
map!
is a Doom Emacs thing so it might not work on vanilla or spacemacs. https://github.com/floscr/emacs.d/blob/master/config.org The specific thing I did was add the following snipped to the end of~/.doom.d/config.el
:(map! :after comint :map comint-mode-map :ni "RET" (cmd! (comint-send-input nil t)) :n "<C-backspace>" #'comint-clear-buffer)
Unfortunately this leads to echoing back the input, which is annoying.
I think I have a workaround. It seems that culprit is
nodejs-repl--delete-prompt
incomint-output-filter-functions
.(defun dp/nodejs-repl-remove-broken-filter () (remove-hook 'comint-output-filter-functions 'nodejs-repl--delete-prompt t)) (add-hook 'nodejs-repl-mode-hook #'dp/nodejs-repl-remove-broken-filter)
This results in duplicated prompt from time to time. But it's better than freezing.
This seems to be working for me so far!
I've released nodejs-repl.el 0.2.5 that has resolved the bug, so I'll close this issue.