# Help debug Emacs term newline quirk

**URL:** <https://discourse.julialang.org/t/help-debug-emacs-term-newline-quirk/8244>\
**Category:** Internals & Design\
**Tags:** question\
**Created:** [January 9, 2018, 11:22am UTC](https://discourse.julialang.org/t/help-debug-emacs-term-newline-quirk/8244 "2018-01-09T11:22:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [January 9, 2018, 11:22am UTC](https://discourse.julialang.org/t/help-debug-emacs-term-newline-quirk/8244/1 "2018-01-09T11:22:11Z")

</div>

In the recent version of [julia-repl](https://github.com/tpapp/julia-repl), my Emacs mode for interacting with a Julia process, I have managed to make error locations “[clickable](https://tpapp.github.io/post/wip-julia-repl-clickable/)” by not breaking lines that are longer than the screen, with `(setq term-suppress-hard-newline t) `.

The problem is that this interacts badly with Julia (see screencast below): the characters that run over show up in random places. Note that I am **not** saying this is a Julia bug, it could be `term.el` in Emacs (which has its fair share of quirks). I just need help with understanding what is going on on the Julia side. I want to figure this out to solve it myself or at least make a helpful bug report somewhere, but don’t know how to start. Any advice on how to dig into this from the Julia side would be appreciated.

How to reproduce:

1. start Emacs with

```sh
emacs -q -nw --eval '(progn (setq term-suppress-hard-newline t) (ansi-term "julia"))'

```

preferably in a terminal that is not too wide so that you don’t have to type much (works in graphical mode without the `-nw`, too).

1. Type something that wraps. You can also eval it, then recall with `up`, etc.

[![asciicast](https://global.discourse-cdn.com/julialang/original/3X/2/f/2f9fe2b1caf2a635431ca74ae5c7f5f9522bdc9b.png)](https://asciinema.org/a/7QeLiQh9xQkrF8zwTkzAD9Zrr)

---

<div class="post-metadata">

**Author:** ![antoine-levitt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/antoine-levitt/32/4008_2.png) [@antoine-levitt](https://discourse.julialang.org/u/antoine-levitt)\
**Post date:** [January 9, 2018, 12:03pm UTC](https://discourse.julialang.org/t/help-debug-emacs-term-newline-quirk/8244/2 "2018-01-09T12:03:11Z")

</div>

My god asciinema is brilliant.

I don’t think it’s julia’s fault. I also get weirdness with `bc`: [https://asciinema.org/a/mihuG7jqoiBkgyhwzemToIQ01](https://asciinema.org/a/mihuG7jqoiBkgyhwzemToIQ01)

Over the years I got tons of bugs similar to this with emacs’ term mode, so I just gave up and use the inferior shells instead. Not that it doesn’t have its problems (half the time when I C-c a program in the middle of printing output it just crashes the buffer…)

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [January 9, 2018, 12:07pm UTC](https://discourse.julialang.org/t/help-debug-emacs-term-newline-quirk/8244/3 "2018-01-09T12:07:20Z")

</div>

Thanks, I am also pretty sure it is Emacs’s `ansi-term`, but understanding what is going on would allow me to try for a workaround.

How do you manage with inferior shells? AFAICT terminal is needed for `ASTIntepreter2`, the interactive functionality of `Pkg3`, etc.

---

<div class="post-metadata">

**Author:** ![antoine-levitt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/antoine-levitt/32/4008_2.png) [@antoine-levitt](https://discourse.julialang.org/u/antoine-levitt)\
**Post date:** [January 9, 2018, 12:20pm UTC](https://discourse.julialang.org/t/help-debug-emacs-term-newline-quirk/8244/4 "2018-01-09T12:20:49Z")

</div>

> [@Tamas\_Papp](#):
>
> How do you manage with inferior shells? AFAICT terminal is needed for ASTIntepreter2, the interactive functionality of Pkg3, etc.

I don’t use those packages (yet). ESS wraps pretty much all the functionality I need (e.g. help with “?”).
