tpapp / julia-repl

Run an inferior Julia REPL in a terminal inside Emacs
Other
169 stars 35 forks source link

Send block #114

Open jtrakk opened 2 years ago

jtrakk commented 2 years ago
Emacs 27.2
Julia 1.6.1
julia-repl-20210408.639

I want to execute a multiline code block:

[1,2,3] |>
maximum

C-c C-c is julia-repl-send-region-or-line which only sends the line by default. vscode-julia sends the whole block. Would it be possible to have that in emacs too?

wentasah commented 2 years ago

I personally use the following function:

  (defun julia-send-paragraph ()
    (interactive)
    (save-mark-and-excursion
      (mark-paragraph)
      (julia-repl-send-region-or-line)))

It behaves differently than VS Code, because the block must be delimited by empty lines and AFAIK VS Code automatically recognizes multi-line expressions without extra delimiters. But for me, it's sufficient most of the time.

jtrakk commented 2 years ago

That may be an improvement, thanks. As you note, sometimes paragraph is too small, e.g. if there are blank lines in the block, and sometimes too large, e.g. if there are multiple independent blocks without blank lines between them.

It looks like LanguageServer uses julia/getCurrentBlockRange.