summaryrefslogtreecommitdiff
path: root/elisp
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2010-11-12 22:55:40 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2010-11-12 23:21:02 +0100
commitc8dcc2472b230bf1c0b17b78369c516fe802aea5 (patch)
treedd3f6ea6938c8eb420165b306a37745833f689fd /elisp
parent9d26fb34c24677e1db45a96ec88cca94ea1c4542 (diff)
downloadgeiser-guile-c8dcc2472b230bf1c0b17b78369c516fe802aea5.tar.gz
geiser-guile-c8dcc2472b230bf1c0b17b78369c516fe802aea5.tar.bz2
Make do with a single connection
Separate connections for the REPL and Geiser commands was kind of neat, but it had the problem of synchronising the current namespace for both connections. A quick fix would have been to ask the scheme for the current namespace for every Geiser command in the REPL, but that, besides clunky, would add potentially prohibitive overhead for (real) remote connections. As it happens, using a single connection turned out to be not that difficult and relatively clean code-wise. We could even turn back to not use inferior schemes, and the net result of this refactoring would be the replacement of comint-redirect (which wasn't able to match the whole EOT token if it didn't arrive all at once) by transaction queues (which also makes geiser-connection's implementation cleaner). But using an inferior scheme has a dog-food value, and allows external processes to connect to the scheme being used by Geiser without further ado, which could be useful for debugging (although this is a lame excuse: nothing prevents you from starting a REPL server from emacs if you want). We'll see.
Diffstat (limited to 'elisp')
-rw-r--r--elisp/geiser-guile.el20
1 files changed, 12 insertions, 8 deletions
diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el
index 3d42d24..687bf34 100644
--- a/elisp/geiser-guile.el
+++ b/elisp/geiser-guile.el
@@ -174,13 +174,11 @@ This function uses `geiser-guile-init-file' if it exists."
;;; Error display
(defun geiser-guile--enter-debugger ()
- (let ((bt-cmd (format ",%s\n"
+ (let ((bt-cmd (format ",geiser-newline\n,error-message\n,%s\n"
(if geiser-guile-debug-show-bt-p "bt" "fr"))))
(compilation-forget-errors)
(goto-char (point-max))
- (geiser-repl--swap)
- (comint-send-string nil ",geiser-newline\n")
- (comint-send-string nil ",error-message\n")
+ (geiser-repl--prepare-send)
(comint-send-string nil bt-cmd)
(when geiser-guile-show-debug-help-p
(message "Debug REPL. Enter ,q to quit, ,h for help."))
@@ -266,10 +264,16 @@ it spawn a server thread."
(when remote
(geiser-repl--send-silent (geiser-guile--load-path-string))
(geiser-repl--send-silent ",use (geiser emacs)"))
- (geiser-guile-update-warning-level))
-
-(defconst geiser-guile--init-server-command
- ",use (geiser emacs)\n,geiser-start-server")
+ (geiser-guile-update-warning-level)
+ )
+
+(defun geiser-guile--init-server-command ()
+ (comint-kill-region (point-min) (point-max))
+ (setq comint-prompt-regexp "inferior-guile> ")
+ (comint-send-string nil ",option prompt \"inferior-guile> \"\n")
+ (comint-send-string nil ",use (geiser emacs)\n")
+ (geiser-inf--wait-for-prompt 10000)
+ ",geiser-start-server")
;;; Implementation definition: