summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2010-10-31 20:04:45 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2010-10-31 20:04:45 +0100
commit03e7271ffdc381e69aae401666df56767799e836 (patch)
treeaf6aa75ae66470a206a16ee0df3a8db2e112fd50
parentffd0a91a136909c4ed481184073e868ae886e230 (diff)
parent2603c39ff801aa860420d65b589dfe831240d05d (diff)
downloadgeiser-chez-03e7271ffdc381e69aae401666df56767799e836.tar.gz
geiser-chez-03e7271ffdc381e69aae401666df56767799e836.tar.bz2
Merge branch 'master' into guile-meta
-rw-r--r--elisp/geiser-repl.el44
1 files changed, 29 insertions, 15 deletions
diff --git a/elisp/geiser-repl.el b/elisp/geiser-repl.el
index 900ba16..57111f4 100644
--- a/elisp/geiser-repl.el
+++ b/elisp/geiser-repl.el
@@ -12,6 +12,7 @@
(require 'geiser-company)
(require 'geiser-autodoc)
(require 'geiser-edit)
+(require 'geiser-completion)
(require 'geiser-impl)
(require 'geiser-eval)
(require 'geiser-connection)
@@ -463,13 +464,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 +495,20 @@ 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"))))))
+
+(defun geiser-repl--tab (n)
+ (interactive "p")
+ (if (> (point) (geiser-repl--last-prompt-end))
+ (geiser-completion--maybe-complete)
+ (compilation-next-error n)))
(define-derived-mode geiser-repl-mode comint-mode "REPL"
"Major mode for interacting with an inferior scheme repl process.
@@ -512,8 +527,6 @@ With a prefix argument, force exit by killing the scheme process."
(geiser--save-msg (geiser-autodoc-mode 1)))
(setq geiser-autodoc--inhibit-function 'geiser-con--is-debugging)
(geiser-company--setup geiser-repl-company-p)
- (setq geiser-smart-tab-mode-string "")
- (geiser-smart-tab-mode t)
;; enabling compilation-shell-minor-mode without the annoying highlighter
(compilation-setup t))
@@ -521,6 +534,7 @@ With a prefix argument, force exit by killing the scheme process."
(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 (kbd "TAB") 'geiser-repl--tab)
(define-key geiser-repl-mode-map "\C-a" 'geiser-repl--bol)
(define-key geiser-repl-mode-map (kbd "<home>") 'geiser-repl--bol)