gcv / julia-snail

An Emacs development environment for Julia
GNU General Public License v3.0
230 stars 21 forks source link

command to send region and evaluate it in Main scope ? #19

Closed orialb closed 4 years ago

orialb commented 4 years ago

I think it might be useful to have a command similar to julia-snail-send-region, but which evaluates the region in the Main scope. A typical use-case for me would be that I am trying to figure out what is going wrong inside a function I'm writing and I want to send several consecutive lines to the REPL so that I can for example inspect the variables state.

This could be implemented as a separate command, or the behavior of julia-snail-send-region could depend on whether it was called with the universal argument.

From a comment in another issue it seems that this might be against Snail's philosophy, although I think it would be very useful feature to have (and julia-snail-send-line does evaluate things in the Main scope) .

What do you think? I could have a shot at implementing this if you think this is a good idea.

gcv commented 4 years ago

It's not such a deep matter as Snail's philosophy. 🙃

Anyway, I like the idea of giving julia-snail-send-region a prefix arg which makes it evaluate in Main. It's really easy so I just did it. Commit https://github.com/gcv/julia-snail/commit/dba144402622f720aaeb02f1a2ff9d5138241f9b, should be in MELPA now. What do you think?

orialb commented 4 years ago

perfect, thanks for the quick reply and implementation! I updated julia-snail and will be using this feature :)