fix a race condition in emacs mode
Ignore-this: 4067accb79691119304eccb5153f0eee darcs-hash:20110728130457-c41ad-b15d4b9c2d12f1233efa9829bc4630925cd79110
This commit is contained in:
parent
6c41cd6c2e
commit
7c645d9c69
26
src/utop.el
26
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")
|
||||||
;; Make the text read-only
|
(let ((start utop-prompt-max) (stop (point-max)))
|
||||||
(add-text-properties utop-prompt-max (point-max) '(read-only t))
|
;; Make the text read-only
|
||||||
;; Make the old prompt sticky so we cannot edit after it
|
(add-text-properties start stop '(read-only t))
|
||||||
(let ((inhibit-read-only t))
|
;; Make the old prompt sticky so we cannot edit after it
|
||||||
(remove-text-properties utop-prompt-min utop-prompt-max '(rear-nonsticky nil)))
|
(let ((inhibit-read-only t))
|
||||||
;; Send everything after the prompt to utop
|
(remove-text-properties utop-prompt-min utop-prompt-max '(rear-nonsticky nil)))
|
||||||
(process-send-region utop-process utop-prompt-max (point-max))
|
;; Makes the text sent read only and add it the frozen face.
|
||||||
;; Makes the text sent part of the prompt so it won't be sent
|
(let ((inhibit-read-only t))
|
||||||
;; again. Also add it the frozen face.
|
(utop-add-text-properties-rear-nonsticky start stop
|
||||||
(let ((inhibit-read-only t))
|
|
||||||
(utop-add-text-properties-rear-nonsticky utop-prompt-max (point-max)
|
|
||||||
'(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