summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2010-03-28 06:58:44 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2010-03-28 06:58:44 +0200
commit7c6294e8a8775d59e347e29cbbbef96c8d095c11 (patch)
tree331141b7a273ef8f67cac71b269935cd86e55d92
parent1d4c0a0474f8934aa989c1a03e6fd8f63cd9c899 (diff)
downloadgeiser-chez-7c6294e8a8775d59e347e29cbbbef96c8d095c11.tar.gz
geiser-chez-7c6294e8a8775d59e347e29cbbbef96c8d095c11.tar.bz2
More robust REPL input handling.
-rw-r--r--elisp/geiser-repl.el10
1 files changed, 9 insertions, 1 deletions
diff --git a/elisp/geiser-repl.el b/elisp/geiser-repl.el
index 9e66901..b7401b9 100644
--- a/elisp/geiser-repl.el
+++ b/elisp/geiser-repl.el
@@ -336,11 +336,19 @@ module command as a string")
(insert "\n")
(lisp-indent-line)))
+(defun geiser-repl--nesting-level ()
+ (let ((begin (if comint-last-prompt-overlay
+ (overlay-end comint-last-prompt-overlay)
+ (save-excusion (geiser-repl--bol) (point)))))
+ (save-restriction
+ (narrow-to-region begin (point-max))
+ (geiser-syntax--nesting-level))))
+
(defun geiser-repl--send-input ()
(interactive)
(let ((p (point)))
(end-of-line)
- (if (zerop (geiser-syntax--nesting-level))
+ (if (<= (geiser-repl--nesting-level) 0)
(comint-send-input)
(goto-char p)
(if geiser-repl-auto-indent-p