summaryrefslogtreecommitdiff
path: root/elisp
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2010-12-11 03:03:00 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2010-12-11 03:03:00 +0100
commit4a156187b4918e934c30ea2403d8dcb57cfcc720 (patch)
treebe07eaa48be9cba01f85703d1009aa4b3415e0e8 /elisp
parent45dbc624fcb57134c02db510a7f3ba50b09f4d88 (diff)
downloadgeiser-chez-4a156187b4918e934c30ea2403d8dcb57cfcc720.tar.gz
geiser-chez-4a156187b4918e934c30ea2403d8dcb57cfcc720.tar.bz2
Make the position of long expressions in debug buffer customizable
This is Emacs, after all.
Diffstat (limited to 'elisp')
-rw-r--r--elisp/geiser-debug.el35
-rw-r--r--elisp/geiser.el1
2 files changed, 32 insertions, 4 deletions
diff --git a/elisp/geiser-debug.el b/elisp/geiser-debug.el
index 25391db..76865f3 100644
--- a/elisp/geiser-debug.el
+++ b/elisp/geiser-debug.el
@@ -20,6 +20,29 @@
(require 'geiser-base)
+;;; Customization:
+
+(defgroup geiser-debug nil
+ "Debugging and error display options."
+ :group 'geiser)
+
+(geiser-custom--defcustom geiser-debug-always-display-sexp-after-p nil
+ "Whether to always display the sexp whose evaluation caused an
+error after the error message in the debug pop-up. If nil,
+expressions shorter than `geiser-debug-long-sexp-lines` lines are
+show before the error message."
+ :group 'geiser-debug
+ :type 'boolean)
+
+(geiser-custom--defcustom geiser-debug-long-sexp-lines 6
+ "Length of an expression in order to be relegated to the bottom
+of the debug pop-up (after the error message). If
+`geiser-debug-always-display-sexp-after-p` is t, this variable
+has no effect."
+ :group 'geiser-debug
+ :type 'int)
+
+
;;; Debug buffer mode:
(defvar geiser-debug-mode-map
@@ -72,6 +95,13 @@ non-null value.")
"This method is called upon entering the debugger, in the REPL
buffer.")
+(defun geiser-debug--display-after (what)
+ (or geiser-debug-always-display-sexp-after-p
+ (>= (with-temp-buffer
+ (insert what)
+ (count-lines (point-min) (point-max)))
+ geiser-debug-long-sexp-lines)))
+
(defun geiser-debug--display-retort (what ret &optional res)
(let* ((err (geiser-eval--retort-error ret))
(key (geiser-eval--error-key err))
@@ -82,10 +112,7 @@ buffer.")
(dir default-directory)
(buffer (current-buffer))
(debug (eq key 'geiser-debugger))
- (lines (with-temp-buffer
- (insert what)
- (count-lines (point-min) (point-max))))
- (after (> lines 5)))
+ (after (geiser-debug--display-after what)))
(when debug
(switch-to-geiser nil nil buffer)
(geiser-debug--enter-debugger impl))
diff --git a/elisp/geiser.el b/elisp/geiser.el
index d293423..e9f9dbb 100644
--- a/elisp/geiser.el
+++ b/elisp/geiser.el
@@ -76,6 +76,7 @@
geiser-repl
geiser-autodoc
geiser-doc
+ geiser-debug
geiser-faces
geiser-mode
geiser-guile