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

Fix so windows opens the default editor when @edit is used #8725

Merged
merged 1 commit into from
Oct 19, 2014

Conversation

dhoegh
Copy link
Contributor

@dhoegh dhoegh commented Oct 18, 2014

This fixes so windows can open source files with @edit macro using the default editor and I have added a notice to the user where to find the function when no line number info is sent to the editor.

@nalimilan
Copy link
Member

Thanks! But this is actually still not completely correct (not your fault, the code was already wrong), as the files are not guaranteed to be in that place. It should instead use the DATAROOTDIR constant which is set in base/build_h.jl, i.e. joinpath(JULIA_HOME, DATAROOTDIR, "julia", "base", file). Would you do that?

@dhoegh
Copy link
Contributor Author

dhoegh commented Oct 18, 2014

No problem. I was a bit too quick with the pull-request. My actual quest was to make @edit work with the default windows text editor, and I have now added what is necessary to do that plus some info to the user about which line number the method is defined at when the line number is not sent to the editor. Please rephrase the message to what you feel is appropriate.

@dhoegh dhoegh changed the title Fix find_source_file(file) to use joinpath Fix so windows opens the default editor when @edit is used Oct 18, 2014
@pao
Copy link
Member

pao commented Oct 18, 2014

I was a bit too quick with the pull-request.

We have no problem with "early and often!" If you are making a PR and you know that it's not ready yet, it's conventional to prefix the title with "WIP" (Work In Progress), but we certainly don't expect everything to be 100% ready when it's proposed.

Thanks for contributing!

@dhoegh
Copy link
Contributor Author

dhoegh commented Oct 18, 2014

Okay, I am finished now, until some of you guys come up with any wanted changes:)

@dhoegh
Copy link
Contributor Author

dhoegh commented Oct 18, 2014

It is now fixed:)

@nalimilan
Copy link
Member

Thanks! Could you squash these commits into one (using git rebase -i)?

@nalimilan
Copy link
Member

Looks like something went wrong. You have added commits instead of squashing them into one. Use git rebase -i and then once you're done git push --force to overwrite the old commits on the branch of the pull request.

@nalimilan
Copy link
Member

Ah, and please rewrite the commit message so that it makes sense out of the context of this PR (just like you did in the original commit).

@dhoegh dhoegh force-pushed the fix_find_source_file branch from fc40e83 to d3892bb Compare October 18, 2014 19:46
@dhoegh
Copy link
Contributor Author

dhoegh commented Oct 18, 2014

wow, I succeeded should I also squash the last one away? As you probably figured out I am not that good at git.

@nalimilan
Copy link
Member

Yes, please!

@dhoegh dhoegh force-pushed the fix_find_source_file branch from d3892bb to 2da44c5 Compare October 18, 2014 19:56
@dhoegh
Copy link
Contributor Author

dhoegh commented Oct 18, 2014

Fixed it, then I got schooled in git + VI:)

@nalimilan
Copy link
Member

Sorry, there still are two commits. :-)

@dhoegh
Copy link
Contributor Author

dhoegh commented Oct 18, 2014

Are there? 2da44c5 is the new commit as I see only se here.

@nalimilan
Copy link
Member

OK, now it's fine. Let's wait for Travis to finish the tests.

@dhoegh
Copy link
Contributor Author

dhoegh commented Oct 18, 2014

It should be backported as well right?

@@ -24,6 +24,7 @@ function edit(file::String, line::Integer)
f = find_source_file(file)
f != nothing && (file = f)
end
no_line_msg = "Uknown editor: no line number information passed.\nThe method is defined at line $line."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slight typo.

printed to the user when it is not passed to the editor.
@dhoegh dhoegh force-pushed the fix_find_source_file branch from fa684ec to 572c69c Compare October 18, 2014 21:48
@dhoegh
Copy link
Contributor Author

dhoegh commented Oct 18, 2014

Fixed and squashed.

@vtjnash
Copy link
Member

vtjnash commented Oct 19, 2014

despite the failed name mangling that will probably result if the path has a space or quote character in it, this is probably OK to merge anyways. spawn should really have the UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS argument since this is going through the DOS API before it gets to the Shell API (and then to the Win32 API and then to the NT API and finally to the kernel)

@dhoegh
Copy link
Contributor Author

dhoegh commented Oct 19, 2014

@vtjnash how should the UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS be used? I could not find any documentation on it regarding spawn()

