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

Closed
vicuna opened this issue Oct 27, 2003 · 1 comment

Comments

Projects
None yet
1 participant
@vicuna
Copy link

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: 152.23.182.246 (152.23.182.246)

Summary

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.

Symptoms

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.

Fix

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")
done

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,
Craig

@vicuna

This comment has been minimized.

Copy link
Author

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).

@vicuna vicuna closed this Jan 27, 2012

@vicuna vicuna added the feature-wish label Mar 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.