summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--elisp/geiser-connection.el5
-rw-r--r--elisp/geiser-eval.el8
-rw-r--r--elisp/geiser-repl.el25
3 files changed, 24 insertions, 14 deletions
diff --git a/elisp/geiser-connection.el b/elisp/geiser-connection.el
index 2d32d50..5f1e782 100644
--- a/elisp/geiser-connection.el
+++ b/elisp/geiser-connection.el
@@ -111,6 +111,9 @@
(cons :count 0)
(cons :completed (make-hash-table :weakness 'value))))
+(defsubst geiser-con--pending-requests-p (c)
+ (not (tq-queue-empty (geiser-con--connection-tq c))))
+
(defsubst geiser-con--connection-process (c)
(tq-process (cdr (assq :tq c))))
@@ -274,7 +277,7 @@
(interrupt-process proc))))
(defun geiser-con--wait (req timeout)
- "Wait up to TIMEOUT msecs for request REQ to finish, returning its result."
+ "Wait up to TIMEOUT msecs for request REQ to finish."
(let* ((con (or (geiser-con--request-connection req)
(error "Geiser connection not active")))
(proc (geiser-con--connection-process con))
diff --git a/elisp/geiser-eval.el b/elisp/geiser-eval.el
index 8f58c25..069dfb9 100644
--- a/elisp/geiser-eval.el
+++ b/elisp/geiser-eval.el
@@ -1,6 +1,6 @@
;;; geiser-eval.el --- Sending scheme code for evaluation -*- lexical-binding: t; -*-
-;; Copyright (C) 2009, 2010, 2011, 2012, 2013, 2015, 2021, 2023 Jose Antonio Ortega Ruiz
+;; Copyright (C) 2009-2013, 2015, 2021, 2023, 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
@@ -150,7 +150,8 @@ module-exports, autodoc, callers, callees and generic-methods.")
(geiser-con--send-string (geiser-eval--connection)
(geiser-eval--code-str code)
(lambda (s)
- (setq geiser-eval--async-retort (geiser-eval--log s))
+ (setq geiser-eval--async-retort
+ (geiser-eval--log s))
(funcall cont s))
buffer))
@@ -167,6 +168,9 @@ module-exports, autodoc, callers, callees and generic-methods.")
buffer)
sync-retort))
+(defun geiser-eval--pending-requests-p ()
+ (geiser-con--pending-requests-p (geiser-eval--connection)))
+
(defun geiser-eval-interrupt ()
"Interrupt on-going evaluation, if any."
(interactive)
diff --git a/elisp/geiser-repl.el b/elisp/geiser-repl.el
index 54cf6d8..84ff8ce 100644
--- a/elisp/geiser-repl.el
+++ b/elisp/geiser-repl.el
@@ -1,6 +1,6 @@
;;; geiser-repl.el --- Geiser's REPL -*- lexical-binding: t; -*-
-;; Copyright (C) 2009-2013, 2015-2016, 2018-2023 Jose Antonio Ortega Ruiz
+;; Copyright (C) 2009-2013, 2015-2016, 2018-2023, 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
@@ -490,8 +490,8 @@ Returns the classification based on the first line of output.
Only used when `geiser-repl-classify-output-p' is non-nil."
(save-excursion
(goto-char start)
- (let ((first-line (buffer-substring-no-properties
- start
+ (let ((first-line (buffer-substring-no-properties
+ start
(min end (line-end-position)))))
(cond
((string-match-p "raise-exception" first-line) :error)
@@ -743,20 +743,23 @@ to standard output face."
(defun geiser-repl--prepare-send ()
(geiser-image--clean-cache)
(geiser-autodoc--inhibit-autodoc)
+ (geiser-eval--wait )
(geiser-con--connection-deactivate geiser-repl--connection))
(defun geiser-repl--send (cmd &optional save-history)
"Send CMD input string to the current REPL buffer.
If SAVE-HISTORY is non-nil, save CMD in the REPL history."
(when (and cmd (eq major-mode 'geiser-repl-mode))
- (geiser-repl--prepare-send)
- (goto-char (point-max))
- (comint-kill-input)
- (insert cmd)
- (let ((comint-input-filter (if save-history
- comint-input-filter
- 'ignore)))
- (comint-send-input nil t))))
+ (if (geiser-eval--pending-requests-p)
+ (message "Waiting for scheme process...")
+ (geiser-repl--prepare-send)
+ (goto-char (point-max))
+ (comint-kill-input)
+ (insert cmd)
+ (let ((comint-input-filter (if save-history
+ comint-input-filter
+ 'ignore)))
+ (comint-send-input nil t)))))
(defun geiser-repl-interrupt ()
(interactive)