Julia-repl in emacs

Hello, I used to be a juno user, however, I’d like to switch to emacs to keep everything in the command line.

I’m trying to use emacs repl in doom emacs, which is emcas with evil keybindings.

The packages I’m using is julia-mode (major mode) + julia-repl (minor mode)

The escape will bring me back to normal mode out of edit mode just as vim.
The problem is when editing the source jl file if I accidentally pressed the “ESC” key twice. The first one brings me back to normal mode, however, the second one will quit the Julia-repl window together with the buffer and lost all the previous results. So whenever I switch between edit and normal mode, I feel very nervous.

I wonder if I’m using it the correct way or any good suggestions.

I’ve tried ess julia repl. However, the “;” command will be captured by emacs, instead of the julia REPL. So some features of julia REPL can not be used.

I am not familiar with those keybindings, but if

refers to using them in the *julia* window, note that it is basically an ansi-term, so whatever happens there applies.

I would suggest starting something else with M-x ansi-term, maybe a shell, and see if you can replicate the issue. Then it is not a julia-repl issue.

You may still be able to work around it by removing the binding for esc, or disabling the evil keybindings for that window only, with some hook. Frankly, I am not sure they even make sense for terminal emulators.

I’m not a doom user but I’ve looked at this as I have played with doom in the past.
The main problem here seems to be that pressing esc in normal mode (bounded to evil-force-normal-mode) in any buffer closes the julia-repl buffer. This doesn’t seem to happen with ansi-term. I’m actually not sure what is the role of this evil-force-normal-mode when you are already in normal mode, so maybe you can just unbind it globally.
This doesn’t seem to be an evil-mode issue, as I don’t see this problem in my spacemacs based config. Hence, I think it is something related specifically to doom and you might want to try and open an issue there first.

2 Likes

Thank you very much. The ansi-term window remains when running evil-force-normal-mode. However, if it’s a julia-repl window, which is generated by running inferior julia (defined in julia-repl.el package), running evil-force-normal-state will kill the window.

I’ve also tried eshell in emacs, it’s also killed when pressing <esc>

Do you have use julia-repl.el in spacemacs? Is it a issue of julia-repl or doom-emacs?

The ansi-term window will not be killed. It seems like, when running inferior julia or start a eshell in doom emacs, it will always be killed. From the color of some symbols, these *julia* or eshell windows looks a bit different from the ansi-term.

If I run a julia manually in ansi-term,it can capture the ; or ] key to transform to julia shell or package mode. It’s not the same in the automatic *julia* or eshell window.

The headache is, when ever I switched to a different buffer in the window (I only have one), the julia repl will be terminated.

Just to clarify, are we talking about

which always uses an ansi-term buffer, or inferior-julia, which uses comint?

Oh, sorry. I didn’t make it clear.

I have tried both the inferior-julia and julia-repl C-c C-z. Two esc will kill inferior-julia window and buffer immediately.

For julia-repl case, the julia-repl C-c C-z window will be killed. After a few seconds, the buffer is still there, the major mode transforms from Term to Fundamental, no text in windows. It looks like the julia process has been killed in background.

yes.

I would guess it is a doom related issue.

You should check what it is bound to (M-x describe-key), and investigate from there. julia-repl-minor-mode binds this, but possibly something else overwrites it.

Do you get any error messager, either in the minibuffer or the *Messages* buffer? Also, M-x toggle-debug-on-error could help you produce stacktraces which may be informative. I would like to help, but I need more information.