fix a race condition in emacs mode

Ignore-this: 4067accb79691119304eccb5153f0eee

darcs-hash:20110728130457-c41ad-b15d4b9c2d12f1233efa9829bc4630925cd79110
This commit is contained in:
Jeremie Dimino 2011-07-28 15:04:57 +02:00
parent 6c41cd6c2e
commit 7c645d9c69
1 changed files with 14 additions and 12 deletions

View File

@ -268,20 +268,22 @@ sub-process."
(goto-char (point-max))
;; Terminate input by a newline
(insert "\n")
;; Make the text read-only
(add-text-properties utop-prompt-max (point-max) '(read-only t))
;; Make the old prompt sticky so we cannot edit after it
(let ((inhibit-read-only t))
(remove-text-properties utop-prompt-min utop-prompt-max '(rear-nonsticky nil)))
;; Send everything after the prompt to utop
(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))
(utop-add-text-properties-rear-nonsticky utop-prompt-max (point-max)
(let ((start utop-prompt-max) (stop (point-max)))
;; Make the text read-only
(add-text-properties start stop '(read-only t))
;; Make the old prompt sticky so we cannot edit after it
(let ((inhibit-read-only t))
(remove-text-properties utop-prompt-min utop-prompt-max '(rear-nonsticky nil)))
;; Makes the text sent read only and add it the frozen face.
(let ((inhibit-read-only t))
(utop-add-text-properties-rear-nonsticky start stop
'(read-only t face utop-frozen)
'(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 |