summaryrefslogtreecommitdiff
path: root/elisp/geiser-debug.el
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2012-09-02 20:19:36 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2012-09-02 20:19:36 +0200
commitbc9f7f7db6570a07b991cb3cf3f7aee71523d509 (patch)
tree29a923d95e31d08a5970bff50a621334814af4f7 /elisp/geiser-debug.el
parentef3bebd22708deefcd4c057dcbe678b764a78559 (diff)
downloadgeiser-bc9f7f7db6570a07b991cb3cf3f7aee71523d509.tar.gz
geiser-bc9f7f7db6570a07b991cb3cf3f7aee71523d509.tar.bz2
racket: displaying images also during evaluations
Diffstat (limited to 'elisp/geiser-debug.el')
-rw-r--r--elisp/geiser-debug.el36
1 files changed, 28 insertions, 8 deletions
diff --git a/elisp/geiser-debug.el b/elisp/geiser-debug.el
index d7cf338..e5c13bf 100644
--- a/elisp/geiser-debug.el
+++ b/elisp/geiser-debug.el
@@ -1,6 +1,6 @@
;;; geiser-debug.el -- displaying debug information and evaluation results
-;; Copyright (C) 2009, 2010, 2011 Jose Antonio Ortega Ruiz
+;; Copyright (C) 2009, 2010, 2011, 2012 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
@@ -42,6 +42,15 @@ has no effect."
:group 'geiser-debug
:type 'int)
+
+(geiser-custom--defcustom geiser-debug-auto-display-images-p t
+ "Whether to automatically invoke the external viewer to display
+images when they're evaluated.
+
+See also `geiser-repl-auto-display-images-p'."
+ :group 'geiser-debug
+ :type 'boolean)
+
;;; Debug buffer mode:
@@ -102,13 +111,26 @@ buffer.")
(count-lines (point-min) (point-max)))
geiser-debug-long-sexp-lines)))
-(defun geiser-debug--display-retort (what ret &optional res)
+(defun geiser-debug--insert-res (res)
+ (let ((begin (point)))
+ (insert res)
+ (let ((end (point)))
+ (goto-char begin)
+ (let ((no
+ (geiser-image--replace-images t
+ geiser-debug-auto-display-images-p)))
+ (goto-char end)
+ (newline 2)
+ (and no (> no 0))))))
+
+(defun geiser-debug--display-retort (what ret &optional res auto-p)
(let* ((err (geiser-eval--retort-error ret))
(key (geiser-eval--error-key err))
(output (geiser-eval--retort-output ret))
(impl geiser-impl--implementation)
(module (geiser-eval--get-module))
- (jump nil)
+ (dbg nil)
+ (img nil)
(dir default-directory)
(buffer (current-buffer))
(debug (eq key 'geiser-debugger))
@@ -122,16 +144,14 @@ buffer.")
(unless after
(geiser-debug--display-error impl module nil what)
(newline 2))
- (when (and res (not err))
- (insert res)
- (newline 2))
- (setq jump (geiser-debug--display-error impl module key output))
+ (setq img (when (and res (not err)) (geiser-debug--insert-res res)))
+ (setq dbg (geiser-debug--display-error impl module key output))
(when after
(goto-char (point-max))
(insert "\nExpression evaluated was:\n\n")
(geiser-debug--display-error impl module nil what))
(goto-char (point-min)))
- (when jump (geiser-debug--pop-to-buffer))))
+ (when (or img dbg) (geiser-debug--pop-to-buffer))))
(defsubst geiser-debug--wrap-region (str)
(format "(begin %s)" str))