-
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
Intended use / workflow #83
Comments
You're right that There are likely to still be some problems with looking at output. Let me know what you think. There's some unfinished work around it (#72). |
I didn't really answer your basic question. In the case of As for the output issue discussed in #67, I started thinking that maybe Snail should just (optionally!) pop up a dedicated output buffer, much as it does for plots. |
Note that you can also use C-c C-l (julia-snail-send-line) to evaluate a single line directly in the REPL. |
That'd be nice. It should also be possible to use tooltips to display the contents of a variable directly in the source buffer, or its type. It'd be a good feature to have. |
Thanks for the reply!
I've just tried it out, cool package, it does what I want in that the eval command automatically evals the whole cell, avoiding me having to manually mark it, but I still don't see any output - I have to assign to a variable, hop over to the REPL and then I think I'm keen on having a keybind that lets me eval some code (one line or more) and see the result of that evaluation immediately.
That sounds fine to me - as long as there is some form of (eval result) history I don't think it matters whether the result appears in a popup or the REPL for me. Hi @dahtah,
That sounds great!
Thanks, this is what I'm currently using, but I find that I often want to evaluate a few lines at a time, and see the result of the final line, like: x = some_list .* pi
y = [x; x.^2]
y |> sum |> sqrt In ESS (R), I would put the cursor somewhere in those three lines and hit the eval command, and I would see the eval results of each line in the REPL, importantly including the final output that I'm interested in. Thinking about it, it shouldn't be too hard to roll something to achieve that based on the function in #67 - I'm new (hopeless) at elisp but will give it a go! |
The following small modification does pretty much exactly what I want, I think I've read that you shouldn't use mark in a function so it's probably bad elisp but it works at least! Now to figure out how to bind it to (use-package julia-snail
:straight t
:hook (julia-mode . julia-snail-mode)
:config
(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)
(save-excursion
(if (null (use-region-p))
(mark-paragraph))
(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))
(deactivate-mark))))
:bind (:map julia-snail-mode-map
("C-M-g" . julia-snail-copy-repl-region))) |
@jdm204: I just implemented a simple way of showing the result of evaluating something from Emacs. It just prints a (somewhat nicely formatted) message to the REPL. See f64e0d7. You need to set The change should hit MELPA in a couple of hours. Please give it a try and let me know if this helps with your workflow. |
That works great, thanks! I do like that output from evaluating something from the 'script' looks different (the Info: and the bracket-thing to the left) to results from evaluating directly in the REPL. The only thing I expected to work but didn't is that For my workflow, I am now using Looking closer at ESS, the default eval command bound to |
Have you looked at |
Yes - with the new "if region active, evaluate it in current module; What I am looking for is the same as this except replacing "else copy line to REPL" with "else do julia-snail-send-region with the region set to the paragraph at point". |
Also worth noting is the recently-merged integration for org-babel. See #86. |
Take a look at the new |
I'll close this ticket since I'm not sure what else to do about it for now. If there's anything else, feel free to reopen or start a new discussion. |
#Hi, first of all I want to thank you for your work on this package - the jump to def / display plots in a buffer features in particular have massively improved my emacs-julia experience!
In general, I'm a bit confused as to the intended workflow (I haven't used SLIME/CIDER, maybe that's why). I come from R land (RStudio -> ESS), and in general there doesn't seem to be a distinction between evaluating some code and copying it into the REPL, which I think is the source of my confusion.
A simplified example of a session for me looks like the following:
If I
julia-snail-send-buffer-file
then I don't get any output, and have to switch to the REPL and runmean(long.mreads)
etc manually.julia-snail-send-top-level-form
looks like what I'm used to in ESS withC-c
- send a function if point is in one, otherwise send contiguous block of code at point, but despite the documentation sayingCurrently only works on blocks terminated with ‘end’.
, it doesn't work for the twoend
terminated blocks in my above example (if I am interpreting what that means correctly), instead I getNo top-level form at point
. The only end-terminated block that it works for me is functions.julia-snail-send-region
doesn't seem exactly what I want because I have to highlight the code manually, and I don't see the output (e.g for the plot or themean
call.Currently the only way I can think to work is by evaluating line-by-line which of course isn't ideal!
I saw #67 but the fact that this wasn't originally implemented makes me think I'm just fundamentally misunderstanding the intended workflow - if someone could point me in the right direction that would be amazing!
The text was updated successfully, but these errors were encountered: