diff options
author | Darren Hoo <darren.hoo@gmail.com> | 2013-05-21 15:01:11 +0800 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2013-05-21 18:48:41 +0200 |
commit | 20e0501f9cc82c6938e465303a29b69ef1636628 (patch) | |
tree | ccb9ca316d32461dc6f364bff82390f481686bbe /elisp | |
parent | 4d8158a0ea1e3019935149431ff93385e72af576 (diff) | |
download | geiser-chez-20e0501f9cc82c6938e465303a29b69ef1636628.tar.gz geiser-chez-20e0501f9cc82c6938e465303a29b69ef1636628.tar.bz2 |
yank input if point is over history input
Diffstat (limited to 'elisp')
-rw-r--r-- | elisp/geiser-repl.el | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/elisp/geiser-repl.el b/elisp/geiser-repl.el index 1d1b317..fca1c74 100644 --- a/elisp/geiser-repl.el +++ b/elisp/geiser-repl.el @@ -525,15 +525,28 @@ module command as a string") (narrow-to-region (geiser-repl--last-prompt-end) (point-max)) (geiser-syntax--nesting-level))) +(defun geiser-repl--mark-input-bounds (beg end) + (add-text-properties beg end '(field t))) + +(defun geiser-repl--is-history-input () + (get-text-property (if (eolp) (save-excursion (comint-bol)) (point)) 'field)) + +(defun geiser-repl--grab-input () + (let ((pos (comint-bol))) + (goto-char (point-max)) + (insert (field-string-no-properties pos)))) + (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))))) + (intxt (and pmark (buffer-substring pmark (point)))) + (eob (point-max))) (when intxt (and geiser-repl-forget-old-errors-p (not (geiser-repl--is-debugging)) (compilation-forget-errors)) (geiser-repl--prepare-send) + (geiser-repl--mark-input-bounds pmark eob) (comint-send-input) (when (string-match "^\\s-*$" intxt) (comint-send-string proc (geiser-eval--scheme-str '(:ge no-values))) @@ -543,7 +556,9 @@ module command as a string") (interactive) (let ((p (point))) (cond ((< p (geiser-repl--last-prompt-start)) - (ignore-errors (compile-goto-error))) + (if (geiser-repl--is-history-input) + (geiser-repl--grab-input) + (ignore-errors (compile-goto-error)))) ((progn (end-of-line) (<= (geiser-repl--nesting-level) 0)) (geiser-repl--send-input)) (t (goto-char p) |