diff options
Diffstat (limited to 'elisp')
-rw-r--r-- | elisp/geiser-connection.el | 15 | ||||
-rw-r--r-- | elisp/geiser-guile.el | 7 | ||||
-rw-r--r-- | elisp/geiser-repl.el | 8 |
3 files changed, 22 insertions, 8 deletions
diff --git a/elisp/geiser-connection.el b/elisp/geiser-connection.el index 324532b..76ba24a 100644 --- a/elisp/geiser-connection.el +++ b/elisp/geiser-connection.el @@ -73,11 +73,14 @@ (defun geiser-con--combined-prompt (prompt debug) (format "\\(%s%s\\)" prompt (if debug (format "\\|%s" debug) ""))) +(defun geiser-con--connection-eot-re (prompt debug) + (geiser-con--combined-prompt (format "\0\n%s" prompt) + (and debug (format "\n%s" debug)))) + (defun geiser-con--make-connection (proc prompt debug-prompt) (list :geiser-connection (cons :tq (tq-create proc)) - (cons :eot (format "\0\n%s" - (geiser-con--combined-prompt prompt debug-prompt))) + (cons :eot (geiser-con--connection-eot-re prompt debug-prompt)) (cons :prompt prompt) (cons :debug-prompt debug-prompt) (cons :count 0) @@ -86,14 +89,13 @@ (defun geiser-con--connection-swap-proc (con proc) (let* ((this-proc (geiser-con--connection-process con)) (this-filter (process-filter this-proc)) - (this-buffer (process-buffer this-proc)) (filter (process-filter proc)) (buffer (process-buffer proc)) (tq (geiser-con--connection-tq con))) (set-process-filter this-proc filter) (set-process-buffer this-proc buffer) (set-process-filter proc this-filter) - (set-process-buffer proc this-buffer) + (set-process-buffer proc nil) (setcdr tq (cons proc (tq-buffer tq))) this-proc)) @@ -187,8 +189,11 @@ (geiser-con--connection-completed con req))) (defun geiser-con--connection-add-request (c r) + (geiser-log--info "REQUEST: <%s>: %s" + (geiser-con--request-id r) + (geiser-con--request-string r)) (tq-enqueue (geiser-con--connection-tq c) - (geiser-con--request-string r) + (concat (geiser-con--request-string r) "\n") (geiser-con--connection-eot c) r 'geiser-con--process-completed-request diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index afb7992..3d42d24 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -108,7 +108,7 @@ This function uses `geiser-guile-init-file' if it exists." ;;(defconst geiser-guile--prompt-regexp "^[^() \n]+@([^)]*?)> ") (defconst geiser-guile--prompt-regexp "[^@()]+@([^)]*?)> ") (defconst geiser-guile--debugger-prompt-regexp - "^[^@()]+@([^)]*?) \\[[0-9]+\\]> ") + "[^@()]+@([^)]*?) \\[[0-9]+\\]> ") ;;; Evaluation support: @@ -117,7 +117,7 @@ This function uses `geiser-guile-init-file' if it exists." (defun geiser-guile--geiser-procedure (proc &rest args) (case proc - ((eval compile) (format ",geiser-eval %s %s%s\n" + ((eval compile) (format ",geiser-eval %s %s%s" (or (car args) "#f") (geiser-guile--linearize-args (cdr args)) (if (cddr args) "" " ()"))) @@ -178,6 +178,7 @@ This function uses `geiser-guile-init-file' if it exists." (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") (comint-send-string nil bt-cmd) @@ -226,7 +227,7 @@ This function uses `geiser-guile-init-file' if it exists." (defun geiser-guile--resolve-file-x () (let ((f (geiser-guile--resolve-file (match-string-no-properties 1)))) - (and f (list f)))) + (and (stringp f) (list f)))) ;;; REPL startup diff --git a/elisp/geiser-repl.el b/elisp/geiser-repl.el index d99ace0..f73bd90 100644 --- a/elisp/geiser-repl.el +++ b/elisp/geiser-repl.el @@ -276,6 +276,14 @@ module command as a string") (setq geiser-eval--default-connection-function 'geiser-repl--connection) +(defun geiser-repl--swap () + (let ((p (get-buffer-process (current-buffer)))) + (when (and p geiser-repl--connection) + (let ((p (geiser-con--connection-swap-proc geiser-repl--connection + p))) + (goto-char (point-max)) + (set-marker (process-mark p) (point)))))) + (defun geiser-repl--send (cmd) (when (and cmd (eq major-mode 'geiser-repl-mode)) (goto-char (point-max)) |