diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2010-12-11 03:03:00 +0100 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2010-12-11 03:03:00 +0100 |
commit | e14bbe5c8c18bcc0f202a4362ff573e6c02034d9 (patch) | |
tree | 9e7f1637777093926e4a217c87c294f17bc93348 | |
parent | 08e2e3fbda3092dea615d024e408d400ae8b2493 (diff) | |
download | geiser-e14bbe5c8c18bcc0f202a4362ff573e6c02034d9.tar.gz geiser-e14bbe5c8c18bcc0f202a4362ff573e6c02034d9.tar.bz2 |
Make the position of long expressions in debug buffer customizable
This is Emacs, after all.
-rw-r--r-- | elisp/geiser-debug.el | 35 | ||||
-rw-r--r-- | elisp/geiser.el | 1 |
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 |