[ANN] julia-repl, an Emacs minor mode for running a Julia REPL

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[ANN] julia-repl, an Emacs minor mode for running a Julia REPL

Tamas Papp
Hi Julia & Emacs users,

I wrote a minor mode for starting and interacting with a Julia REPL from
Emacs. It basically uses term, and defers to the Julia REPL for almost
everything. The main reason for using this instead of ESS is that some
packages, in particular Gallium and ASTinterpreter, require a more
capable terminal. You get completion and other extras of the Julia REPL
for free.

You can find it at

https://github.com/tpapp/julia-repl

If there is interest, I would be happy to submit it to MELPA, just file
an issue.

Best,

Tamas Papp
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] julia-repl, an Emacs minor mode for running a Julia REPL

David van Leeuwen
Hi, 

On Wednesday, November 2, 2016 at 2:51:54 PM UTC+1, Tamas Papp wrote:
Hi Julia & Emacs users,

I wrote a minor mode for starting and interacting with a Julia REPL from
Emacs. It basically uses term, and defers to the Julia REPL for almost
everything. The main reason for using this instead of ESS is that some
packages, in particular Gallium and ASTinterpreter, require a more
capable terminal. You get completion and other extras of the Julia REPL
for free.

Thanks, 
 
I'd be interested to know what the supposed workflow for $interpretor-in-$editor is.  (This may be more general than emacs julia-repl)

I've tried Julia, R in Atom, Emacs, and I don't seem to be able to work with it.  In the Julia / R / bash / ipython / ... the up-arrow is my friend.  That is how I quickly find and repeat/edit/... a previous command.  It appears to me that the first thing that an interpretor-in-editor does is hijack the up-arrow, and make this move the cursor around in the buffer.  (I suppose I cannot really blame the editor, that is what it normally does with up-arrow and friends).  

So I figure there must be a different workflow than I am used to (edit file--switch to repl--include("file")--run function).  What is that workflow?

Cheers, 

---david 
 
You can find it at

<a href="https://github.com/tpapp/julia-repl" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Ftpapp%2Fjulia-repl\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNH9QK1H5ccT1n6lLYp_U7uuQNTk2Q&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Ftpapp%2Fjulia-repl\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNH9QK1H5ccT1n6lLYp_U7uuQNTk2Q&#39;;return true;">https://github.com/tpapp/julia-repl

If there is interest, I would be happy to submit it to MELPA, just file
an issue.

Best,

Tamas Papp
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] julia-repl, an Emacs minor mode for running a Julia REPL

Tamas Papp
On Wed, Nov 02 2016, David van Leeuwen wrote:

> I'd be interested to know what the supposed workflow for
> $interpretor-in-$editor is.  (This may be more general than emacs
> julia-repl)
>
> I've tried Julia, R in Atom, Emacs, and I don't seem to be able to work
> with it.  In the Julia / R / bash / ipython / ... the up-arrow is my
> friend.  That is how I quickly find and repeat/edit/... a previous command.
>  It appears to me that the first thing that an interpretor-in-editor does
> is hijack the up-arrow, and make this move the cursor around in the buffer.
>  (I suppose I cannot really blame the editor, that is what it normally does
> with up-arrow and friends).
>
> So I figure there must be a different workflow than I am used to (edit
> file--switch to repl--include("file")--run function).  What is that
> workflow?

In general Emacs term has two modes, line and char mode. Char mode does
not capture the arrow keys. Line mode does, so you can move around the
buffer as usual. julia-repl starts in char mode by default, and you can
switch between the two modes -- see the README.

Basically, I wrote julia-repl because did not want Emacs to capture
parts of the input and output (like ESS does). Among other things, arrow
keys just work, even in the partial match mode (when you have typed
something and want to cycle through matches).

Happy to include new features, just ask here or open an issue.

Best,

Tamas
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] julia-repl, an Emacs minor mode for running a Julia REPL

Angel de Vicente
In reply to this post by Tamas Papp
Hi,

Tamas Papp <[hidden email]> writes:
> Hi Julia & Emacs users,

I'm one of those :-)

> I wrote a minor mode for starting and interacting with a Julia REPL from
> Emacs. It basically uses term, and defers to the Julia REPL for almost
> everything. The main reason for using this instead of ESS is that some
> packages, in particular Gallium and ASTinterpreter, require a more
> capable terminal. You get completion and other extras of the Julia REPL
> for free.

when I have time I will try it, but just curious to know what julia-repl
will give me than I cannot do now. My setting involves running an
ansi-term inside Emacs, then running a screen session in it, and then
starting julia. I have a nice REPL environment there, with
auto-completion, arrow keys, reverse search, etc. plus being able to
change from line mode to char mode when I want to copy-paste stuff
from/to other buffers.

What I miss from the ansi-term is that I cannot keep the whole
interaction in the buffer, which I grew accustomed to rely on when
running a regular shell inside Emacs. To illustrate, when running
something that generates a lot of output inside ansi-term, this gets
truncated, as you can see below, where the output starts with
-----0.1-----, etc., but most of the output is gone and only the last
parts remain (so I end up having a regular shell for long outputs and an
ansi-term for nice REPL interaction, but obviously it is not ideal). If
julia-repl solves that I'll buy it. :-)

