Skip to content

Commit

Permalink
[Fix clojure-emacs#2435] Remove killed REPLs from session in client s…
Browse files Browse the repository at this point in the history
…entinel

   And rename :no-server-kill to :keep-server process property
  • Loading branch information
vspinu committed Sep 21, 2018
1 parent 7008a33 commit def4c0b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions cider-connection.el
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ buffer."
;; inform sentinel not to kill the server, if any
(thread-first (get-buffer-process repl)
(process-plist)
(plist-put :no-server-kill t))))
(plist-put :keep-server t))))
(let ((proc (get-buffer-process repl)))
(when (and (process-live-p proc)
(or (not nrepl-server-buffer)
Expand Down Expand Up @@ -645,8 +645,8 @@ function with the repl buffer set as current."
cider-repl-init-function (plist-get params :repl-init-function))
(cider-repl-reset-markers)
(add-hook 'nrepl-response-handler-functions #'cider-repl--state-handler nil 'local)
(add-hook 'nrepl-connected-hook 'cider--connected-handler nil 'local)
(add-hook 'nrepl-disconnected-hook 'cider--disconnected-handler nil 'local)
(add-hook 'nrepl-connected-hook #'cider--connected-handler nil 'local)
(add-hook 'nrepl-disconnected-hook #'cider--disconnected-handler nil 'local)
(current-buffer))))


Expand Down
5 changes: 4 additions & 1 deletion nrepl-client.el
Original file line number Diff line number Diff line change
Expand Up @@ -466,12 +466,15 @@ and kill the process buffer."
(substring message 0 -1)))
(when (equal (process-status process) 'closed)
(when-let* ((client-buffer (process-buffer process)))
(sesman-remove-object 'CIDER nil client-buffer
(not (process-get process :keep-server))
'no-error)
(nrepl--clear-client-sessions client-buffer)
(with-current-buffer client-buffer
(run-hooks 'nrepl-disconnected-hook)
(let ((server-buffer nrepl-server-buffer))
(when (and (buffer-live-p server-buffer)
(not (plist-get (process-plist process) :no-server-kill)))
(not (process-get process :keep-server)))
(setq nrepl-server-buffer nil)
(nrepl--maybe-kill-server-buffer server-buffer)))))))

Expand Down

0 comments on commit def4c0b

Please sign in to comment.