-
Notifications
You must be signed in to change notification settings - Fork 25
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
Feature request: copy region into terminal #67
Comments
It cannot run the code in the context of the current module, which is why I didn't think it valuable to include in Snail. It's quite easy to write, so here's an implementation: (defun julia-snail-copy-repl-region ()
"Copy the region (requires transient-mark) to the Julia REPL and evaluate it.
This is not module-context aware."
(interactive)
(if (null (use-region-p))
(user-error "No region selected")
(let* ((block-start (region-beginning))
(block-end (region-end))
(text (s-trim (buffer-substring-no-properties block-start block-end))))
(julia-snail--send-to-repl text)
(julia-snail--flash-region (point-at-bol) (point-at-eol))))) Give it a try and let me know what you think. I'm open to adding it. |
Worked great, thanks a lot!! With that I should be able to modify |
All right; I'll put this code in the wiki Tips and Tricks section for now. |
This is great, I've now been able to switch from |
This is Emacs, most users want configurability. 😎 Anyway, I don't like the idea of automatically making durable on-disk changes to user data (files). That said, you're probably right that As a quick fix for your annoyance right now, you can write a bit of |
Maybe instead of using something That's what I really want, I just want to get some visual indication what that region evaluated to. |
@MasonProtter: I just pushed a change which shows the output of |
Hm yeah I gave it a try and unfortunately my new problem is that the output is in compact mode. I'm not sure what the right way to handle this would be since the minibuffer really only should be used for small outputs, but also I find this almost worse than no output: I'm not really sure what the right solution is, but it'd be good if there could be a place where the output is shown with it's proper formatting. For not I will probably just use the |
Yes, that’s pretty terrible. I reverted the change (that should be in MELPA in a couple of hours). An alternative is to show the result in an overlay at the end of the chunk of code being evaluated. CIDER does this. Pretty-printing it is a different story. I’ll leave that as a TODO for now. It also looks like the Snail logo emoji doesn’t render in your modeline! That’s weird, what does |
What if we just use result_str = repr("text/plain", result) and then pass that string to emacs and do (popup-tip result-str) I tried to prototype this myself for a PR, but I don't understand elisp well enough to do it unfortunately.
Probably the way I've set my fonts if I had to guess. The function you suggest returns |
Interesting! You can turn off the emoji modeline by setting |
Both things discussed in this ticket are now live. One: Two: the variable |
Hope it's ok to make a request. i'm not sure how to implement this myself, and advice would be much appreciated. It would be great to be able to copy-paste and run a region, similar to julia-snail-send-line. I miss being able to see the code and the output at the terminal when I run a region, the same way it happens to a line.
The text was updated successfully, but these errors were encountered: