summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-11-20 02:41:43 +0000
committerjao <jao@gnu.org>2021-11-20 02:41:43 +0000
commit68e0991c96b1e5bc9a1d748a05a96127c6204987 (patch)
tree1c2cd9069aa1df6186fa7413da7041b40727847b
parentd5cdad7f3eb44cec434610846cf78f2ad272089b (diff)
downloadgeiser-68e0991c96b1e5bc9a1d748a05a96127c6204987.tar.gz
geiser-68e0991c96b1e5bc9a1d748a05a96127c6204987.tar.bz2
Fix: allow implementations to tell us if they entered their debugger
We were always displaying the debug buffer, regardless, which is not what we want: upon entering a debugger, we switch to the repl, and all the needed info is already there.
-rw-r--r--elisp/geiser-debug.el55
1 files changed, 28 insertions, 27 deletions
diff --git a/elisp/geiser-debug.el b/elisp/geiser-debug.el
index fe1c85d..c2194d2 100644
--- a/elisp/geiser-debug.el
+++ b/elisp/geiser-debug.el
@@ -163,34 +163,35 @@ buffer.")
(dir default-directory)
(buffer (current-buffer))
(debug (eq key 'geiser-debugger))
+ (debug-entered (when debug
+ (switch-to-geiser nil nil buffer)
+ (geiser-debug--enter-debugger impl)))
(after (geiser-debug--display-after what)))
- (when debug
- (switch-to-geiser nil nil buffer)
- (geiser-debug--enter-debugger impl))
- (geiser-debug--with-buffer
- (erase-buffer)
- (when dir (setq default-directory dir))
- (unless after (insert what "\n\n"))
- (setq img (when (and res (not err)) (geiser-debug--insert-res res)))
- (when (or err key output)
- (or (geiser-debug--display-error impl module key output)
- (insert "\n" (if key (format "%s\n" key) "") output "\n")))
- (when after
- (goto-char (point-max))
- (insert "\nExpression evaluated was:\n\n")
- (insert what "\n"))
- (cl-case geiser-debug-treat-ansi-colors
- (colors (ansi-color-apply-on-region (point-min) (point-max)))
- (remove (ansi-color-filter-region (point-min) (point-max))))
- (goto-char (point-min)))
- (when (or img err output)
- (when (or geiser-debug-jump-to-debug-p geiser-debug-show-debug-p)
- (if geiser-debug-jump-to-debug-p
- (geiser-debug--pop-to-buffer)
- (display-buffer (geiser-debug--buffer))))
- (when err
- (ignore-errors (next-error))
- (message "=> %s" output)))))
+ (unless debug-entered
+ (geiser-debug--with-buffer
+ (erase-buffer)
+ (when dir (setq default-directory dir))
+ (unless after (insert what "\n\n"))
+ (setq img (when (and res (not err)) (geiser-debug--insert-res res)))
+ (when (or err key output)
+ (or (geiser-debug--display-error impl module key output)
+ (insert "\n" (if key (format "%s\n" key) "") output "\n")))
+ (when after
+ (goto-char (point-max))
+ (insert "\nExpression evaluated was:\n\n")
+ (insert what "\n"))
+ (cl-case geiser-debug-treat-ansi-colors
+ (colors (ansi-color-apply-on-region (point-min) (point-max)))
+ (remove (ansi-color-filter-region (point-min) (point-max))))
+ (goto-char (point-min)))
+ (when (or img err output)
+ (when (or geiser-debug-jump-to-debug-p geiser-debug-show-debug-p)
+ (if geiser-debug-jump-to-debug-p
+ (geiser-debug--pop-to-buffer)
+ (display-buffer (geiser-debug--buffer))))
+ (when err
+ (ignore-errors (next-error))
+ (message "=> %s" output))))))
(defsubst geiser-debug--wrap-region (str)
(format "(begin %s\n)" str))