gcv / julia-snail

An Emacs development environment for Julia
GNU General Public License v3.0
230 stars 21 forks source link

how do I start julia-snail with some options #37

Closed nesteiner closed 3 years ago

nesteiner commented 3 years ago

I have to say, julia-snail is much better than julia-repl, but my project uses some big images, I need to load them quickly, how can I start julia-snail with some options??

gcv commented 3 years ago

Can you give me some examples of what you have in mind? Like command-line arguments to the julia binary?

nesteiner commented 3 years ago

here you are @gcv julia --sysimage image-path

nesteiner commented 3 years ago

hello??

gcv commented 3 years ago

Hello!

Feature added: https://github.com/gcv/julia-snail/commit/93099ac890a1df3bb779dbd308c9208f6eb73411

It's now available in MELPA. Let me know how it goes.

nesteiner commented 3 years ago

eh, sorry, I fail to install it I am sure I copy your source code, and use package-install-file but when runing, it throws

Process vterm exited abnormally with code 1
ERROR: could not open file /home/steiner/.emacs.d/elpa/julia-snail-2020081
0.1941/JuliaSnail.jl
gcv commented 3 years ago

Did you restart Emacs after installing the update?

nesteiner commented 3 years ago

yes

gcv commented 3 years ago

Sounds like your update is not fully installed. Delete the /home/steiner/.emacs.d/elpa/julia-snail-20200810.1941 directory. Restart Emacs. Run M-x list-packages to force a refresh of the package archives. Reinstall julia-snail using either use-package or (package-install 'julia-snail) or from the list-packages interface.

nesteiner commented 3 years ago

ok, I fix it, but I found precompile package is still slow, where should I create .dir-local.el, I create it on current project directory

julia> @time using MLJ
 11.185300 seconds (28.34 M allocations: 1.420 GiB, 5.35% gc time)
gcv commented 3 years ago

It’s .dir-locals.el (s at the end). In current project directory is correct. Make sure you start julia-snail while visiting a file in the project. Double check that the value of the variable is set while visiting a file in the project, M-: julia-snail-extra-args.

If all that checks out, double check that your image works and produces the expected speed up.

nesteiner commented 3 years ago

I have a bad message for you, 2020-08-11 15-06-16 的屏幕截图 when run M-: julia-snail-extra-args, the args is still nil

nesteiner commented 3 years ago

have you every try julia-snail with sysimage option? can you test with this, here is image

using PackageCompiler
create_sysimage([:MLJ, :Plots, :DataFrames, :RDatasets], sysimage_path = "/home/steiner/julia-images/MLJ.so", precompile_execution_file = "/home/stein
er/julia-images/precompile_mlj.jl")

here is precompile-mlj.jl

shell> cat ~/julia-images/precompile_mlj.jl
import MLJ
import Plots
import DataFrames
import RDatasets
orialb commented 3 years ago

passing extra arguments works for me, e.g. putting

((julia-mode . ((julia-snail-extra-args . ("--project=/PATH/TO/SOME/FOLDER")))))

In the .dir-locals.el file starts Julia with the environment at /PATH/TO/SOME/FOLDER/ activated.

Did you make sure to kill and re-open the tuning.jl buffer after updating the .dir-locals.el (since you wrote that julia-snail-extra-args is nil I suspect maybe you didn't)? I think the variables are only read from the .dir-locals.el upon buffer creation (actually I couldn't find it explicitly stated in the manual, but this is the behavior I see).

gcv commented 3 years ago

I agree with @orialb, it sounds like you're having trouble with .dir-locals.el. Here's the relevant section of the manual: https://www.gnu.org/software/emacs/manual/html_node/emacs/Directory-Variables.html

If you can't get directory local variables to work, try setting the value globally: M-: (setq julia-snail-extra-args "--sysimage /path/to/image").

nesteiner commented 3 years ago

@gcv thank you all for this wonderful project, I think I have better to set args globally thank you for your so much time

nesteiner commented 2 years ago

@gcv hey, I found that set the julia-snail-extra-args only works when set dir local variable, but not global setting

(use-package julia-snail
  :ensure t
  :requires vterm
  :hook (julia-mode . julia-snail-mode)
  :config
  (setq julia-snail-extra-args "--sysimage /home/steiner/.julia-images/julia-dev.so"))

(provide 'init-julia)

this is my global setting for julia-snail, but 2021-08-04 19-24-52 的屏幕截图

gcv commented 2 years ago

I might have made some changes in the way that variable is declared. Try using setq-default instead and let me know if it works.

nesteiner commented 2 years ago

oh, shit, I am too careless, I forgot setq-default. thanks for your help