summaryrefslogtreecommitdiff
path: root/elisp/geiser-repl.el
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2010-08-19 07:54:58 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2010-08-19 07:54:58 +0200
commita0784b20c60d4b5d32ec441dc8e56839bfe40f08 (patch)
treee452f16e963c6aba547075a553ce6412bf8fe973 /elisp/geiser-repl.el
parent4c25551e639bb19a60211d30e6c7adb2bc51c59e (diff)
downloadgeiser-guile-a0784b20c60d4b5d32ec441dc8e56839bfe40f08.tar.gz
geiser-guile-a0784b20c60d4b5d32ec441dc8e56839bfe40f08.tar.bz2
Redisplaying the prompt after empty lines on the REPL.
Diffstat (limited to 'elisp/geiser-repl.el')
-rw-r--r--elisp/geiser-repl.el21
1 files changed, 16 insertions, 5 deletions
diff --git a/elisp/geiser-repl.el b/elisp/geiser-repl.el
index a68f6c9..adcf03f 100644
--- a/elisp/geiser-repl.el
+++ b/elisp/geiser-repl.el
@@ -396,11 +396,22 @@ module command as a string")
(geiser-syntax--nesting-level))))
(defun geiser-repl--send-input ()
+ (let* ((proc (get-buffer-process (current-buffer)))
+ (pmark (and proc (process-mark proc)))
+ (intxt (and pmark (buffer-substring pmark (point)))))
+ (when intxt
+ (comint-send-input)
+ (when (string-match "^\\s-*$" intxt)
+ (comint-send-string proc
+ (geiser-eval--scheme-str '((:ge no-values))))
+ (comint-send-string proc "\n")))))
+
+(defun geiser-repl--maybe-send ()
(interactive)
(let ((p (point)))
(end-of-line)
(if (<= (geiser-repl--nesting-level) 0)
- (comint-send-input)
+ (geiser-repl--send-input)
(goto-char p)
(if geiser-repl-auto-indent-p
(geiser-repl--newline-and-indent)
@@ -411,13 +422,13 @@ module command as a string")
\\{geiser-repl-mode-map}"
(scheme-mode-variables)
(set (make-local-variable 'mode-line-process) nil)
- (set (make-local-variable 'comint-use-prompt-regexp) t)
+ (set (make-local-variable 'comint-use-prompt-regexp) nil)
(set (make-local-variable 'comint-prompt-read-only)
geiser-repl-read-only-prompt-p)
(set (make-local-variable 'beginning-of-defun-function)
'geiser-repl--beginning-of-defun)
(set (make-local-variable 'comint-input-ignoredups)
- 'geiser-repl-history-no-dups-p)
+ geiser-repl-history-no-dups-p)
(setq geiser-eval--get-module-function 'geiser-repl--module-function)
(when geiser-repl-autodoc-p (geiser-autodoc-mode 1))
(setq geiser-autodoc--inhibit-function 'geiser-con--is-debugging)
@@ -427,8 +438,8 @@ module command as a string")
(compilation-setup t))
(define-key geiser-repl-mode-map "\C-d" 'delete-char)
-(define-key geiser-repl-mode-map "\C-m" 'geiser-repl--send-input)
-(define-key geiser-repl-mode-map [return] 'geiser-repl--send-input)
+(define-key geiser-repl-mode-map "\C-m" 'geiser-repl--maybe-send)
+(define-key geiser-repl-mode-map [return] 'geiser-repl--maybe-send)
(define-key geiser-repl-mode-map "\C-j" 'geiser-repl--newline-and-indent)
(define-key geiser-repl-mode-map "\C-a" 'geiser-repl--bol)