fix a race condition in emacs mode
Ignore-this: 4067accb79691119304eccb5153f0eee darcs-hash:20110728130457-c41ad-b15d4b9c2d12f1233efa9829bc4630925cd79110
This commit is contained in:
parent
6c41cd6c2e
commit
7c645d9c69
16
src/utop.el
16
src/utop.el
|
@ -268,20 +268,22 @@ sub-process."
|
||||||
(goto-char (point-max))
|
(goto-char (point-max))
|
||||||
;; Terminate input by a newline
|
;; Terminate input by a newline
|
||||||
(insert "\n")
|
(insert "\n")
|
||||||
|
(let ((start utop-prompt-max) (stop (point-max)))
|
||||||
;; Make the text read-only
|
;; Make the text read-only
|
||||||
(add-text-properties utop-prompt-max (point-max) '(read-only t))
|
(add-text-properties start stop '(read-only t))
|
||||||
;; Make the old prompt sticky so we cannot edit after it
|
;; Make the old prompt sticky so we cannot edit after it
|
||||||
(let ((inhibit-read-only t))
|
(let ((inhibit-read-only t))
|
||||||
(remove-text-properties utop-prompt-min utop-prompt-max '(rear-nonsticky nil)))
|
(remove-text-properties utop-prompt-min utop-prompt-max '(rear-nonsticky nil)))
|
||||||
;; Send everything after the prompt to utop
|
;; Makes the text sent read only and add it the frozen face.
|
||||||
(process-send-region utop-process utop-prompt-max (point-max))
|
|
||||||
;; Makes the text sent part of the prompt so it won't be sent
|
|
||||||
;; again. Also add it the frozen face.
|
|
||||||
(let ((inhibit-read-only t))
|
(let ((inhibit-read-only t))
|
||||||
(utop-add-text-properties-rear-nonsticky utop-prompt-max (point-max)
|
(utop-add-text-properties-rear-nonsticky start stop
|
||||||
'(read-only t face utop-frozen)
|
'(read-only t face utop-frozen)
|
||||||
'(face read-only)))
|
'(face read-only)))
|
||||||
(setq utop-prompt-max (point-max))))
|
;; Move the prompt to the end of the buffer
|
||||||
|
(setq utop-prompt-min stop)
|
||||||
|
(setq utop-prompt-max stop)
|
||||||
|
;; Send everything after the prompt to utop
|
||||||
|
(process-send-region utop-process start stop))))
|
||||||
|
|
||||||
;; +-----------------------------------------------------------------+
|
;; +-----------------------------------------------------------------+
|
||||||
;; | Completion |
|
;; | Completion |
|
||||||
|
|
Loading…
Reference in New Issue