,----
|     •    Powerful. Do more with less. Complex visualizations become easy.
|      
|     •    Intuitive. Stop reading so much documentation. Commands should "just work".
|      
| [3.18637,-9.2635,4.9458]
| [13.3777,3.68877,-17.3378]
| -----------------------------
| ------------9.6-----------------
| [0.989822,2.2296,0.101944]
| [0.654825,-0.0280955,3.54596]
| [-3.3894,18.8551,-15.2289]
| [9.50161,16.0473,-15.8163]
| [-1.53928,3.43175,5.02399]
| [11.1929,-10.6255,0.369727]
| [18.9342,13.1419,-10.4816]
| [0.790022,1.74249,0.842619]
| [3.22621,-9.36619,5.00161]
| [13.5345,3.73192,-17.5406]
| -----------------------------
`----

Cheers,
--
Ángel de Vicente
http://www.iac.es/galeria/angelv/         
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] julia-repl, an Emacs minor mode for running a Julia REPL

Tamas Papp
On Wed, Nov 02 2016, Angel de Vicente wrote:

> Hi,
>
> Tamas Papp <[hidden email]> writes:
>> Hi Julia & Emacs users,
>
> I'm one of those :-)
>
>> I wrote a minor mode for starting and interacting with a Julia REPL from
>> Emacs. It basically uses term, and defers to the Julia REPL for almost
>> everything. The main reason for using this instead of ESS is that some
>> packages, in particular Gallium and ASTinterpreter, require a more
>> capable terminal. You get completion and other extras of the Julia REPL
>> for free.
>
> when I have time I will try it, but just curious to know what julia-repl
> will give me than I cannot do now. My setting involves running an
> ansi-term inside Emacs, then running a screen session in it, and then
> starting julia. I have a nice REPL environment there, with

Not much: julia-repl is only a few LOC. There is functionality to find
an already running REPL, and raise it, or failing that, create one (C-c
C-z), and pulling up docs on the current symbol, etc. But again, it is
just a thin layer on ansi-term, I wrote it up to fix issue #1 in
julia-emacs, because I did not see anything packaged, just basic code
snippets floating around. I think that something one can (eventually)
install from MELPA would be better in the long run.

> What I miss from the ansi-term is that I cannot keep the whole
> interaction in the buffer, which I grew accustomed to rely on when
> running a regular shell inside Emacs. To illustrate, when running
> something that generates a lot of output inside ansi-term, this gets
> truncated, as you can see below, where the output starts with
> -----0.1-----, etc., but most of the output is gone and only the last
> parts remain (so I end up having a regular shell for long outputs and an
> ansi-term for nice REPL interaction, but obviously it is not ideal). If
> julia-repl solves that I'll buy it. :-)

julia-repl can either use screen or not. With screen, you cannot scroll
back beyond point. Without screen, you can --- I clarified it in the
README and made it the default -- thanks!

In any case, please submit issues, I am not an expert on packaging for
emacs, just wrote this to solve a problem.

Best,

Tamas
Reply | Threaded
Open this post in threaded view
|

Re: [ANN] julia-repl, an Emacs minor mode for running a Julia REPL

Angel de Vicente
Hi,

Tamas Papp <[hidden email]> writes:

>> What I miss from the ansi-term is that I cannot keep the whole
>> interaction in the buffer, which I grew accustomed to rely on when
>> running a regular shell inside Emacs. To illustrate, when running
>> something that generates a lot of output inside ansi-term, this gets
>> truncated, as you can see below, where the output starts with
>> -----0.1-----, etc., but most of the output is gone and only the last
>> parts remain (so I end up having a regular shell for long outputs and an
>> ansi-term for nice REPL interaction, but obviously it is not ideal). If
>> julia-repl solves that I'll buy it. :-)
>
> julia-repl can either use screen or not. With screen, you cannot scroll
> back beyond point. Without screen, you can --- I clarified it in the
> README and made it the default -- thanks!

Our exchange piqued my interest so I looked for how to do it from within
GNU screen. It turns out screen has options that will allow you to do it:

Inside the ansi-term and screen, if I want to scroll back:

- To see the buffer settings:         Ctrl-a i

- To increase the screen buffer size: Ctrl-a :   and then type scrollback 10000

- To scroll the buffer                Ctrl-a [   then scroll   and then ESC to
stop copy-mode

- To search                           Ctrl-a Ctrl-s (forward) Ctrl-r
(backwards). ESC to quit search mode and keep cursor in the place of search.

- To copy stuff while in copy mode:   SPC (mark begin)  SPC (mark end). Then to
copy it to another Emacs buffer ???

- Ctrl-a :  then hardcopy -h <filename> will write the whole buffer content to
<filename> which can then be used anywhere.


Cheers,
--
Ángel de Vicente
http://www.iac.es/galeria/angelv/