JeffBezanson added a commit that referenced this pull request Oct 19, 2014
Fix so windows opens the default editor when `@edit` is used
@JeffBezanson JeffBezanson merged commit d22bc42 into JuliaLang:master Oct 19, 2014
@ivarne
Copy link
Member

ivarne commented Oct 19, 2014

@dhoegh Backports are very welcome!

Anyone can submit pull requests against the release-0.3 branch, but if you don't have time, I've gotten some experience so I'll gladly do it for you. Unfortunately this PR doesn't include tests so I can't automatically test whether the issue is really fixed there as well.

@dhoegh
Copy link
Contributor Author

dhoegh commented Oct 20, 2014

Hi brk00 could you make the back port together with the rest of the changes you have in 8738? If you just ping me on the backport then I will check it is working:)

@dhoegh
Copy link
Contributor Author

dhoegh commented Oct 20, 2014

I have found one problem with backporting DATAROOTDIR is not defined in 0.3, any ideas?

@nalimilan
Copy link
Member

I have found one problem with backporting DATAROOTDIR is not defined in 0.3, any ideas?

Are you sure? It's defined here: https://github.com/JuliaLang/julia/blob/release-0.3/base/Makefile#L59 But you need to write Base.DATAROOTDIR.

@dhoegh
Copy link
Contributor Author

dhoegh commented Oct 20, 2014

If I write in the interpreter:

julia> Base.DATAROOTDIR
ERROR: DATAROOTDIR not defined

and I also tried it in write Base. in the front in the function do not work either.

@ivarne
Copy link
Member

ivarne commented Oct 20, 2014

@nalimilan Base.DATAROOTDIR was backported in aacd2fa, just after 0.3.1 was tagged and released, so @dhoegh is right.

@dhoegh
Copy link
Contributor Author

dhoegh commented Oct 20, 2014

Thanks for the info @ivarne.

@ivarne
Copy link
Member

ivarne commented Oct 20, 2014

But this has to be fixed with a new 0.3.X release, so you should use the latest release-0.3 commit to base the pull request on.

@dhoegh
Copy link
Contributor Author

dhoegh commented Oct 20, 2014

But should I also compile source? I haven't done that before and I would prefer if I could avoid it.

@ivarne
Copy link
Member

ivarne commented Oct 20, 2014

Compiling Julia from source is usually a requirement when you want to do changes to Julia that aren't trivial typo fixes.

This fix looks like it is about on the boundary of trivial, so I think you'll likely be able to do it and have someone else test to ensure that it works.

It would be nice to note in a PR that you haven't really tested that it works, so that you motivate us to do a more thorough review before merging.

@dhoegh
Copy link
Contributor Author

dhoegh commented Oct 20, 2014

I had tested on 0.4 on a one day old nightly where I precompiled Base. So I had tested it I have just not compiled Julia from source.

@vtjnash
Copy link
Member

vtjnash commented Oct 20, 2014

On windows, you can test a patch to base by running the prepare-Julia-env.bat script after making the changes and deleting sys.ji

@dhoegh
Copy link
Contributor Author

dhoegh commented Oct 20, 2014

That was what I did, but I can't do it for 0.3.x since there is not made nightlies only 0.3.1.

@nalimilan
Copy link
Member

If you prepare a PR against 0.3 we can test it for you if you want -- though compiling Julia from scratch is a valuable experience for your next PR. ;-)

@StefanKarpinski
Copy link
Member

compiling Julia from scratch is a valuable experience for your next PR

Also, not hard. Clone and run make -j N where N is however many cores you feel like pegging during the build process. It will be done in a little while – a few hours on a slow machine with N = 1.

@tkelman
Copy link
Contributor

tkelman commented Oct 20, 2014

He's on Windows. So have to be careful to set up an environment following the steps in https://github.com/JuliaLang/julia/blob/master/README.windows.md

Or you can do Cygwin-to-MinGW cross-compilation, which I still need to document. The required packages are listed here: https://github.com/staticfloat/julia-vagrant/pull/2/files

dhoegh added a commit to dhoegh/julia that referenced this pull request Oct 21, 2014
…efault editor + line number is printed to the user when it is not passed to the editor.
nalimilan added a commit that referenced this pull request Oct 21, 2014
Backport of #8725 Fix so `@edit` works on windows with the default editor.
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

Successfully merging this pull request may close these issues.

9 participants