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

edit() doesn't go to the line number when nano is the default editor on linux #4728

Closed
elehcim opened this issue Nov 4, 2013 · 5 comments
Closed

Comments

@elehcim
Copy link
Contributor

elehcim commented Nov 4, 2013

I'm running Kubuntu Linux 13.10, and I have /etc/alternatives/editor -> /bin/nano.

When using the function edit(file::String,line::Integer) at util.jl:147 the editor pops up always at line 1, regardless of the line parameter value.

@elehcim
Copy link
Contributor Author

elehcim commented Nov 4, 2013

I tried to fix this by looking into the sources, but the problem seems that I don't have any ENV["EDITOR"] value, so that I cannot switch on the editor name to call the desired command which would be:
spawn(nano +$line $file)

Do you have any idea on why there is no EDITOR key in my environment dictionary ENV?

@timholy
Copy link
Sponsor Member

timholy commented Nov 4, 2013

I don't think it's defined by default, but you can set it by saying export EDITOR=nano in the shell that you launch julia from.

@JeffBezanson
Copy link
Sponsor Member

We should use something like readlink to determine which editor is actually being used by /etc/alternatives/editor.

@StefanKarpinski
Copy link
Sponsor Member

This whole edit business is kind of a mess and needs an overhaul. I just side-stepped the whole thing when implementing Pkg.edit() and just used the traditional EDITOR / VISUAL variables:

julia/base/pkg/entry.jl

Lines 16 to 28 in 20b76e4

function edit(f::Function, pkg::String, args...)
r = Reqs.read("REQUIRE")
reqs = Reqs.parse(r)
avail = Read.available()
!haskey(avail,pkg) && !haskey(reqs,pkg) && return false
= f(r,pkg,args...)
== r && return false
reqsʹ = Reqs.parse(rʹ)
reqsʹ != reqs && resolve(reqsʹ,avail)
Reqs.write("REQUIRE",rʹ)
info("REQUIRE updated.")
return true
end
.

@elehcim
Copy link
Contributor Author

elehcim commented Nov 6, 2013

+1 for readlink. I was thinking the same.

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