-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
REPL: allow editing current input in editor (via Meta-e) #33759
Conversation
e793bb8
to
1866262
Compare
This seems like a pretty useful feature. I rebased and added a commit that tried to use a bit less of the IOBuffer internals (it looked a bit scary to me) and also implements the
suggestion. What do you think @rfourquet? This is quite hard to test though. We could (just to simplify testing) allow passing in a "file modifying function" which by default is the |
9ef4397
to
b419f59
Compare
I've added docs and a test to this, should be good to go from my p.o.v. |
This seems to only work with terminal editors for now. |
I feel like this would be nicer if it didn't execute the code on exit so that you can exit the editor, check variables or w/e in the REPL, and then jump back into the editor. |
This features does not work for me on windows. It opens a notepad file in temp folder, asks me if i want to create the file (i say yes) i edit the file, saves it and nothing happens. |
Posting on an old PR isn't a good way to file an issue. |
The REPL editing features are decent, but as the multi-line input grows, it can be convenient to quicly jump to your favorite editor... let's make this feature available trough Meta-e.
In the current state, we open a temporary file with the REPL's current input, call
edit()
on this file, and then load the REPL input buffer with its new content. If the file has been modified, we execute directly the code, otherwise we assume that the user changed her mind and we restore the input buffer as it was before the call toedit()
. Suggestions welcome for this particular behavior (*).It's easy to try this feature out without having to recompile Julia, by putting the three new functions in your startup.jl file, together with
And adding the keybinding, e.g.
(*) This is currently implemented with a call to
ctime
, but might be more safe by comparing the content of the buffers before/after. For some reason, there is a little bug: if the first time the feature is used, the file is not updated, the input is still executed; but this doesn't happen when I put the new functions in my startup.jl file and run master (as described above).