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
commitc1bce4b44f9cf6eff11652d35abb95a37381a166 (patch)
tree4c1ec968645313f6e7a4a8da025e640802b34e14
parentf2143159ccba5686ee110c1b56be5484db3576bf (diff)
downloadgeiser-c1bce4b44f9cf6eff11652d35abb95a37381a166.tar.gz
geiser-c1bce4b44f9cf6eff11652d35abb95a37381a166.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))