From cdd4163d16b1ef6a4d66b16e606d6afbd2cf712c Mon Sep 17 00:00:00 2001 From: Mads Hartmann Jensen Date: Mon, 5 Jan 2015 13:21:50 +0100 Subject: [PATCH] Update README to reflect new configuration --- README.md | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 9134410..61b15eb 100644 --- a/README.md +++ b/README.md @@ -135,21 +135,38 @@ you can copy-paste this code into you `~/.emacs` file: Then you can execute utop inside emacs with: `M-x utop`. -Integration with the tuareg/typerex mode ----------------------------------------- +utop also ships with a minor mode that has the following key-bindings -You can replace the default toplevel used by the tuareg or typerex -mode by utop, for that add the following lines to your `~/.emacs` file: +| key-binding | function | Description | +|-------------|-------------------|------------------------------| +| C-c C-z | utop | Start a utop buffer | +| C-x C-e | utop-eval-phrase | Evaluate the current phrase | +| C-x C-r | utop-eval-region | Evaluate the selected region | +| C-c C-b | utop-eval-buffer | Evaluate the current buffer | +| C-c C-k | utop-kill | Kill a running utop process | + +You can enable the minor mode using `M-x utop-minor-mode`, or you can +have it enabled by default with the following configuration ```scheme -(autoload 'utop-setup-ocaml-buffer "utop" "Toplevel for OCaml" t) -(add-hook 'tuareg-mode-hook 'utop-setup-ocaml-buffer) -(add-hook 'typerex-mode-hook 'utop-setup-ocaml-buffer) +(autoload 'utop-minor-mode "utop" "Minor mode for utop" t) +(add-hook 'tuareg-mode-hook 'utop-minor-mode) ``` -You can also complete text in a tuareg or typerex buffer using the -environment of the toplevel. For that bind the function -`utop-edit-complete` to the key you want. +If you plan to use utop with another major-mode than tuareg, +e.g. typerex, then you will need the following configuration instead + +```scheme +(autoload 'utop-minor-mode "utop" "Minor mode for utop" t) +(setq utop-skip-blank-and-comments 'typerex-skip-blank-and-comments) +(setq utop-skip-to-end-of-phrase 'typerex-skip-to-end-of-phrase) +(setq utop-discover-phrase 'typerex-discover-phrase) +(add-hook 'typerex-mode-hook 'utop-minor-mode) +``` + +You can also complete text in a buffer using the environment of the +toplevel. For that bind the function `utop-edit-complete` to the key +you want. Common error ------------