-
Notifications
You must be signed in to change notification settings - Fork 79
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
create a custom variable for process-connection-type #314
Comments
When `process-connection-type` is set to `t`, `utop` becomes unusable when
run by `tuareg-run-ocaml`.
For more information, please see the OCaml Discuss thread that uncovered this issue:
https://discuss.ocaml.org/t/comint-version-of-utop-in-emacs/14466
Apparently utop by default checks whether it's connected to a PTY to
decide whether to use the "dumb" UI or the fancy UI that relies on ANSI
escape sequences.
I don't like the idea of changing `process-connection-type` for that.
I see two other solutions:
- Change Utop so it (also) pays attention to $TERM. Tuareg runs the
subprocess with a $TERM set to "dumb" which should instruct the
subprocess to *not* use ANSI escapes.
- If this is not an option, then pass `utop` an option that requests the
"dumb" UI.
|
These are good points, and I would definitely be interested in working on a PR to the
In other words, this customization solution seems very low-cost, and will help Tuareg users waiting for an upstream |
These are good points, and I would definitely be interested in working on
a PR to the `utop` project that recommends one of these changes. However,
I wonder whether you would be willing to consider the code in the PR
associated with this issue as a short-term solution, for the following
reasons:
I think rather add a specific workaround in `tuareg.el` and ask users to
(setq tuareg-process-connection-type nil)
in their init file, I'd rather tell them they don't need to upgrade
Tuareg and can use
;; Workaround problem where UTop assumes it's running in an
;; ANSI-compatible terminal (issue #314 of Tuareg).
(advice-add 'make-comint :around #'my-utop-workaround)
(defun my-utop-workaround (orig-fun name &rest args)
(if (not (equal name "OCaml"))
(apply orig-fun name args)
(let ((process-connection-type nil))
(apply orig-fun name args))))
|
Wowie zowie, I just tried pasting that exact code into my init file and it worked like a charm outta the box. Ok, this solution works for me; thanks! Will get going on a PR to |
Summary
The proposal in this issue is to make
process-connection-type
customizable.Background
In commit
cd5229e
, in order to address #83,process-connection-type
was changed fromnil
tot
. This allowed Tuareg-Interactive mode to display the output ofctypes
functions when they wrote tostdout
. However, a (presumably unintended) consequence of this change was that it became impossible to runutop
under Tuareg-Interactive mode, which previously worked smoothly. Whenprocess-connection-type
is set tot
,utop
becomes unusable when run bytuareg-run-ocaml
.For more information, please see the OCaml Discuss thread that uncovered this issue:
https://discuss.ocaml.org/t/comint-version-of-utop-in-emacs/14466
Proposal
A forthcoming PR will make the value of
process-connnection-type
configurable via Emacs'customize
facility. The default value will bet
, which means that this change will have no discernible effect for most Tuareg users. But the Emacs user will be able to setprocess-connection-type
tonil
if they would like to usetuareg-run-ocaml
withutop
. Having this ability will be incredibly valuable, especially to those of us at the UChicago Library who runutop
under Tuareg.The text was updated successfully, but these errors were encountered: