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

function edit seems to create bad path for sublime text option (i.e. "subl") in interactiveutil.jl #11305

Closed
timema opened this issue May 17, 2015 · 5 comments

Comments

@timema
Copy link
Contributor

timema commented May 17, 2015

I am using Julia 0.3.8 on a mac with OS 10.10.3. I am trying to define sublime text as my editor for julia when using @edit so I start by defining:
ENV["JULIA_EDITOR"]="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"

however when I do: @edit rand()
I get this error:
ERROR: could not spawn /Applications/Sublime Text.app/Contents/SharedSupport/bin/subl /Applications/Julia-0.3.8.app/Contents/Resources/julia/bin/../share/julia/base/random.jl:90: no such file or directory (ENOENT)
in _jl_spawn at process.jl:217
in spawn at /Applications/Julia-0.3.8.app/Contents/Resources/julia/lib/julia/sys.dylib
in edit at interactiveutil.jl:35
in edit at interactiveutil.jl:56

as I was digging around edit(file::String, line::Integer)
I discovered that when it decides to use "subl" on line 35 of interactiveutil.jl it calls:
interactive.jl:35 spawn($(shell_split(edpath)) $file:$line)

this creates:
/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl /Applications/Julia-0.3.8.app/Contents/Resources/julia/bin/../share/julia/base/random.jl:90
which cannot be spawned because it cannot find the directory

i discovered that if don't call the shell_split function and instead call:
spawn($edpath $file:$line)
it works I think because it create:
'/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl' /Applications/Julia-0.3.8.app/Contents/Resources/julia/bin/../share/julia/base/random.jl:123

this difference is the ticks around the path to subl which doesn't exist in the previous version with shell_split

I did this by hand. I wasn't sure how to change the code in base to get it to work. I think this is a bug but I am not sure and I am not sure if this is the correct fix. I think shell_split was being used because the path name (at least in OS X it has a space in it i.e. "Sublime Text.app")

@tkelman
Copy link
Contributor

tkelman commented May 17, 2015

ref #6865, cc @jayschwa

(P.S: please try to quote macro names with backticks @edit to avoid notifying random github users)

@timema
Copy link
Contributor Author

timema commented May 17, 2015

Sorry!

@jayschwa
Copy link
Member

Try using two backslashes:

ENV["JULIA_EDITOR"]="/Applications/Sublime\\ Text.app/Contents/SharedSupport/bin/subl"

@timema
Copy link
Contributor Author

timema commented May 17, 2015

What is strange is when I do not define ENV["JULIA_EDITOR"], when I use edit it opens up "text edit" because it is the default editor that is used when the -t option is used in "spawn(open -t $file)". However, when I add the extra backslash like you suggested, it opens up Sublime Text (.jl files are set to open up by sublime by default on my mac) but without the line info it treats it like it is the unknown default with the text:
Unknown editor: no line number information passed.
The method is defined at line 90.

@timema
Copy link
Contributor Author

timema commented May 18, 2015

I just submitted a pull request (#11329) to add:
change interactiveutil.jl line 36 in the latest pre 0.4 to:
startswith(edname, "subl") || edname == "atom" || endswith(string(edname),"subl")

I am not sure how to send a pull request for changes in 0.3.8
it should change interactiveutil.jl line 35 in 0.3.8 to:
elseif beginswith(edname, "subl") || endswith(string(edname),"subl")

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