follow OCaml's output only if we are at the end of the buffer
Ignore-this: 739f69390b4952091f481cc8dfb3e144 darcs-hash:20120322064548-c41ad-a3383dfe0bfa362d15c06949cbf5c9b44c5a82d1
This commit is contained in:
parent
08ab7b1e36
commit
8d8f46c8b6
|
@ -63,12 +63,6 @@ If nil, `utop-command' will be used without modification."
|
||||||
:type 'boolean
|
:type 'boolean
|
||||||
:group 'utop)
|
:group 'utop)
|
||||||
|
|
||||||
(defcustom utop-follow-output t
|
|
||||||
"Whether to follow OCaml's output while it is executing a
|
|
||||||
phrase."
|
|
||||||
:type 'boolean
|
|
||||||
:group 'utop)
|
|
||||||
|
|
||||||
(defcustom utop-prompt 'utop-default-prompt
|
(defcustom utop-prompt 'utop-default-prompt
|
||||||
"The function which create the prompt for utop."
|
"The function which create the prompt for utop."
|
||||||
:type 'function
|
:type 'function
|
||||||
|
@ -406,22 +400,24 @@ it is started."
|
||||||
|
|
||||||
(defun utop-insert-output (output &optional face)
|
(defun utop-insert-output (output &optional face)
|
||||||
"Insert the given output before the prompt."
|
"Insert the given output before the prompt."
|
||||||
(save-excursion
|
(let ((point-at-max (eq (point) (point-max))))
|
||||||
(let ((line (concat output "\n")))
|
(save-excursion
|
||||||
;; Apply the given face if provided
|
(let ((line (concat output "\n")))
|
||||||
(when face (add-text-properties 0 (length line) (list 'face face) line))
|
;; Apply the given face if provided
|
||||||
;; Goto before the prompt
|
(when face (add-text-properties 0 (length line) (list 'face face) line))
|
||||||
(goto-char utop-prompt-min)
|
;; Goto before the prompt
|
||||||
;; Insert the output
|
(goto-char utop-prompt-min)
|
||||||
(insert line)
|
;; Insert the output
|
||||||
;; Advance the prompt
|
(insert line)
|
||||||
(setq utop-prompt-min (+ utop-prompt-min (length line)))
|
;; Advance the prompt
|
||||||
(setq utop-prompt-max (+ utop-prompt-max (length line)))
|
(setq utop-prompt-min (+ utop-prompt-min (length line)))
|
||||||
;; Make everything before the end prompt read-only
|
(setq utop-prompt-max (+ utop-prompt-max (length line)))
|
||||||
(add-text-properties (point-min) utop-prompt-max utop-non-editable-properties)))
|
;; Make everything before the end prompt read-only
|
||||||
;; If OCaml is executing a phrase, follow its output
|
(add-text-properties (point-min) utop-prompt-max utop-non-editable-properties)))
|
||||||
(when (and utop-follow-output (eq utop-state 'wait))
|
;; If we are at the end of the buffer and OCaml is executing a
|
||||||
(utop-goto-point-max-all-windows)))
|
;; phrase, follow its output
|
||||||
|
(when (and point-at-max (eq utop-state 'wait))
|
||||||
|
(utop-goto-point-max-all-windows))))
|
||||||
|
|
||||||
(defun utop-insert-prompt (prompt)
|
(defun utop-insert-prompt (prompt)
|
||||||
"Insert the given prompt."
|
"Insert the given prompt."
|
||||||
|
|
Loading…
Reference in New Issue