julia-repl
julia-repl copied to clipboard
evaluate function
Add the following functionality: when inside a function, select the whole body of the function and send it to the REPL, Similarly to C-c C-c in ESS. Should work with embedded functions.
function foo()
function bar()
# cursor here
end
end
should send function foo() ... end.
Possibly the same machinery that is used for indentation in julia-mode can be used for selecting the relevant block.
This would be as difficult as calling mark-defun, but you need a proper definition of beginning-of-defun-function and end-of-defun-function and I think that julia-mode doesn't set them. Thus I think that most of the work should be done in the upstream mode. This is also closely related to #7.
Getting the end of defun is tricky, because you have to skip the end keywords of other blocks, like begin, for, etc... If I remember well, fortran-mode has a fairly robust implementation of this function.
One thing that could be done as a stopgap solution is to just rely on the indentation. ie., once the editor sees function, every line after that is seen as part of that function until the indentation comes back to the same level as function. Obviously, this isn't ideal but it should cover most cases.
Unfortunately, this would not work for functions with empty lines in them (which are not uncommon).
Can’t we just make it ignore empty lines?
Ignoring empty lines still does not solve the nested case in the issue.
Also, I have to admit that with Revise.jl, this issue is not as pressing as it once was.