Elpy: ESS-style send current "chunk" feature implementation

Created on 8 Mar 2017  Â·  8Comments  Â·  Source: jorgenschaefer/elpy

ESS, emacs' R mode (an excellent package, btw), has as default behavior its C-c C-c send all code between the two nearest blank lines before and after point. It has also the nifty feature of flashing a highlight of this code chunk as you press C-c C-c. I can't find an equivalent for elpy. Am I missing something, and if not, is this an interesting feature for the elpy package?

Enhancement

Most helpful comment

Likely not too many usecases for a general-purpose python user, but for the scipy/numpy crowd, it's very useful for visualization. You might have a code chunk that generates a graph or chart or whatnot that lives in the same file as a large amount of dataprocessing. You don't want to wait for a minute every time you update a particular graph, nor do you want to generate multiple graphs every time you want to re-visualize a certain one.

I'll likely implement this myself, and file a pull request. If in the meantime you feel it's not suitable for this project, then no hard feelings if you decide to dismiss it :)

All 8 comments

Hello, and thanks for the suggestion! This is one of these things that is useful for Numpy/Scipy users, who use Python interactively a lot, but much less useful for people who use Python more for software development than statistics and interactive work. I'm always torn as to how much to support the former workflow. I can see adding such a command to elpy, but I would not bind it to a key by default, especially not C-c C-c …

Maybe with a prefix arg? C-u C-c C-c. Seems a bit long-winded, though. C-c RET is an option.

I'm happy to implement this and file a pull request, btw. Just let me know
your thoughts on bindings and behavior. I like the flashing effect, for
example, as well as the automatically navigating to the next code chunk after
evaluation.

For normal Python development, I have never really had the need to send individual lines in a file. That's why Elpy's C-c C-c sends the full file if there is no active region.

I can totally see providing a command that users then can bind themselves for this kind of work. I can also see adjusting the C-RET behavior, maybe. Not sure. I do not have the ipython/scipy/numpy interactive use case myself, at all, so I have no idea what would be useful for that.

Likely not too many usecases for a general-purpose python user, but for the scipy/numpy crowd, it's very useful for visualization. You might have a code chunk that generates a graph or chart or whatnot that lives in the same file as a large amount of dataprocessing. You don't want to wait for a minute every time you update a particular graph, nor do you want to generate multiple graphs every time you want to re-visualize a certain one.

I'll likely implement this myself, and file a pull request. If in the meantime you feel it's not suitable for this project, then no hard feelings if you decide to dismiss it :)

maybe late here, but there is a package for that: https://github.com/wavexx/python-x.el

Ah, cool. I ended up implementing this, but was rude and didn't file a pull request. I'll try to get around to that within the next couple of days

@dwcoates are you still planning to file the PR? I would be glad to help with review and testing.

Was this page helpful?
0 / 5 - 0 ratings