diff options
author | Eliza Velasquez <4576666+elizagamedev@users.noreply.github.com> | 2024-05-21 15:59:55 -0700 |
---|---|---|
committer | Eliza Velasquez <4576666+elizagamedev@users.noreply.github.com> | 2024-05-21 15:59:55 -0700 |
commit | 4f2b1eb3e28341c3eb9bba0488bc4b553d305071 (patch) | |
tree | a0094195c5ea62a1d023c44ba8d2fe37c9b8dc5d | |
parent | 4e64934bd2ae7c6f0e4acb9f2ed017844c187223 (diff) | |
download | geiser-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.
-rw-r--r-- | elisp/geiser-connection.el | 17 |
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)))) |