Edit() doesn't use JULIA_EDITOR

I defined the environment variable JULIA_EDITOR=“gedit” in my startup.jl file, but edit(path) or edit(fn) still open with nano:

shell> echo $JULIA_EDITOR
gedit

julia> edit(
    "~/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/share/julia/stdlib/v1.10/LinearAlgebra/src/lapack.jl"
) # this will open nano

julia> edit(LAPACK.gels!, 1) # same

Is this a bug?

How?

Try:

ENV["JULIA_EDITOR"] = "gedit"

For me, on 1.10, if I do that (in the REPL) I get:

julia> @edit println("Hello world!")
ERROR: IOError: could not spawn `gedit +4:0 /home/pharaldsson/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/share/julia/base/coreio.jl`: no such file or directory (ENOENT)

I think that simply means it would be “working”, only that “no such file” refers to gedit, i.e. it not in PATH.

I get the same with:

julia> edit("/home/pharaldsson/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/share/julia/base/coreio.jl")
ERROR: IOError: could not spawn `gedit +0:0 /home/pharaldsson/.julia/juliaup/julia-1.10.0+0.x64.linux.gnu/share/julia/base/coreio.jl`: no such file or directory (ENOENT)

so at least there’s no difference.

Note for me, then:

shell> echo $JULIA_EDITOR
ERROR: UndefVarError: `JULIA_EDITOR` not defined

but:

shell> bash
pharaldsson@ryksugan:~$ echo $JULIA_EDITOR
gedit
1 Like

This was it! I wrote JULIA_EDITOR=“gedit” in startup.jl, thinking I was in bash… Writing ENV["JULIA_EDITOR"] = "gedit" solved this.

1 Like