summaryrefslogtreecommitdiff
path: root/elisp/geiser-repl.el
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2010-10-31 19:47:40 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2010-10-31 19:47:40 +0100
commit1649bcb91781d19be3494e682a0d6e133ca30a87 (patch)
tree53d8476acfb9144c82ee7f89035f0db92af27275 /elisp/geiser-repl.el
parent237bad79cdeadd26cdfb446d8059c5ac6ca08415 (diff)
downloadgeiser-1649bcb91781d19be3494e682a0d6e133ca30a87.tar.gz
geiser-1649bcb91781d19be3494e682a0d6e133ca30a87.tar.bz2
REPL: RET on an error jumps to it
Diffstat (limited to 'elisp/geiser-repl.el')
-rw-r--r--elisp/geiser-repl.el34
1 files changed, 21 insertions, 13 deletions
diff --git a/elisp/geiser-repl.el b/elisp/geiser-repl.el
index 900ba16..c5d6543 100644
--- a/elisp/geiser-repl.el
+++ b/elisp/geiser-repl.el
@@ -463,13 +463,20 @@ With a prefix argument, force exit by killing the scheme process."
(insert "\n")
(lisp-indent-line)))
+(defun geiser-repl--last-prompt-end ()
+ (if comint-last-prompt-overlay
+ (overlay-end comint-last-prompt-overlay)
+ (save-excursion (geiser-repl--bol) (point))))
+
+(defun geiser-repl--last-prompt-start ()
+ (if comint-last-prompt-overlay
+ (overlay-start comint-last-prompt-overlay)
+ (save-excursion (geiser-repl--bol) (point))))
+
(defun geiser-repl--nesting-level ()
- (let ((begin (if comint-last-prompt-overlay
- (overlay-end comint-last-prompt-overlay)
- (save-excursion (geiser-repl--bol) (point)))))
- (save-restriction
- (narrow-to-region begin (point-max))
- (geiser-syntax--nesting-level))))
+ (save-restriction
+ (narrow-to-region (geiser-repl--last-prompt-end) (point-max))
+ (geiser-syntax--nesting-level)))
(defun geiser-repl--send-input ()
(let* ((proc (get-buffer-process (current-buffer)))
@@ -487,13 +494,14 @@ With a prefix argument, force exit by killing the scheme process."
(defun geiser-repl--maybe-send ()
(interactive)
(let ((p (point)))
- (end-of-line)
- (if (<= (geiser-repl--nesting-level) 0)
- (geiser-repl--send-input)
- (goto-char p)
- (if geiser-repl-auto-indent-p
- (geiser-repl--newline-and-indent)
- (insert "\n")))))
+ (cond ((< p (geiser-repl--last-prompt-start))
+ (ignore-errors (compile-goto-error)))
+ ((progn (end-of-line) (<= (geiser-repl--nesting-level) 0))
+ (geiser-repl--send-input))
+ (t (goto-char p)
+ (if geiser-repl-auto-indent-p
+ (geiser-repl--newline-and-indent)
+ (insert "\n"))))))
(define-derived-mode geiser-repl-mode comint-mode "REPL"
"Major mode for interacting with an inferior scheme repl process.