nodejs-repl.el icon indicating copy to clipboard operation
nodejs-repl.el copied to clipboard

Error in process filter

Open leafarbelm opened this issue 4 years ago • 5 comments

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))))

leafarbelm avatar Sep 11 '20 18:09 leafarbelm

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.

zodmaner avatar Sep 28 '20 08:09 zodmaner

Hi, I've also had this problem with Node v16.9.1, nodejs-repl version 0.2.4, and emacs version 27.1

digitables avatar Sep 20 '21 12:09 digitables

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)

digitables avatar Sep 20 '21 12:09 digitables

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.

dop avatar Oct 19 '21 10:10 dop

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 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.

This seems to be working for me so far!

dfpetrin avatar May 10 '22 18:05 dfpetrin

I've released nodejs-repl.el 0.2.5 that has resolved the bug, so I'll close this issue.

abicky avatar Feb 19 '24 00:02 abicky