summaryrefslogtreecommitdiff
path: root/elisp/geiser-connection.el
diff options
context:
space:
mode:
Diffstat (limited to 'elisp/geiser-connection.el')
-rw-r--r--elisp/geiser-connection.el19
1 files changed, 16 insertions, 3 deletions
diff --git a/elisp/geiser-connection.el b/elisp/geiser-connection.el
index b7d312e..68fd412 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; -*-
+;;; geiser-connection.el --- Talking to a scheme process -*- lexical-binding: t; -*-
-;; Copyright (C) 2009-2011, 2013, 2021-2022 Jose Antonio Ortega Ruiz
+;; Copyright (C) 2009-2011, 2013, 2021-2022, 2025 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
@@ -202,7 +202,20 @@
(debugging (geiser-con--has-entered-debugger con answer)))
(condition-case err
(let ((start (string-match "((\\(?:result)?\\|error\\) " answer)))
- (or (and start (car (read-from-string answer start)))
+ (or (and start
+ (progn
+ (let ((extra-output (substring answer 0 start)))
+ (unless (string-blank-p extra-output)
+ (geiser-log--warn "Extra output (before): %s"
+ (string-trim extra-output))))
+ (let* ((ret (read-from-string answer start))
+ (extra-output (substring answer (cdr ret))))
+ (unless (string-blank-p extra-output)
+ ;; Usually, the extra output is just the return value
+ ;; being echoed by the REPL, and not worth noting.
+ (geiser-log--debug "Extra output (after): %s"
+ (string-trim extra-output)))
+ (car ret))))
`((error (key . retort-syntax))
(output . ,answer)
(debug . ,debugging))))