decide whether to follow output in each windows instead of globally

Ignore-this: 36cd9d3b8cd1a4c41284ea8d0731506f

darcs-hash:20120322065232-c41ad-218be51b177171f6640703e504599079d8c10006
This commit is contained in:
Jeremie Dimino 2012-03-22 07:52:32 +01:00
parent 8d8f46c8b6
commit cfb648c2e1
1 changed files with 12 additions and 5 deletions

View File

@ -400,7 +400,7 @@ it is started."
(defun utop-insert-output (output &optional face)
"Insert the given output before the prompt."
(let ((point-at-max (eq (point) (point-max))))
(let ((current-max (point-max)))
(save-excursion
(let ((line (concat output "\n")))
;; Apply the given face if provided
@ -414,10 +414,17 @@ it is started."
(setq utop-prompt-max (+ utop-prompt-max (length line)))
;; Make everything before the end prompt read-only
(add-text-properties (point-min) utop-prompt-max utop-non-editable-properties)))
;; If we are at the end of the buffer and OCaml is executing a
;; phrase, follow its output
(when (and point-at-max (eq utop-state 'wait))
(utop-goto-point-max-all-windows))))
;; If OCaml is executing a phrase, follow its output
(when (eq utop-state 'wait)
(let ((buffer (get-buffer utop-buffer-name)))
(walk-windows
(lambda (window)
(when (eq (window-buffer window) buffer)
(select-window window)
;; Only move the point if we were at the end of the
;; buffer
(when (eq (point) current-max)
(goto-char (point-max))))))))))
(defun utop-insert-prompt (prompt)
"Insert the given prompt."