You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When in any special repl mode, such as shell, pkg, etc. sending code to the repl does not make sense. I propose to simply snap out of the special mode, as this is usually what you want.
This isn't a huge deal but I thought I'd chime in: I sometimes find it helpful to be able to send code while in other REPL modes, especially since I have to leave char-mode in the REPL buffer in order to paste. Sometime I will enter the Pkg mode and then send over code like add Plots or whatever.
As a more realistic example, I’ve been playing around lately with creating my own repl modes for DSLs and so it’s helpful to just open my special repl mode and then write and use julia-repl to send DSL code from my .jl buffer straight into my other repl mode.
This works fine now but if the proposed change goes through, it would limit the usefulness of alternate repl modes.
@tpapp Interestingly, if I use julia-repl to send code to the pkg> repl mode, the command does not get run unless I press enter again in the term buffer. Do you have any idea why this behaviour is happening?
what about a shortcut for sending something in a certain mode: C-c C-s C-c: send line or region in shell mode C-c C-p C-c: send line or region in pkg mode
or
C-c C-s to send in "special mode": C-c C-s C-s C-c: send line or region in shell mode C-c C-s C-p C-c: send line or region in pkg mode
you could also do C-c C-S for locking into the special mode and then the normal key bindings for sending to the REPL send in that mode.
There could be a variable that binds a key to a prefix:
@gdkrmr: I will think about this, but I am finding it hard to find a use case. I think of shell and pkg modes as convenience features for interactive use. If I found, for example, that I am composing something complex in a buffer and sending it to the shell, I would just write a shell script.
To everyone interested: #36 is an attempt to fix the most obvious case, ie clear the prompt by default by sending a C-a C-a [backspace]. C-u before should override (disable it). Testing and comments are welcome, this is about the 6th variation that I am trying out, but it seems to work.
Activity
tpapp commentedon Jul 7, 2018
Any suggestions for implementation?
gdkrmr commentedon Jul 7, 2018
Good question :-), I just started digging into the
julia-replsource code a little bit yesterday, I will tell you if I come up with an idea.gdkrmr commentedon Jul 9, 2018
Solution 1: simply prepend
"\^H"to each command you send to the repl, this shouldn't do any harm.Solution 2: do some matching, e.g.:
Something like this would also be useful, for the following case:
send
to the repl containing a command:
julia> ythen there is no variable
x, butyx. So generally deleting commands from the repl may be a good idea.tpapp commentedon Jul 9, 2018
Thanks for the ideas, I will explore these.
MasonProtter commentedon Jul 30, 2018
This isn't a huge deal but I thought I'd chime in: I sometimes find it helpful to be able to send code while in other REPL modes, especially since I have to leave
char-modein the REPL buffer in order to paste. Sometime I will enter thePkgmode and then send over code likeadd Plotsor whatever.tpapp commentedon Jul 31, 2018
@MasonProtter: just to clarify, you have
in a buffer and you want to use julia-repl to send that to the inferior process?
MasonProtter commentedon Jul 31, 2018
Yes.
As a more realistic example, I’ve been playing around lately with creating my own repl modes for DSLs and so it’s helpful to just open my special repl mode and then write and use julia-repl to send DSL code from my
.jlbuffer straight into my other repl mode.This works fine now but if the proposed change goes through, it would limit the usefulness of alternate repl modes.
tpapp commentedon Jul 31, 2018
Good to know. I will hold off this change and think about it.
MasonProtter commentedon Aug 24, 2018
@tpapp Interestingly, if I use
julia-replto send code to thepkg>repl mode, the command does not get run unless I press enter again in the term buffer. Do you have any idea why this behaviour is happening?gdkrmr commentedon Aug 24, 2018
what about a shortcut for sending something in a certain mode:
C-c C-s C-c: send line or region in shell modeC-c C-p C-c: send line or region in pkg modeor
C-c C-sto send in "special mode":C-c C-s C-s C-c: send line or region in shell modeC-c C-s C-p C-c: send line or region in pkg modeyou could also do
C-c C-Sfor locking into the special mode and then the normal key bindings for sending to the REPL send in that mode.There could be a variable that binds a key to a prefix:
this would be easily extensible and you just have to pre-pend the letter to each line before sending.
tpapp commentedon Aug 25, 2018
@MasonProtter: could be the bracketed paste, but I am not sure.
tpapp commentedon Aug 25, 2018
@gdkrmr: I will think about this, but I am finding it hard to find a use case. I think of shell and pkg modes as convenience features for interactive use. If I found, for example, that I am composing something complex in a buffer and sending it to the shell, I would just write a shell script.
gdkrmr commentedon Aug 25, 2018
A DLS that is built on top of julia? For Pkg and shell you are probably right.
tpapp commentedon Sep 2, 2018
To everyone interested: #36 is an attempt to fix the most obvious case, ie clear the prompt by default by sending a
C-a C-a [backspace].C-ubefore should override (disable it). Testing and comments are welcome, this is about the 6th variation that I am trying out, but it seems to work.