# How to interrupt the running julia of julia mode in emacs

**URL:** <https://discourse.julialang.org/t/how-to-interrupt-the-running-julia-of-julia-mode-in-emacs/24945>\
**Category:** Tooling\
**Tags:** emacs\
**Created:** [June 5, 2019, 12:02am UTC](https://discourse.julialang.org/t/how-to-interrupt-the-running-julia-of-julia-mode-in-emacs/24945 "2019-06-05T00:02:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![yzcj105](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yzcj105/32/8754_2.png) [@yzcj105](https://discourse.julialang.org/u/yzcj105)\
**Post date:** [June 5, 2019, 12:02am UTC](https://discourse.julialang.org/t/how-to-interrupt-the-running-julia-of-julia-mode-in-emacs/24945/1 "2019-06-05T00:02:07Z")

</div>

When I use julia mode / Julia repl in emacs, how can I interupt running julia REPL? Usually, in a terminal, we can send Ctrol+C, however, it does not work in emacs.

---

<div class="post-metadata">

**Author:** ![mauro3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mauro3/32/292_2.png) [@mauro3](https://discourse.julialang.org/u/mauro3)\
**Post date:** [June 5, 2019, 5:31am UTC](https://discourse.julialang.org/t/how-to-interrupt-the-running-julia-of-julia-mode-in-emacs/24945/2 "2019-06-05T05:31:29Z")

</div>

A julia-repl session can be very tricky to interrupt, in particular when there is a ton of printing happening. Additionally, this can also make emacs unusable. Worst case is that you have to kill emacs. This makes me hesitant to use julia-repl. However, I think the repl from [https://github.com/dzop/emacs-jupyter](https://github.com/dzop/emacs-jupyter) does not have the problem of making emacs unusable but interrupting can be tricky too (but I need to use it more to be sure).

PS: there is currently a related, lively discussion on [Slack](https://julialang.slack.com/messages/C9YGT3NG4/), but be quick, it’s ephemeral.

---

<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:** [June 5, 2019, 5:42am UTC](https://discourse.julialang.org/t/how-to-interrupt-the-running-julia-of-julia-mode-in-emacs/24945/3 "2019-06-05T05:42:45Z")

</div>

> [@mauro3](#):
>
> Additionally, this can also make emacs unusable. Worst case is that you have to kill emacs.

I am not sure why you think this. In `julia-repl`, C-x C-c sends a C-c to the Julia process, which then has the same effect it would in eg a terminal.

Having to kill Emacs is never necessary in my experience. Worst case scenario is having to kill the `julia` process.

---

<div class="post-metadata">

**Author:** ![mauro3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mauro3/32/292_2.png) [@mauro3](https://discourse.julialang.org/u/mauro3)\
**Post date:** [June 5, 2019, 6:40am UTC](https://discourse.julialang.org/t/how-to-interrupt-the-running-julia-of-julia-mode-in-emacs/24945/4 "2019-06-05T06:40:18Z")

</div>

Yes, it’s pretty hard to make emacs un-reponsive with julia-repl, but it has happened to me a few times (during julia-0.6 times). And as everything is in emacs, this is pretty annoying.

For instance running `error(join(1:10^6, '\n'))` in the REPL vs julia-repl shows some of this (whilst not being fatal; I’ll try to remember to post here if I ever find a “fatal” one again.). I think one of the problems might be that when julia dumps a lot of text into the buffer, then emacs itself struggles and may keep struggling even after julia is killed.

---

<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:** [June 5, 2019, 6:54am UTC](https://discourse.julialang.org/t/how-to-interrupt-the-running-julia-of-julia-mode-in-emacs/24945/5 "2019-06-05T06:54:10Z")

</div>

> [@mauro3](#):
>
> I think one of the problems might be that when julia dumps a lot of text into the buffer, then emacs itself struggles and may keep struggling even after julia is killed.

Yes, this is an issue in the `ansi-term` implementation. C-g sometimes helps.

While I understand that it is possible to come up with examples like this to reproduce the issue, I rarely ever run into it in practice.

Incidentally, I think that a `show` method defaulting to dumping megabytes of text is a bug, and should be fixed. This is relevant not only for Emacs but other uses.

---

<div class="post-metadata">

**Author:** ![yzcj105](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yzcj105/32/8754_2.png) [@yzcj105](https://discourse.julialang.org/u/yzcj105)\
**Post date:** [June 13, 2019, 11:21pm UTC](https://discourse.julialang.org/t/how-to-interrupt-the-running-julia-of-julia-mode-in-emacs/24945/6 "2019-06-13T23:21:45Z")

</div>

It works ! C-x C-c sends C-c in julia-repo. Thank you.
