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

evaluate function #6

Open
tpapp opened this issue Mar 3, 2017 · 5 comments
Open

evaluate function #6

tpapp opened this issue Mar 3, 2017 · 5 comments

Comments

@tpapp
Copy link
Owner

tpapp commented Mar 3, 2017

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.

@giordano
Copy link

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.

@MasonProtter
Copy link

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.

@tpapp
Copy link
Owner Author

tpapp commented Jul 31, 2018

Unfortunately, this would not work for functions with empty lines in them (which are not uncommon).

@MasonProtter
Copy link

Can’t we just make it ignore empty lines?

@tpapp
Copy link
Owner Author

tpapp commented Jul 31, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants