How to interrupt the running julia of julia mode in emacs

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.

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 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 https://julialang.slack.com/messages/C9YGT3NG4/, but be quick, it’s ephemeral.

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.

1 Like

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.

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.

1 Like

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