summaryrefslogtreecommitdiff
path: root/elisp
diff options
context:
space:
mode:
Diffstat (limited to 'elisp')
-rw-r--r--elisp/geiser-connection.el24
-rw-r--r--elisp/geiser-repl.el1
2 files changed, 16 insertions, 9 deletions
diff --git a/elisp/geiser-connection.el b/elisp/geiser-connection.el
index f462b4c..b59d109 100644
--- a/elisp/geiser-connection.el
+++ b/elisp/geiser-connection.el
@@ -1,6 +1,6 @@
;;; geiser-connection.el --- Talking to a scheme process -*- lexical-binding: t; -*-
-;; Copyright (C) 2009-2011, 2013, 2021-2022, 2025 Jose Antonio Ortega Ruiz
+;; Copyright (C) 2009-2011, 2013, 2021-2022, 2025, 2026 Jose Antonio Ortega Ruiz
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the Modified BSD License. You should
@@ -39,7 +39,7 @@
;;; Request datatype:
(defun geiser-con--make-request (con str cont &optional sender-buffer)
- (list (cons :id (geiser-con--connection-inc-count con))
+ (list (cons :id (and (car con) (geiser-con--connection-inc-count con)))
(cons :string str)
(cons :continuation cont)
(cons :buffer (or sender-buffer (current-buffer)))
@@ -263,7 +263,8 @@
(defun geiser-con--send-string (con str cont &optional sbuf)
(let ((req (geiser-con--make-request con str cont sbuf)))
- (geiser-con--connection-add-request con req)
+ (when (geiser-con--request-id req)
+ (geiser-con--connection-add-request con req))
req))
(defvar geiser-connection-timeout 30000
@@ -283,12 +284,17 @@
(id (geiser-con--request-id req))
(timeout (/ (or timeout geiser-connection-timeout) 1000.0))
(step (/ timeout 10)))
- (with-timeout (timeout (geiser-con--request-deactivate req))
- (condition-case nil
- (while (and (geiser-con--connection-process con)
- (not (geiser-con--connection-completed-p con id)))
- (accept-process-output proc step))
- (error (geiser-con--request-deactivate req))))))
+ (if (null (geiser-con--request-id req)) ;; request sent with paused conn
+ (when-let* ((cont (geiser-con--request-continuation req)))
+ (with-current-buffer (or (geiser-con--request-buffer req)
+ (current-buffer))
+ (funcall cont '((result)))))
+ (with-timeout (timeout (geiser-con--request-deactivate req))
+ (condition-case nil
+ (while (and (geiser-con--connection-process con)
+ (not (geiser-con--connection-completed-p con id)))
+ (accept-process-output proc step))
+ (error (geiser-con--request-deactivate req)))))))
(defun geiser-con--send-string/wait (con str cont &optional timeout sbuf)
(when (and (stringp str) (not (string-blank-p str)))
diff --git a/elisp/geiser-repl.el b/elisp/geiser-repl.el
index 8594462..ce638cb 100644
--- a/elisp/geiser-repl.el
+++ b/elisp/geiser-repl.el
@@ -592,6 +592,7 @@ to standard output face."
geiser-repl-auto-display-images-p)
(when (string-match-p (geiser-con--connection-prompt geiser-repl--connection)
txt)
+ (geiser-con--connection-activate geiser-repl--connection)
(geiser-autodoc--disinhibit-autodoc)))
(defun geiser-repl--check-version (impl)