summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames C. De Ricco <jamescdericco@gmail.com>2017-03-21 00:57:24 -0400
committerJames C. De Ricco <jamescdericco@gmail.com>2017-03-21 01:15:02 -0400
commitc5e141e892a9b4b4a339ee647f355fd025c9f9ab (patch)
tree7acfeb6a1e96802b42294dc8ced7298676775212
parentead363aecdcf7cf9ac1fe2ce5eef19d74f2393c5 (diff)
downloadgeiser-c5e141e892a9b4b4a339ee647f355fd025c9f9ab.tar.gz
geiser-c5e141e892a9b4b4a339ee647f355fd025c9f9ab.tar.bz2
Don't assign the (field t) property to old REPL inputs
Previously, Geiser added a (field t) property to inputs before adding them to the REPL history so it can determine what characters in the buffer belong to old input and yank it when a user pressed enter (geiser-repl--maybe-send) on it. When users recalled an old input with "M-p" (comint-previous-matching-input-from-input), the old input with its (field t) property were inserted after the current prompt. Since old inputs were not "front-sticky," when point was just after the current prompt but before the characters of the old input, Emacs considered point to be outside of the (field t) field; this prevented users from using some movement commands such as forward-word to move point into the old input text. Furthermore, when users inserted text before the old input or yanked other old inputs afterwards, this new text did not have the field property and so Emacs restricted point movement to and from the old text with the (field t) field. This resolves the issue by not adding the (field t) property to old inputs and instead leverages comint's ability to assign the output field to all non-input (by setting comint-use-prompt-regexp to nil). It should resolve the issue reported in "[Geiser-users] Problem with prompt at history item" by Hamish Ivey-Law (https://lists.nongnu.org/archive/html/geiser-users/2014-12/msg00001.html).
-rw-r--r--elisp/geiser-repl.el12
1 files changed, 4 insertions, 8 deletions
diff --git a/elisp/geiser-repl.el b/elisp/geiser-repl.el
index babebf8..8720a68 100644
--- a/elisp/geiser-repl.el
+++ b/elisp/geiser-repl.el
@@ -602,11 +602,8 @@ If SAVE-HISTORY is non-nil, save CMD in the REPL history."
(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--is-input ()
+ (not (eq (field-at-pos (point)) 'output)))
(defun geiser-repl--grab-input ()
(let ((pos (comint-bol)))
@@ -623,7 +620,6 @@ If SAVE-HISTORY is non-nil, save CMD in the REPL history."
(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)))
@@ -633,7 +629,7 @@ If SAVE-HISTORY is non-nil, save CMD in the REPL history."
(interactive)
(let ((p (point)))
(cond ((< p (geiser-repl--last-prompt-start))
- (if (geiser-repl--is-history-input)
+ (if (geiser-repl--is-input)
(geiser-repl--grab-input)
(ignore-errors (compile-goto-error))))
((let ((inhibit-field-text-motion t))
@@ -677,7 +673,7 @@ buffer."
'((comint-highlight-prompt geiser-font-lock-repl-prompt)
(comint-highlight-input geiser-font-lock-repl-input)))
(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)
(setq comint-process-echoes nil)