From 7c6294e8a8775d59e347e29cbbbef96c8d095c11 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sun, 28 Mar 2010 06:58:44 +0200 Subject: More robust REPL input handling. --- elisp/geiser-repl.el | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'elisp') 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 -- cgit v1.2.3