summaryrefslogtreecommitdiff
path: root/elisp
diff options
context:
space:
mode:
authorEliza Velasquez <4576666+elizagamedev@users.noreply.github.com>2024-05-21 15:59:55 -0700
committerEliza Velasquez <4576666+elizagamedev@users.noreply.github.com>2024-05-21 15:59:55 -0700
commit4f2b1eb3e28341c3eb9bba0488bc4b553d305071 (patch)
treea0094195c5ea62a1d023c44ba8d2fe37c9b8dc5d /elisp
parent4e64934bd2ae7c6f0e4acb9f2ed017844c187223 (diff)
downloadgeiser-4f2b1eb3e28341c3eb9bba0488bc4b553d305071.tar.gz
geiser-4f2b1eb3e28341c3eb9bba0488bc4b553d305071.tar.bz2
Log more unexpected output from REPL
When a transmission queue request successfully completes and the REPL prints a return value, it skips over unexpected and potentially meaningful output. Given that geiser:eval captures standard out, this output may contain warning or error messages. This PR captures and logs this extra output instead of discarding it.
Diffstat (limited to 'elisp')
-rw-r--r--elisp/geiser-connection.el17
1 files changed, 15 insertions, 2 deletions
diff --git a/elisp/geiser-connection.el b/elisp/geiser-connection.el
index b7d312e..5aa05a9 100644
--- a/elisp/geiser-connection.el
+++ b/elisp/geiser-connection.el
@@ -87,7 +87,7 @@
(unwind-protect
(funcall (tq-queue-head-fn tq)
(tq-queue-head-closure tq)
- (buffer-substring (point-min) (point)))
+ (buffer-substring (point-min) (match-beginning 0)))
(delete-region (point-min) (point-max))
(tq-queue-pop tq)))))))
@@ -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)))
+ (let ((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))))