Coder Social home page Coder Social logo

julia-repl's Introduction

julia-repl: run an inferior Julia REPL in Emacs

MELPA build

This is a minor mode for interacting with a Julia REPL running inside Emacs. The julia process is started in an ANSI terminal (term), which allows text formatting and colors, and interaction with the help system and the debugger.

It is recommended that you use this minor mode with julia-mode.

screenshot

Installation and loading

Please make sure you have at least Emacs 25. The term code changed a bit since Emacs 24, and the package does not support that and earlier versions. For example, Ubuntu has had Emacs 25 since 18.04LTS.

Place this in your Emacs initialization files (eg .emacs):

(add-to-list 'load-path path-to-julia-repl)
(require 'julia-repl)
(add-hook 'julia-mode-hook 'julia-repl-mode) ;; always use minor mode

If you want to use a Julia executable other than julia in your path, see below.

If you are experiencing problems with Unicode characters in the Julia REPL, try setting the relevant coding/language environment, eg

(set-language-environment "UTF-8")

Usage

M-x julia-repl, or C-c C-z from a buffer in which the julia-repl minor mode is active starts a new inferior Julia process. The keys below can be used to interact with this process.

key action
C-c C-a activate if there is a Project.toml in parent directories
C-u C-c C-a activate home project
C-c C-b send whole buffer to REPL (using include)
C-u C-c C-b send whole buffer to REPL (directly)
C-c C-c send region (when applicable) or line to REPL
C-c C-d invoke @doc on symbol
C-c C-e invoke @edit on region (when applicable) or line
C-c C-l list methods of a function
C-c C-m expand macro
C-c C-p change directory to that of the buffer
C-c C-s prompt for buffer name suffix
C-c C-t send whole buffer to REPL (using Revise.includet)
C-c C-v prompt for Julia executable
C-c C-z raise the REPL or create a new one (or switch back from REPL – only in vterm backend)
C-RET send line to REPL (without bracketed paste)

All actions that send something to the REPL terminate with a newline, triggering evaluation. If you want to avoid sending a newline (eg maybe because you want to edit an expression), use prefix arguments (C-- or C-u, currently both have the same effect). This of course does not apply to C-c C-b.

All commands send code using bracketed paste. When Julia is waiting for input, control characters like ^[[200~ may show up in your buffer, this is innocuous. If you input takes a long time to evaluate, you can step through it line-by-line with C-RET.

Options for this package are exposed via the customize interface (M-x customize-group julia).

Environment variables

You can set environment variables directly from your init.el in Emacs, eg

(setenv "JULIA_NUM_THREADS" "4")

Buffer-local inferior REPL and Julia executable

The minor mode allows the user to select a particular Julia executable and optionally a different inferior buffer for each source code buffer. This allows running two versions (eg stable and master) of Julia simultaneously, and/or running multiple inferior REPLs of the same Julia version. A typical use case is trying out something quickly, without changing the state of the current process.

Julia executables

Set julia-repl-executable-records to a list of keys and executables. For example,

(setq julia-repl-executable-records
      '((default "julia")                  ; in the executable path
        (master "~/src/julia-git/julia"))) ; compiled from the repository

provides two executables. The first entry is always the default (it can have any other key).

Use C-c C-v to select one of these (julia-repl-prompt-executable). You can also set the value of julia-repl-executable-key directly to a key in the julia-repl-executable-records, eg using file variables, but make sure you select a correct value.

The name of the inferior buffer will reflect your choice: the default is *julia* (indicator omitted), while the master executable would map to *julia-master*, and so on.

Executable suffix

You can also set a suffix for the inferior buffer, if you want multiple ones in parallel. This can be a number, which will show up as <number>, or a symbol, which appears as -symbol.

It is recommended that you use C-c C-s (julia-repl-prompt-inferior-buffer-name-suffix), which prompts for a string by default. Prefix arguments modify it like this:

  • numerical prefixes select that integer: eg C-3 C-c C-s set the suffix to 3.

  • the negative prefix picks the next unused integer: eg C- C-c C-s sets the suffix to 4 if 1, 2, 3 are in use.

Switches

Switches to the julia process can be provided in the global variable julia-repl-switches, for example

(setq julia-repl-switches "-p 4")

The function julia-repl-prompt-switches will prompt for new switches, you can bind it to a key.

File local variables

If you are using the same settings for a specific file, consider using file variables. For example, if you use add-file-local-variable to create a block at the end of the Julia source file similar to

# Local Variables:
# julia-repl-executable-key: master
# julia-repl-inferior-buffer-name-suffix: tests
# julia-repl-switches: "-p 4"
# End:

then the next time you open a REPL, it will have the name *julia-master-tests*, and 4 worker processes.

Terminal backends

julia-repl can use the terminal in different ways.

The default is ansi-term, which is included in Emacs, but it is recommended that you use vterm via emacs-libvterm (it is not the default since you need to install an extra package and the binary).

You can also use eat as a backend.

Some hints on interacting with term

Note some keybindings for term:

  1. C-x C-j switches to line mode, where you can kill/yank, move around the buffer, use standard Emacs keybindings,
  2. C-c C-k switches back to char mode,
  3. for scrolling, use S-<prior> and S-<next>.

See the help of term for more.

Using vterm

vterm is now the recommended backend, but for now you have to enable it explicitly because dependencies need to be available. In the long run it is hoped that it will replace ansi-term as the default backend for this package, fixing many outstanding issues.

  1. Install emacs-libvterm and make sure you have a working installation (eg M-x vterm) should start a terminal

  2. Evaluate (julia-repl-set-terminal-backend 'vterm) in your config file after you load julia-repl, but before you use it (and of course vterm should be loaded at some point). Switching terminal backends with already running Julia processes is not supported.

  3. You may want to (setq vterm-kill-buffer-on-exit nil) to prevent the buffers associated with terminated Julia processes being killed automatically. This allows you to retain output and see error messages if the process does not start.

  4. You can also install EmacsVterm.jl package, which improves integration between Julia REPL and Emacs.

Using eat

Install eat and use (julia-repl-set-terminal-backend 'eat) in your config file.

Using the @edit macro

The @edit macro can be called with C-c C-e when the julia-repl-mode minor mode is enabled. The behavior depends on the value of the JULIA_EDITOR envoronment variable in the Julia session. The command julia-repl-set-julia-editor is provided to conveniently control this from emacs.

To use "emacsclient" as a default in each Julia REPL you open in emacs, add the following code to your ~/.julia/config/startup.jl:

if haskey(ENV, "INSIDE_EMACS")
    ENV["JULIA_EDITOR"] = "emacsclient"
end

If you cannot edit your startup.jl, you can configure the editor in each repl after starting it with:

(add-hook 'julia-repl-hook #'julia-repl-use-emacsclient)

More colors

Julia uses more colors than the ones supported by term by default. To get the full range of colors, use eterm-256color, available from MELPA.

Note for Windows users

ansi-term is not supported on some (most?) Windows versions of Emacs. It has been confirmed to work with Emacs running in Cygwin. You can test whether your version works with M-x ansi-term; if this errors then this package will not work for you.

Cygwin may require some rewriting of paths for include to work. After loading this package, customize the rewrite rules as

(setq julia-repl-path-rewrite-rules julia-repl-cygwin-path-rewrite-rules)

as a reasonable default, or write custom rules for julia-repl-path-rewrites.

Limitations

See the issues.

Comparison to ESS

A well-known alternative is ESS, which also supports Julia. ESS is however based on comint, which does not allow a fully functioning terminal and therefore does not support the Julia REPL modes (shell, Pkg, debuggers...) and features. julia-repl is instead based on term, and so gets all the features from Julia's native REPL for free.

julia-repl's People

Contributors

antoine-levitt avatar antonydellavecchia avatar apatry avatar dellison avatar duzaichuan avatar isentropic avatar martenlienen avatar mauro3 avatar syohex avatar tpapp avatar wentasah avatar wilfred avatar wraith1995 avatar yashi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

julia-repl's Issues

ProgressMeter does not work properly

Produces:

julia> using ProgressMeter

julia> @showprogress for i=1:20
       sleep(0.5)
       end
Progress:   5%|█████                                                                                           |  ETA: 0:00:10Progress
:  10%|██████████                                                                                      |  ETA: 0:00:09Progress:  15%|█
█████████████                                                                                  |  ETA: 0:00:09Progress:  20%|█████████
██████████                                                                             |  ETA: 0:00:08Progress:  25%|█████████████████
███████                                                                        |  ETA: 0:00:08Progress:  30%|█████████████████████████
████                                                                   |  ETA: 0:00:07Progress:  35%|█████████████████████████████████
█                                                              |  ETA: 0:00:07Progress:  40%|██████████████████████████████████████   
                                                       |  ETA: 0:00:06Progress:  45%|███████████████████████████████████████████      
                                               |  ETA: 0:00:06Progress:  50%|████████████████████████████████████████████████         
                                       |  ETA: 0:00:05Progress:  55%|█████████████████████████████████████████████████████            
                               |  ETA: 0:00:05Progress:  60%|██████████████████████████████████████████████████████████               
                       |  ETA: 0:00:04Progress:  65%|██████████████████████████████████████████████████████████████                   
               |  ETA: 0:00:04Progress:  70%|███████████████████████████████████████████████████████████████████                      
       |  ETA: 0:00:03Progress:  75%|████████████████████████████████████████████████████████████████████████                        |
  ETA: 0:00:03Progress:  80%|█████████████████████████████████████████████████████████████████████████████                   |  ETA: 0
:00:02Progress:  85%|██████████████████████████████████████████████████████████████████████████████████              |  ETA: 0:00:02Pr
ogress:  90%|██████████████████████████████████████████████████████████████████████████████████████          |  ETA: 0:00:01Progress: 
 95%|███████████████████████████████████████████████████████████████████████████████████████████     |  ETA: 0:00:01Progress: 100%|███
█████████████████████████████████████████████████████████████████████████████████████████████| Time: 0:00:10

julia> 

I suspect that this is an issue of the underlying Emacs-terminal. Feel free to close as wont-fix.

"wrong type argument listp key" when calling "julia-repl"

Hi,
I installed the package via spacemacs julia layer so I'm not sure if the issue is related specifically to spacemacs or not. If this is the wrong place to report an issue when using the spacemacs layer let me know.

after installing, when running julia-repl command I got "wrong type argument listp key" error.
I found a workaround so just wanted to report this in case anyone else encounters it.

The error was caused by the following function in julia-repl.el:

(defun julia-repl--default-executable-key ()
  "Return the default executable key."
  (let ((key (caar julia-repl-executable-records)))
    (assert key "Could not find any key in JULIA-REPL-EXECUTABLE-RECORDS.")
    key))

the problem seems to be with the assert statement. My workaround was to comment out the assertion and then everything worked just fine.

(let ((key (caar julia-repl-executable-records)))
    ;;(assert key "Could not find any key in JULIA-REPL-EXECUTABLE-RECORDS.")
    key))

not sure why is it causing problems.

  1. Emacs version: GNU emacs 25.3.1 (with spacemacs develop branch)
  2. Julia version: 0.6.4
  3. version of julia-repl: from spacemacs layer julia
  4. self-contained steps to replicate the issue:
  • install julia spacemacs layer
  • run julia-repl command

No function s-trim

Bug happens in julia-repl--send-string. I believe the cause is that the s library is missing as a dependency.

defcustom & buffer local

Use something like

(defcustom var ...)
(make-variable-buffer-local 'var)

for API-exposed buffer local variables. Also cleanup said variables.

Error during redisplay: (jit-lock-function 8) signaled (invalid-regexp "Unmatched ) or \\)")

Thank you for all the time and effort you have put into making this package available.
Unfortunately I've hit an issue with launching the Julia REPL.

Possibly related to issue #24

Details follow.

  1. the Emacs version (M-x emacs-version [RET], will also appear in the buffer *Messages*),

GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.18.9) of 2018-05-29

  1. the Julia version (VERSION)

v1.0.2

  1. the version of julia-repl (something like “latest master” is fine).

This version information is quite obscure to discover - hints or tips appreciated

  1. self-contained steps to replicate the issue.

SPC-m-r

The logo scrolls up until the following prompt is at the top of the buffer displayed:

julia> 
 sleep\ 604800\ \&\ sleep\=\$\!\;\ trap\ \"kill\ \$sleep\;\ exit\ 0\"\ USR1\;\ trap\ \"kill\ \$sleep\;\ exit\ 1\"\ USR2\;\ wait\ \$sleep\'
 sleep\ 604800\ \&\ sleep\=\$\!\;\ trap\ \"kill\ \$sleep\;\ exit\ 0\"\ USR1\;\ trap\ \"kill\ \$sleep\;\ exit\ 1\"\ USR2\;\ wait\ \$sleep\'
 sleep\ 604800\ \&\ sleep\=\$\!\;\ trap\ \"kill\ \$sleep\;\ exit\ 0\"\ USR1\;\ trap\ \"kill\ \$sleep\;\ exit\ 1\"\ USR2\;\ wait\ \$sleep\
 sleep\ 604800\ \&\ sleep\=\$\!\;\ trap\ \"kill\ \$sleep\;\ exit\ 0\"\ USR1\;\ trap\ \"kill\ \$sleep\;\ exit\ 1\"\ USR2\;\ wait\ \$sleep
 sleep\ 604800\ \&\ sleep\=\$\!\;\ trap\ \"kill\ \$sleep\;\ exit\ 0\"\ USR1\;\ trap\ \"kill\ \$sleep\;\ exit\ 1\"\ USR2\;\ wait\ \$slee
 sleep\ 604800\ \&\ sleep\=\$\!\;\ trap\ \"kill\ \$sleep\;\ exit\ 0\"\ USR1\;\ trap\ \"kill\ \$sleep\;\ exit\ 1\"\ USR2\;\ wait\ \$sle
 sleep\ 604800\ \&\ sleep\=\$\!\;\ trap\ \"kill\ \$sleep\;\ exit\ 0\"\ USR1\;\ trap\ \"kill\ \$sleep\;\ exit\ 1\"\ USR2\;\ wait\ \$sl

etc.
etc.

In Messages buffer:

Error during redisplay: (jit-lock-function 8) signaled (invalid-regexp "Unmatched ) or \\)")
Error during redisplay: (jit-lock-function 1) signaled (invalid-regexp "Unmatched ) or \\)")
Error during redisplay: (jit-lock-function 229) signaled (invalid-regexp "Unmatched ) or \\)")
Error during redisplay: (jit-lock-function 43) signaled (invalid-regexp "Unmatched ) or \\)")
Error during redisplay: (jit-lock-function 1) signaled (invalid-regexp "Unmatched ) or \\)")
Error during redisplay: (jit-lock-function 8) signaled (invalid-regexp "Unmatched ) or \\)") [2 times]

Go to definition (M-.)

Thank you for this package! Is there something like M-. (aka go-to-defintion) in this package? I find that C-c C-e is not too useful when editing module code, because of course, the arguments can't be evaluated.

Copying from the *julia*

Copying text in the julia buffer is not successful. For instance, there is a message in the buffer to install a package. I try to copy import Pkg; Pkg.add("Revise") but no go.
I use the latest julia-repl and cygwin Emacs 26.

Consider defining a subtype of Base.REPL.AbstractREPL and running that inside of comint instead of (ab)using ansi-term

I have no idea about the difficultly level here and am definitely not volunteering to do it myself necessarily, but the less hacky way of solving the problems with ESS would be to do this instead of abandoning comint entirely.

Since julia itself already includes two REPLs, it shouldn't be impossible to include only the features that are compatible with comint from LineEditREPL without losing access to the niceties needed for things like using Gallium. Once the <:AbstractREPL was written, all that would need to be done would be to swap out the existing REPL for our shiny new one using this function here during startup, and we'd be golden. All the niceties of julia-repl without any of the funkiness.

Posting this here as an issue as a sort of long-term wishlist or to get any criticism that exists on the idea. This might even make more sense within ESS than as an alteration of julia-repl.

evaluate inside a module

When the cursor is inside a module, eg

module Foo

# here

end

send an eval with the relevant module to the REPL.

The key functionality would be a julia-repl--module-at-point function, which would return the relevant module. Should handle submodules, and possibly module information that is not provided in the file (eg specified as a local variable).

More colors

It would be good to have more colors. For instance @code_warntype does not show any red code.

I did some digging atomontage/xterm-color#2, see also link in the last comment.

Multiple Julia prompt (again)

I am running Emacs 25.3.2 on Ubuntu 16.04.4 and am getting the issue reported in this closed issue. Julia version is 0.5.2. Version of julia-repl is latest on master branch.
I open a new file "junk.jl", type a number (say 42) and hit control-return to evaluate and the repl appears with the multiple prompts.

*julia* buffer breaks key bindings in *terminal* buffer

  1. Emacs version: GNU Emacs 26.3 (build 1, x86_64-apple-darwin16.7.0, Carbon Version 157 AppKit 1504.83) of 2019-09-07
  2. Julia version: 1.2.0 (2019-08-20)
  3. julia-repl version: 20190908.1717

Steps to reproduce:

  1. Fire up Emacs.
  2. Run M-x term with e.g. /bin/bash in it.
  3. Produce some output with e.g. ls -al ~.
  4. Switch to line mode with C-c C-j.
  5. Observe that moving up/down through the output produced in (3) works as expected (with up/down arrows or C-p/C-n).
  6. Go back to char mode with C-c C-k.
  7. Run julia-repl with C-c M-x julia-repl.
  8. Switch back to *terminal* buffer created in (2).
  9. Observe that switching to line mode with C-c C-j doesn't work anymore (C-c C-j is undefined).

The above also happens when *terminal* buffer is created after *julia* buffer.

working directory

When

  1. starting a new inferior Julia process,
  2. and the current buffer is a julia file,

use the directory of that file as the working directory.

cf this discussion

CL function use without explicit (REQUIRE 'CL)

The function definitions for first, second, incf and stable-sort are void unless (require 'cl) is used.

The CL package is loaded by Julia-mode, but when it is not used, the REPL does not start.

julia-repl-mode fails oddly in buffers with "false" buffer-file-name

See discussion at syl20bnr/spacemacs#11314.

I think this bit of code:

(when-let ((filename (buffer-file-name)))
doesn't properly account for buffers not associated with any file, but I could be barking up the wrong tree there since this is my first encounter with when-let, so it's taking me a bit to grok the implications.

Problem reproduces by invoking julia-repl-mode in a *scratch* buffer.

auto-loading julia-repl

For those who are interested in keeping their emacs startup time down, you might want to mention:

If you are using the emacs package manager (say via (require 'package) in your init.el), then putting

(use-package julia-repl
  :commands julia-repl julia-repl-mode
  :config (load-library "julia-mode"))

in your init.el will delay loading julia-repl until it is needed.

Set environmental variables for started process

I just noticed, that the REPL started using julia-repl does not seem to use the environmental variables set in .bashrc

Specifically I am setting export JULIA_NUM_THREADS=4, but in the REPL started from Emacs Threads.nthreads() still reports 1 (It does work when starting the Julia REPL directly from the Terminal)

Any solution for this?

Evaluate whole buffer with `include`

It would be great if a buffer, at least when it corresponds to a file, would be evaluated with an include. Otherwise, the REPL history gets cluttered with lots of stuff and I get dizzy from all the stuff scrolling past.

Last, if there is an error it would be clear as it does not get burried.

julia-repl does not launch in Windows 7

I don't seem to get this work with Windows. M-x julia-repl produces an error message: Spawning child process: Invalid argument. A Julia buffer will open (not visibly, but you will find it in buffer list), but it is totally empty.

I have also tried to use ess and julia-shell in Windows without much success.

Emacs version is 25.3.1 and Julia version is 0.6.2. I have the latest master of julia-repl.

I attached my .emacs as emacs.txt.
emacs.txt

Cheers!

Make `julia-repl-executable-records` customizable

When reporting an issue, please provide

  1. the Emacs version (M-x emacs-version [RET], will also appear in the buffer *Messages*),

GNU Emacs 26.1 (build 1, x86_64-w64-mingw32) of 2018-05-30

  1. the Julia version (VERSION)

v"1.1.1"

  1. the version of julia-repl (something like “latest master” is fine).

MELPA 20190420.1455

  1. self-contained steps to replicate the issue.

Even with Julia on PATH, Emacs on Windows fails to start Julia with "Spawning child process: invalid argument". It looks like julia-repl--capture-basedir is failing to spawn Julia in the first place. I'd be happy enough to customize julia-repl-executable-records and point it directly to Julia, but that is defvar not defcustom. It would be nice if it was customizable.

Send code in cells

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.

C-a doesn't move to beginning of line in REPL

It is very useful to be able to go to start of line to fix a minor mistake one does not see before having finished the end of line. Unfortunately, the standard emacs shortcut for doing this is "stolen" by screen, which uses C-a as escape key. Because it doesn't seem important to use the screen escape key much in Julia REPL's in emacs, it would be good to change the escape key to something other than C-a.

Do not echo sent commands in Julia REPL

I'm a happy julia-repl user, thanks for the work! From time to time there is one feature I miss from ESS:

Currently every command that is sent, is echoed in the Julia REPL. If a large code region is sent, the julia buffer gets cluttered quickly. So I was wondering if an option exist to not show the commands, only the results.

In ESS this behaviour can be obtained by setting ess-eval-visibly to nil, see documentation here.

interrupt a running computation

Is it possible to interrupt a running computation? I tried C-c C-c (that is what works in ESS) and term-interrupt-subjob both did not work.

send long code line breaks?

When reporting an issue, please provide

  1. the Emacs version (M-x emacs-version [RET], will also appear in the buffer *Messages*),
    GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.18.9) of 2018-05-29

  2. the Julia version (VERSION)
    v1.1.0

  3. the version of julia-repl (something like “latest master” is fine).
    SPC-h-d-p:
    20190420.1455

  4. self-contained steps to replicate the issue.
    Following long with the Julia Academy course: "Introduction to Julia >> Plotting":
    C-c C-c for the following line:

globaltemperatures = [14.4, 14.5, 14.8, 15.2, 15.5, 15.8]

Shows in the Julia terminal buffer as:

julia> 
5.8]

It appears to be due to the line length. C-c C-c for the following line:

temperatures = [14.4, 14.5, 14.8, 15.2, 15.5, 15.8]

Shows as

julia> temperatures = [14.4, 14.5, 14.8, 15.2, 15.5, 15.8]
6-element Array{Float64,1}:
 14.4
 14.5
 14.8
 15.2
 15.5
 15.8

I've been able to reproduce this after starting a new Julia REPL (M-m, r).

drawing wrapped lines in REPL

When typing in the REPL, as soon as the line wraps around, it starts "gobbling up" lines above. Every time I type another character, it re-prints everything on the wrapped part on a new line, instead of re-writing the wrapped part:

screenshot from 2018-01-26 12-32-14

This is with:

  • Julia 0.6.2
  • julia-repl from melpa (20171116.46)
  • GNU Emacs 25.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.26) of 2017-12-04

Create minor mode for julia-repl

If a buffer gets created by e.g. julia-repl-send-line, that buffer doesn't have the julia-repl-mode minor mode defined here. Is that an oversight, or am I misunderstanding how emacs minor modes should work (very possible; I'm still quite emacs noobish)?

Deleting characters not working while in a readline() enviroment

  1. Emacs version 26.1

  2. Julia version 0.6.1

  3. julia-repl version (MELPA) Package-Version: 20171116.46
    Version: 0.0.1

  4. self-contained steps to replicate the issue:

julia> readline()

then type some characters, mess up and try to delete them with the backspace key. This causes "^?" to be inserted into the string instead of deleting a character.

background color in REPL doesn't match editor color theme

First of all thanks a lot for making this package!
I am encountering an issue with the color theme of the julia REPL, where the text background color doesn't match that of the color theme. I am using "zenburn" but it seems to be the behavior with all themes I was trying.
Any idea how can I fix the background color?
It's of course not such a big deal and I can live with it in case it is for some reason not possible.

Here is how it looks like now:
image

  1. Emacs version: GNU emacs 25.3.1 (with spacemacs develop branch)
  2. Julia version: 0.6.4
  3. version of julia-repl: from spacemacs layer julia
  4. self-contained steps to replicate the issue:
  • install julia-repl via spacemacs "julia" layer (but I don't think it's related to spacemacs).
  • use color theme with black background (e.g. zenburn)

Thanks!

Multiple julia prompt

First of all, nice job!

When running julia-repl in Emacs 24.5.1 I have the following problem:

screenshot_20161103_173307

The prompt appears twice, and deleting characters is even worse: every time you delete a character, the prompt pops out again, it's quite annoying. No problem in Emacs 25.1, maybe something changed in term mode, I'm not familiar with it.

I don't know if you're willing to fix this, I opened this ticket as reference for other people running into the same problem.

edit: edit in emacs

When reporting an issue, please provide
in

  1. the Emacs version (M-x emacs-version [RET], will also appear in the buffer *Messages*),
    GNU Emacs 25.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.26) of 2018-01-07

  2. the Julia version (VERSION)
    v"0.6.0"

  3. the version of julia-repl (something like “latest master” is fine).
    julia-repl-20171116.46

  4. self-contained steps to replicate the issue.
    press C-c c-e (julia-repl-edit) in a julia buffer. nano shows up inside emacs.
    Expected behaviour: opens an emacs buffer

the JULIA_EDITOR might be set in order to override the editor.

Another way would be to import Base.edit and override it maybe

Issue switching to line term mode, then using hippie-expand

  • GNU Emacs 26.1.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.18.9) of 2018-07-23
  • Julia v1.0.2
  • julia-repl 20180910.841

Reproduction steps:

Start a new REPL, which starts in char term mode. Then, write a partial line like wri. Now, switch to line term mode with C-x C-j. Now run hippie-expand to complete the line (completes to write for me).

Even though the terminal shows write, if I now hit RET, the partial command wri is sent and I get:

julia> wri
ERROR: UndefVarError: wri not defined

hippie-expand on lines that started off in line term mode works fine.

Minor issue, but thought I'd document it here.

evaluate function

Add the following functionality: when inside a function, select the whole body of the function and send it to the REPL, Similarly to C-c C-c in ESS. Should work with embedded functions.

function foo()
    function bar()
        # cursor here
    end
end

should send function foo() ... end.

Possibly the same machinery that is used for indentation in julia-mode can be used for selecting the relevant block.

julia-repl-send-buffer prints latest executed expression

Executing julia-repl-send-buffer (via C-c C-b) runs "include(file)" which returns the last evaluated expression (see docs: https://docs.julialang.org/en/v1/base/base/#Base.include) - in many cases, this clutters the REPL. Would it not be better to run "include(file);" instead, suppressing the output with a semicolon?

Replicating the issue (Emacs 26.2, Julia 1.2.0, latest julia-repl):
Save the following text in a julia buffer

a = "Hello World"
b = "foo";

C-c C-b to execute the buffer prints "foo" to the REPL (expected would be no output)

function to send a page of code

Send code between page markers (^L) to the REPL. Should be trivial (see mark-page), but depends on #18, otherwise it would clutter the REPL buffer too much.

Is it possible to call a remote julia REPL via TRAMP?

Hi!

I'm not sure if this is supported but I think it is not.
I would like to have the option to call a remote julia via TRAMP (or not), something like:

(setq julia-repl-executable-records
      '((default "julia")                  ; in the executable path
        (master "/ssh:remotehost:~/bin/julia"))) ; in the remote host.

Is this possible? Super hard to implement?

sending code to repl via include

There should be an option for sending code longer than some threshold (eg 10 lines) sent by include. Eg by evaluating an expression

julia> include("/tmp/xyz.jl") # code from buffer.jl, lines 14:30

The temporary file could be buffer-specific and permanent.

Special repl modes and sending code

When in any special repl mode, such as shell, pkg, etc. sending code to the repl does not make sense. I propose to simply snap out of the special mode, as this is usually what you want.

buffer-specific repl

Allow each Julia source buffer to have its own REPL (defaulting to a common one).

Sending "mean_μ = 0" to OhMyREPL with C-c C-c causes it to error

julia> mean_μ = nothing (sent by C-c C-c, not typed)

julia> ┌ Error: Error in the keymap
│ exception =
│ StringIndexError("mean_μ = 0\n", 7)
│ Stacktrace:
│ [1] (::getfield(OhMyREPL.Prompt, Symbol("##25#51")))(::Any, ::Any, ::Any) at /home/dale/.julia/packages/OhMyREPL/GFHgr/src/repl.jl:189
│ [2] #invokelatest#1 at ./essentials.jl:742 [inlined]
│ [3] invokelatest at ./essentials.jl:741 [inlined]
│ [4] (::getfield(REPL.LineEdit, Symbol("##27#28")){getfield(OhMyREPL.Prompt, Symbol("##25#51")),String})(::Any, ::Any) at /build/julia/src/julia-1.1.0/usr/share/julia/stdlib/v1.1/REPL/src/LineEdit.jl:1324
└ @ REPL.LineEdit /build/julia/src/julia-1.1.0/usr/share/julia/stdlib/v1.1/REPL/src/LineEdit.jl:2367
julia>

The error is related to the "mu" character; removing it works ok.
Maybe somebody is not expecting unicode?

Emacs 26.2
Julia 1.1.0
julia-repl-20190124.1059

Supply namespace information to autocompletion provider?

One idea that came up in a discussion on Slack regarding emacs autocompletion in julia-mode is that it's hard (from what I understand) to get autocompletion for Julia that knows about user-defined types, variables, functions, etc. It was suggested to me that one possible solution would be to have julia-repl query the running repl to find a list of defined names in the running Julia session and then that list of names can be sent to company-mode for autocompletion. Is this something that is possible with the current architecture of julia-repl?

If so, how difficult would it be to implement?

Is there perhaps a different better way to get smart juno-style autocompletion in emacs for Julia that I don't know about?

unrecognized location

┌ Error: omitting file /home/tamas/code/julia/FunctionalTables/src/tables.jl due to parsing error near line 73
└ @ Revise /home/tamas/.julia/packages/Revise/TmjcT/src/parsing.jl:55
Base.Meta.ParseError("missing comma or } in argument list")
NamedTuple{(:A, :b),Tuple{Int64,Int64}}

cf timholy/Revise.jl#179

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.