Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

toplevel ugliness #8341

vicuna opened this issue Oct 27, 2003 · 1 comment

toplevel ugliness #8341

vicuna opened this issue Oct 27, 2003 · 1 comment


Copy link

@vicuna vicuna commented Oct 27, 2003

Original bug ID: 1898
Reporter: administrator
Status: closed (set by @damiendoligez on 2012-01-27T12:49:40Z)
Resolution: fixed
Priority: normal
Severity: feature
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name: Craig Samuel Falls
Version: 3.07+2
OS: Debian
Submission from: (


Using the toplevel directly in a terminal is fine. However, it has bad behavior
when run as a sub-process within Emacs which makes errors unreadable. Fixing
this annoyance in the ocaml toplevel will improve interactive use with (X)Emacs
for many users.

To Reproduce

  1. Run ocaml-mode or tuareg-mode.
  2. Select a large region of ocaml code.
  3. Send the code to the ocaml sub-process.


The result of a multi-line expression (such as a class) will be indented to the
right, often so far that the first line returned from the ocaml toplevel will
not be visible.


This is a hack, but demonstrates the problem more specifically:

while true do
let input = read_line () in
let line = Str.replace_first (Str.regexp "# *") "" input in
print_string (line ^ "\n")

Compile this to "fix". Then, create a shell script called ocaml-fix that
executes "ocaml | fix". Finally, send a large region to the ocaml sub-process
again, this time running ocaml-fix instead of ocaml.

Thank you very much,

Copy link

@vicuna vicuna commented Jan 27, 2012

Comment author: @damiendoligez

Added an option (-nopromptcont) to suppress the intermediate prompts (which is two spaces in this case) when handling multi-line input.

Committed in trunk [3.13.0] (commit 12085).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant