Skip to content
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

Feature request: Restart julia process in vterm #110

Open
jlapeyre opened this issue Jun 11, 2021 · 5 comments
Open

Feature request: Restart julia process in vterm #110

jlapeyre opened this issue Jun 11, 2021 · 5 comments

Comments

@jlapeyre
Copy link

jlapeyre commented Jun 11, 2021

I am using vterm. I'd like to restart the Julia process and at the same time, keep the contents of the buffer.
There may be a way around this, but what I am trying now is.

reproduce undesirable behavior

  1. M-x julia-repl
  2. ctrl-d (exits julia)
  3. M-x julia-repl
    This errors with
    "You cannot change major mode in vterm buffers"

I'd like to restart the Julia process and at the same time, keep the contents of the buffer.

configuration

GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.27, cairo version 1.17.4) of 2021-03-26
julia-repl: 20210408.639
julia: v"1.7.0-DEV.961

julia-repl loaded like this

(use-package julia-repl
  :commands julia-repl julia-repl-mode
  :config (progn
            (julia-repl-set-terminal-backend 'vterm)
            (setq vterm-max-scrollback 100000)
            (load-library "julia-mode")))

EDIT: As a workaround, I change the argument of vterm-shell to the name of my shell, rather than julia. This requires only that I type "julia" to start julia in the vterm.

(let ((vterm-shell (s-join " " (cons executable-path switches))))

@wentasah
Copy link
Contributor

Interesting, my setup is almost the same as yours, but I cannot reproduce the problem. Whenever I exit Julia, the REPL buffer disappears and calling julia-repl makes it appear again with freshly started julia.

@ggebbie
Copy link

ggebbie commented Jan 25, 2022

Same issue as jlapeyre here. Emacs 27.2, Julia 1.7.1, julia-repl 20211230.814. When I exit Julia, the REPL does not disappear and invoking M-x julia-repl gives same error (i.e., cannot change major mode). Some conflict elsewhere in emacs setup?

@wentasah
Copy link
Contributor

Can you try to reproduce it with emacs configuration below?

Put the following to myinit.el:

;;; Straight bootstrap

(defvar bootstrap-version)
(let ((bootstrap-file
       (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
      (bootstrap-version 5))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

(setq package-enable-at-startup nil)

;; Use package setup

(setq straight-use-package-by-default t)
(straight-use-package 'use-package)

;; Package initialization

(use-package julia-mode)

(use-package julia-repl
  :commands julia-repl julia-repl-mode
  :config (progn
            (julia-repl-set-terminal-backend 'vterm)
            (setq vterm-max-scrollback 100000)
            (load-library "julia-mode")))

and run emacs as:

emacs -Q -l myinit.el

or, if you don't want straight.el to touch your ~/.emacs.d, run:

mkdir tmp
HOME=$PWD/tmp emacs -Q -l myinit.el

On my system, julia-repl works as expected with the above config. I guess that something else in your Emacs config can cause the problems.

@ggebbie
Copy link

ggebbie commented Feb 5, 2022

thanks for the detailed instructions wentasah. I think your hypothesis is right.

using the minimal configuration, when I exit() julia, I get Process julia finished. The buffer is not minimized or killed. Then M-x julia-repl starts a new julia session in the same buffer as the earlier julia session. I don't get the "major mode" error. If I'm able to find the conflict in the rest of my emacs configuration, I will post it here.

@rdiaz02
Copy link

rdiaz02 commented Oct 25, 2022

In case it helps, I was experiencing the same issue. I had set (setq vterm-kill-buffer-on-exit nil) (as explained in https://github.com/tpapp/julia-repl#using-vterm to see error messages from processes that wouldn't start) but then forgot to set it to t.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants