From 4264dc3d925d49e43670e2a371c6e670b7b39fc7 Mon Sep 17 00:00:00 2001 From: Jeremie Dimino Date: Wed, 21 Mar 2012 14:18:24 +0100 Subject: [PATCH] follow OCaml's output in emacs Ignore-this: 20e2a63a90783cbcfbe273732293188b darcs-hash:20120321131824-c41ad-cf97daa2d551f812603bc30f955a94d0e39478e1 --- src/top/utop.el | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/top/utop.el b/src/top/utop.el index 3723fef..b0cfab6 100644 --- a/src/top/utop.el +++ b/src/top/utop.el @@ -63,6 +63,12 @@ If nil, `utop-command' will be used without modification." :type 'boolean :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 "The function which create the prompt for utop." :type 'function @@ -412,7 +418,10 @@ it is started." (setq utop-prompt-min (+ utop-prompt-min (length line))) (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)))) + (add-text-properties (point-min) utop-prompt-max utop-non-editable-properties))) + ;; If OCaml is executing a phrase, follow its output + (when (and utop-follow-output (eq utop-state 'wait)) + (utop-goto-point-max-all-windows))) (defun utop-insert-prompt (prompt) "Insert the given prompt."