gcv / julia-snail

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

Add smart send to repl function #41

Closed Islam0mar closed 3 years ago

Islam0mar commented 3 years ago

I was using ess, and they have ess-eval-region-or-function-or-paragraph-and-step which is much simpler for one key-bind. This PR would add: julia-snail-eval-region-or-block-or-line binds to "C-c C-e"

gcv commented 3 years ago

Mostly looks good.

Your description says the keybinding is C-c C-e, but your code says C-x C-e. I prefer C-c C-e for consistency with the other bindings.

Islam0mar commented 3 years ago

That was a typo. I use C-x C-e to match with slime and elisp, but I would change it.

gcv commented 3 years ago

I ended up renaming your function to julia-snail-send-dwim for consistency with other names and to keep it shorter. Also, I refactored it to use existing functions for DRYness. That changed the behavior to evaluate code in the case of an active region or block, rather than just copy it into the REPL, but I think that's more desirable in most cases anyway, since it preserves module context.

gcv commented 3 years ago

Thanks for your contribution!