Open nbrantut opened 5 years ago
I think Jupyter notebook interfaces already handle this kind of workflow very well and there doesn't seem to be a lot of payoff from duplicating this. You may find eg
https://github.com/millejoh/emacs-ipython-notebook
useful.
Thanks for the answer; I have used the notebooks in emacs using the package you point to, but found it unecessarily cumbersome, especially for short codes. I was just thinking of doing a extremely stripped down version of cells by having a simple syntax marker that lets me evaluate a bunch of lines without having to mark the region by moving the cursor around.
But yes if that's not something you think is of interest fair enough!
You might look at the literate programming support in emacs org-mode, it lists a contributed julia package already. https://orgmode.org/manual/Working-with-source-code.html
the ob-julia
module in org-mode depends on ess
, the EIN
or emacs-jupyter
packages require...a jupyter server, there is a ob-julia-vterm
package but it is synchronous and now julia-repl has vterm support anyway..
this is what I am using currently, to execute code blocks in the repl, same as https://github.com/diadochos/org-babel-eval-in-repl
(defun org-babel-execute:julia (body params)
(interactive)
(setq
julia-repl-inferior-buffer-name-suffix
(intern (rest (assoc :session params))))
(julia-repl--send-string
(org-babel-expand-body:julia body params)))
However I have also to redefine julia-repl--inferior-buffer-name
otherwise the session isn't picked up...not sure why
There is a library for Emacs that does this for Python source code: https://github.com/thisch/python-cell.el
I actually took this code and modified it to work for Clojure instead. And it would probably also be easy to adapt it for Julia.
Edit: I got it working for Julia with just very few changes :-)
This is what I did:
~/.emacs.d/julia-cell/julia-cell.el
(require 'python)
by (require 'julia-repl)
in that file.(python-shell-send-region start end)
by (julia-repl--send-string (buffer-substring-no-properties start end))
.python
to julia
in that file.julia-cell.el
code in my init.el
file:
(add-to-list 'load-path "~/.emacs.d/julia-cell")
(require 'julia-cell)
(add-hook 'julia-mode-hook 'julia-cell-mode)
I think it would be cool to have this kind of functionality being part of julia-repl
. Another option would be to extend the python-cell
repo to generalize for Julia, not sure what is best.
Would it be possible to evaluate (i.e., send code to repl) code as cells (like juno, or matlab-style), for instance whatever is between
##
or equivalent?This might be linked to implementing issues reported in #19 (optionnally together with #18), but there might be an additional job for regexp tracking the cell separation symbols (maybe even highlight cells, ideally...)
I was looking to implement this myself, but my elisp is not good at all. I'll give it a go but this might look horrible.