summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-12-29 00:32:08 +0000
committerjao <jao@gnu.org>2021-12-29 00:32:08 +0000
commite5357e6dcd221ba734423c68dc7a823c034d49d2 (patch)
tree4b7550aa13e039b9b7d3ea75239c9235862f77e6
parentf5e7004bf2f5af381dbf3387108cde210a190733 (diff)
downloadgeiser-e5357e6dcd221ba734423c68dc7a823c034d49d2.tar.gz
geiser-e5357e6dcd221ba734423c68dc7a823c034d49d2.tar.bz2
geiser-eval-wait -> geiser-wait-eval (and make it work)
-rw-r--r--elisp/geiser-connection.el6
-rw-r--r--elisp/geiser-eval.el11
-rw-r--r--elisp/geiser-mode.el4
3 files changed, 15 insertions, 6 deletions
diff --git a/elisp/geiser-connection.el b/elisp/geiser-connection.el
index 87f5f7f..19cbaee 100644
--- a/elisp/geiser-connection.el
+++ b/elisp/geiser-connection.el
@@ -262,12 +262,14 @@
(defun geiser-con--wait (req timeout)
"Wait for the given request REQ to finish, up to TIMEOUT secs, returning its result."
- (let* ((con (geiser-con--request-connection req))
+ (let* ((con (or (geiser-con--request-connection req)
+ (error "Geiser connection not active")))
+ (proc (geiser-con--connection-process con))
(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
+ (condition-case e
(while (and (geiser-con--connection-process con)
(not (geiser-con--connection-completed-p con id)))
(accept-process-output proc step))
diff --git a/elisp/geiser-eval.el b/elisp/geiser-eval.el
index 424d8e2..abf0b5c 100644
--- a/elisp/geiser-eval.el
+++ b/elisp/geiser-eval.el
@@ -1,4 +1,4 @@
-;;; geiser-eval.el -- sending scheme code for evaluation
+;;; geiser-eval.el -- sending scheme code for evaluation -*- lexical-binding: t; -*-
;; Copyright (C) 2009, 2010, 2011, 2012, 2013, 2015, 2021 Jose Antonio Ortega Ruiz
@@ -137,12 +137,19 @@ module-exports, autodoc, callers, callees and generic-methods.")
(defsubst geiser-eval--code-str (code)
(if (stringp code) code (geiser-eval--scheme-str code)))
+(defvar geiser-eval--async-retort nil)
(defsubst geiser-eval--send (code cont &optional buffer)
+ (setq geiser-eval--async-retort nil)
(geiser-con--send-string (geiser-eval--connection)
(geiser-eval--code-str code)
- cont
+ (lambda (s)
+ (setq geiser-eval--async-retort s)
+ (funcall cont s))
buffer))
+(defun geiser-eval--wait (req timeout)
+ (or (geiser-con--wait req timeout) geiser-eval--async-retort))
+
(defvar geiser-eval--sync-retort nil)
(defun geiser-eval--set-sync-retort (s)
(setq geiser-eval--sync-retort (geiser-eval--log s)))
diff --git a/elisp/geiser-mode.el b/elisp/geiser-mode.el
index 06e6655..0e61d90 100644
--- a/elisp/geiser-mode.el
+++ b/elisp/geiser-mode.el
@@ -95,14 +95,14 @@ result is an error msg."
(push-mark)
(goto-char (point-max)))
-(defun geiser-eval-wait (req timeout)
+(defun geiser-wait-eval (req timeout)
"Use REQ, the result of computing an evaluation, to wait for its result.
TIMEOUT is the number of seconds to wait for evaluation
completion. Functions returning a waitable REQ are
`geiser-eval-region' and its derivatives evaluating buffers or
individual sexps."
- (geiser-con--wait req timeout))
+ (geiser-eval--wait req timeout))
(defun geiser-eval-region (start end &optional and-go raw nomsg)
"Eval the current region in the Geiser REPL.