Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reusing dead REPL can sometimes lead to REPL being unusable #3254

Closed
OlegTheCat opened this issue Oct 4, 2022 · 2 comments
Closed

Reusing dead REPL can sometimes lead to REPL being unusable #3254

OlegTheCat opened this issue Oct 4, 2022 · 2 comments

Comments

@OlegTheCat
Copy link

Expected behavior

Upon loading, the REPL is ready to use

Actual behavior

REPL becomes broken and is not editable.

Steps to reproduce the problem

  1. Start a REPL.
  2. Kill the corresponding nrepl buffer.
  3. Now we have a REPL with a message *** Closed on ... *** -> in this buffer move a cursor to the begging of the buffer.
  4. Start a new REPL and agree to reuse a dead REPL.

Environment & Version information

CIDER version information

;; CIDER 1.2.0 (Nice), nREPL 0.9.0
;; Clojure 1.10.3, Java 1.8.0_322

Lein / Clojure CLI version

Boot 2.8.3

Emacs version

GNU Emacs 27.2 (build 1, aarch64-apple-darwin21.3.0, NS appkit-2113.30 Version 12.2 (Build 21D49)) of 2022-02-09

Operating system

Mac OS 12.6 (M1 processor).

JDK distribution

openjdk version "1.8.0_322"

@OlegTheCat OlegTheCat changed the title Reusing dead REPL can sometimes lead to a REPL being unusable Reusing dead REPL can sometimes lead to REPL being unusable Oct 4, 2022
@benjamin-asdf
Copy link
Contributor

I am killing dead repls instead and never regret it.

(defun mm/cleanup-cider-repls-and-do-not-reuse (&rest _)
  (let ((repls (seq-filter
		(lambda (b)
		  (with-current-buffer
		      b
		    (and (derived-mode-p
			  'cider-repl-mode)
			 (not (process-live-p
			       (get-buffer-process b))))))
		(buffer-list))))
    (mapc #'kill-buffer repls)
    '()))

(advice-add #'cider--choose-reusable-repl-buffer :override #'mm/cleanup-cider-repls-and-do-not-reuse)

@vemv
Copy link
Member

vemv commented Aug 24, 2023

I tried to repro this.

Reusing dead repls worked correctly for me.

It's probably because of the misc improvements we've had in this area.

Anyway, as of CIDER master, you can also set the new customization variable cider-reuse-dead-repls to nil.

@vemv vemv closed this as completed Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants