From 7626c49bde93463e2a509ac31f8dbc8feed3d973 Mon Sep 17 00:00:00 2001 From: Alex Kost Date: Thu, 7 Apr 2016 16:25:43 +0300 Subject: Fix REPL reconnecting This fixes 2 issues: 1. Reconnecting to a remote process prompts for host/port, although it is not needed. 2. 'geiser-connect' should be used only if 'geiser-repl--address' is a host/port pair. When it is a socket file name, 'geiser-connect-local' should be used. --- elisp/geiser-repl.el | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/elisp/geiser-repl.el b/elisp/geiser-repl.el index 88e1ce3..46d240c 100644 --- a/elisp/geiser-repl.el +++ b/elisp/geiser-repl.el @@ -320,7 +320,13 @@ module command as a string") (make-variable-buffer-local (defvar geiser-repl--connection nil)) -(defun geiser-repl--remote-p () geiser-repl--address) +(defun geiser-repl--local-p () + "Return non-nil, if current REPL is local (connected to socket)." + (stringp geiser-repl--address)) + +(defun geiser-repl--remote-p () + "Return non-nil, if current REPL is remote (connected to host:port)." + (consp geiser-repl--address)) (defsubst geiser-repl--host () (car geiser-repl--address)) (defsubst geiser-repl--port () (cdr geiser-repl--address)) @@ -801,7 +807,10 @@ If no REPL is running, execute `run-geiser' to start a fresh one." (when (buffer-live-p geiser-repl--last-scm-buffer) (geiser-repl--switch-to-buffer geiser-repl--last-scm-buffer))) (repl (geiser-repl--switch-to-buffer repl)) - ((geiser-repl--remote-p) (geiser-connect impl)) + ((geiser-repl--remote-p) + (geiser-connect impl (geiser-repl--host) (geiser-repl--port))) + ((geiser-repl--local-p) + (geiser-connect-local impl geiser-repl--address)) (impl (run-geiser impl)) (t (call-interactively 'run-geiser))) (geiser-repl--maybe-remember-scm-buffer buffer))) -- cgit v1.2.3