From 05ed9a6c1e422761692ca77be3c703f941dc5d5a Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Thu, 19 Aug 2010 07:54:58 +0200 Subject: Redisplaying the prompt after empty lines on the REPL. --- elisp/geiser-repl.el | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'elisp') 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) -- cgit v1.2.3