diff options
Diffstat (limited to 'elisp')
-rw-r--r-- | elisp/geiser-connection.el | 15 | ||||
-rw-r--r-- | elisp/geiser-repl.el | 8 |
2 files changed, 18 insertions, 5 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-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)) |