summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2010-11-11 03:31:15 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2010-11-11 03:31:15 +0100
commitd773c05503659047f35878bd745568ce04078148 (patch)
tree591e404cda40dea7142189b7c86212502cd87cae
parentdfc900c0e2f59edfb06bbdabfc4bcde172d6ced9 (diff)
downloadgeiser-chez-d773c05503659047f35878bd745568ce04078148.tar.gz
geiser-chez-d773c05503659047f35878bd745568ce04078148.tar.bz2
Elisp support for inferior schemes
-rw-r--r--elisp/geiser-guile.el1
-rw-r--r--elisp/geiser-inf.el2
-rw-r--r--elisp/geiser-racket.el3
-rw-r--r--elisp/geiser-repl.el37
4 files changed, 27 insertions, 16 deletions
diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el
index 1c39f14..d58821b 100644
--- a/elisp/geiser-guile.el
+++ b/elisp/geiser-guile.el
@@ -247,7 +247,6 @@ it spawn a server thread."
(set (make-local-variable 'compilation-error-regexp-alist)
`((,geiser-guile--path-rx geiser-guile--resolve-file-x)
("^ +\\([0-9]+\\):\\([0-9]+\\)" nil 1 2)))
- (setq geiser-con--debugging-inhibits-eval nil)
(compilation-setup t)
(font-lock-add-keywords nil
`((,geiser-guile--path-rx 1
diff --git a/elisp/geiser-inf.el b/elisp/geiser-inf.el
index 4b7020e..efe7e34 100644
--- a/elisp/geiser-inf.el
+++ b/elisp/geiser-inf.el
@@ -72,7 +72,7 @@ list of the form (server PORT).")
(error (error "Unable to start REPL: %s" (error-message-string err))))
(geiser-inf--wait-for-prompt 10000)
(cons (current-buffer)
- (comint-redirect-results-list (geiser-inf--server-init-cmd impl)
+ (comint-redirect-results-list (geiser-inf--init-server-cmd impl)
"(server-port \\([0-9]\\)+)"
1)))))
diff --git a/elisp/geiser-racket.el b/elisp/geiser-racket.el
index c680907..4152a22 100644
--- a/elisp/geiser-racket.el
+++ b/elisp/geiser-racket.el
@@ -84,6 +84,8 @@ This function uses `geiser-racket-init-file' if it exists."
(defconst geiser-racket--prompt-regexp "^=?\\(mzscheme\\|racket\\)@[^ ]*?> ")
+(defconst geiser-racket--init-server-cmd ",start-geiser")
+
;;; Evaluation support:
@@ -241,6 +243,7 @@ using start-geiser, a procedure in the geiser/server module."
(unsupported-procedures '(callers callees generic-methods))
(binary geiser-racket--binary)
(arglist geiser-racket--parameters)
+ (init-server-cmd geiser-racket--init-server-cmd)
(startup)
(prompt-regexp geiser-racket--prompt-regexp)
(marshall-procedure geiser-racket--geiser-procedure)
diff --git a/elisp/geiser-repl.el b/elisp/geiser-repl.el
index fcf7278..dceec78 100644
--- a/elisp/geiser-repl.el
+++ b/elisp/geiser-repl.el
@@ -193,6 +193,11 @@ module command as a string")
(and (null (cdr geiser-active-implementations))
(car geiser-active-implementations)))
+(defun geiser-repl--get-impl (prompt)
+ (or (geiser-repl--only-impl-p)
+ (and (eq major-mode 'geiser-repl-mode) geiser-impl--implementation)
+ (geiser-repl--read-impl prompt)))
+
;;; REPL connections
@@ -203,7 +208,10 @@ module command as a string")
(defvar geiser-repl--connection nil))
(make-variable-buffer-local
- (defvar geiser-remote-p nil))
+ (defvar geiser-repl--remote-p nil))
+
+(make-variable-buffer-local
+ (defvar geiser-repl--inferior-buffer nil))
(defsubst geiser-repl--host () (car geiser-repl--address))
(defsubst geiser-repl--port () (cdr geiser-repl--address))
@@ -218,7 +226,7 @@ module command as a string")
(defun geiser-repl--save-remote-data (address remote)
(setq geiser-repl--address address)
- (setq geiser-remote-p remote)
+ (setq geiser-repl--remote-p remote)
(setq header-line-format (and remote
(format "Host: %s Port: %s"
(geiser-repl--host)
@@ -277,12 +285,19 @@ module command as a string")
(defsubst geiser-repl--history-file ()
(format "%s.%s" geiser-repl-history-filename geiser-impl--implementation))
+(defun geiser-repl--quit-inf ()
+ (when (buffer-live-p geiser-repl--inferior-buffer)
+ (with-current-buffer geiser-repl--inferior-buffer
+ (let ((geiser-repl-query-on-exit-p nil)) (geiser-repl-exit))
+ (kill-buffer))))
+
(defun geiser-repl--on-quit ()
(comint-write-input-ring)
(let ((cb (current-buffer))
(impl geiser-impl--implementation)
(comint-prompt-read-only nil))
(ignore-errors (geiser-con--connection-close geiser-repl--connection))
+ (geiser-repl--quit-inf)
(setq geiser-repl--repls (remove cb geiser-repl--repls))
(dolist (buffer (buffer-list))
(when (buffer-live-p buffer)
@@ -483,24 +498,18 @@ buffer."
(defun run-geiser (impl)
"Start a new Geiser REPL."
(interactive
- (list (or (geiser-repl--only-impl-p)
- (and (eq major-mode 'geiser-repl-mode)
- geiser-impl--implementation)
- (geiser-repl--read-impl
- "Start Geiser for scheme implementation: "))))
- (geiser-repl--start-repl impl nil nil nil))
+ (list (geiser-repl--get-impl "Start Geiser for scheme implementation: ")))
+ (let ((b/p (geiser-inf--run-scheme impl)))
+ (setq geiser-repl--inferior-buffer (car b/p))
+ (geiser-repl--start-repl impl "localhost" (cdr b/p) nil)))
(defalias 'geiser 'run-geiser)
(defun geiser-connect (impl &optional host port)
"Start a new Geiser REPL connected to a remote Scheme process."
(interactive
- (list (or (geiser-repl--only-impl-p)
- (and (eq major-mode 'geiser-repl-mode)
- geiser-impl--implementation)
- (geiser-repl--read-impl
- "Scheme implementation: "))))
- (geiser-repl--start-repl impl t host port t))
+ (list (geiser-repl--get-impl "Connect to Scheme implementation: ")))
+ (geiser-repl--start-repl impl host port t))
(make-variable-buffer-local
(defvar geiser-repl--last-scm-buffer nil))