summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-02-18 17:25:44 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2014-02-27 15:06:12 +0100
commitd903e2c8df9dc7b02e1e89d135b961810914005d (patch)
treec969a8681b7b750d31531ea8309563c554777b3d
parente279622a64a42aedfcc388ff4df45319f76f794d (diff)
downloadgeiser-chez-d903e2c8df9dc7b02e1e89d135b961810914005d.tar.gz
geiser-chez-d903e2c8df9dc7b02e1e89d135b961810914005d.tar.bz2
Add 'geiser-connect-local' to connect over Unix-domain socket.
-rw-r--r--elisp/geiser-repl.el38
1 files changed, 30 insertions, 8 deletions
diff --git a/elisp/geiser-repl.el b/elisp/geiser-repl.el
index 995bb3b..adc8872 100644
--- a/elisp/geiser-repl.el
+++ b/elisp/geiser-repl.el
@@ -327,10 +327,14 @@ module command as a string")
(defun geiser-repl--save-remote-data (address)
(setq geiser-repl--address address)
- (setq header-line-format (and address
- (format "Host: %s Port: %s"
- (geiser-repl--host)
- (geiser-repl--port)))))
+ (setq header-line-format
+ (cond ((consp address)
+ (format "Host: %s Port: %s"
+ (geiser-repl--host)
+ (geiser-repl--port)))
+ ((stringp address)
+ (format "Socket: %s" address))
+ (t nil))))
(defun geiser-repl--output-filter (txt)
(geiser-con--connection-update-debugging geiser-repl--connection txt)
@@ -384,10 +388,18 @@ module command as a string")
(setq comint-prompt-regexp prompt)
(let* ((name (geiser-repl--repl-name impl))
(buff (current-buffer))
- (args (if address (list address)
- `(,(geiser-repl--binary impl)
- nil
- ,@(geiser-repl--arglist impl)))))
+ (args (cond ((consp address) (list address))
+ ((stringp address) '(()))
+ (t `(,(geiser-repl--binary impl)
+ nil
+ ,@(geiser-repl--arglist impl))))))
+ (when (and address (stringp address))
+ ;; Connect over a Unix-domain socket.
+ (make-network-process :name (buffer-name buff)
+ :buffer buff
+ :family 'local
+ :remote address))
+
(condition-case err
(apply 'make-comint-in-buffer `(,name ,buff ,@args))
(error (insert "Unable to start REPL:\n"
@@ -715,6 +727,16 @@ buffer."
(geiser-repl--read-address host port))
(geiser-repl--maybe-remember-scm-buffer buffer)))
+(defun geiser-connect-local (impl &optional socket)
+ "Start a new Geiser REPL connected to a remote Scheme process
+over a Unix-domain socket."
+ (interactive
+ (list (geiser-repl--get-impl "Connect to Scheme implementation: ")))
+ (let ((buffer (current-buffer)))
+ (geiser-repl--start-repl impl
+ (read-file-name "Socket file name: "))
+ (geiser-repl--maybe-remember-scm-buffer buffer)))
+
(make-variable-buffer-local
(defvar geiser-repl--last-scm-buffer nil))