diff options
Diffstat (limited to 'nrepl-client.el')
-rw-r--r-- | nrepl-client.el | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/nrepl-client.el b/nrepl-client.el index 7db01ec9..33a6cfd9 100644 --- a/nrepl-client.el +++ b/nrepl-client.el @@ -1,7 +1,7 @@ ;;; nrepl-client.el --- Client for Clojure nREPL -*- lexical-binding: t -*- ;; Copyright © 2012-2013 Tim King, Phil Hagelberg, Bozhidar Batsov -;; Copyright © 2013-2018 Bozhidar Batsov, Artur Malabarba and CIDER contributors +;; Copyright © 2013-2019 Bozhidar Batsov, Artur Malabarba and CIDER contributors ;; ;; Author: Tim King <kingtim@gmail.com> ;; Phil Hagelberg <technomancy@gmail.com> @@ -466,12 +466,20 @@ 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 + (goto-char (point-max)) + (insert-before-markers + (propertize + (format "\n*** Closed on %s ***\n" (current-time-string)) + 'face 'cider-repl-stderr-face)) (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))))))) @@ -501,7 +509,11 @@ key-values depending on the connection type." (message "[nREPL] Falling back to SSH tunneled connection ...") (nrepl--ssh-tunnel-connect host port)) ;; fallback is either not enabled or it failed as well - (error "[nREPL] Cannot connect to %s:%s" host port)) + (if (and (null nrepl-use-ssh-fallback-for-remote-hosts) + (not localp)) + (error "[nREPL] Direct connection to %s:%s failed; try setting `nrepl-use-ssh-fallback-for-remote-hosts' to t" + host port) + (error "[nREPL] Cannot connect to %s:%s" host port))) ;; `nrepl-force-ssh-for-remote-hosts' is non-nil (nrepl--ssh-tunnel-connect host port))))) @@ -719,10 +731,7 @@ to the REPL." (propertize msg 'face face) (format "%s: %s" (upcase type) msg)))) (cider-repl--emit-interactive-output msg (or face 'font-lock-builtin-face)) - (message msg) - ;; Interactive eval handler covers this message, but it won't be eval - ;; middleware using this functionality. - (sit-for 2))) + (message msg))) (defvar cider-buffer-ns) (defvar cider-special-mode-truncate-lines) @@ -1044,7 +1053,9 @@ been determined." (when (and (null nrepl-endpoint) (string-match "nREPL server started on port \\([0-9]+\\)" output)) (let ((port (string-to-number (match-string 1 output)))) - (setq nrepl-endpoint (list :host "localhost" :port port)) + (setq nrepl-endpoint (list :host (or (file-remote-p default-directory 'host) + "localhost") + :port port)) (message "[nREPL] server started on %s" port) (when nrepl-on-port-callback (funcall nrepl-on-port-callback (process-buffer process))))))))) |