gcv / julia-snail

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

cannot autoload julia-snail #75

Closed nesteiner closed 2 years ago

nesteiner commented 2 years ago

maybe is the problem of my program ability on emacs-lisp, when I type this code, julia-snail can't autoload when loading a julia file

(use-package julia-mode
  :config
  (setq julia-repl-switches nil
    julia-snail-extra-args nil
    julia-indent-offset 2)
  :commands julia-snail-mode)

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

I remember that it was ok, after i use byte compile emacs-lisp file, it does not work since then

gcv commented 2 years ago

How large is the julia-snail.elc byte-compiled file? Sometimes the byte compiler does not compile the whole file. If it’s only a few hundred bytes, delete it, make sure vterm is fully loaded (M-x vterm), and recompile julia-snail.el.

nesteiner commented 2 years ago

still not work,
2022-01-30 21-14-02 的屏幕截图 does that work on your system ?

gcv commented 2 years ago

Is init-julia.el the file with your use-package forms? Please post the size of your julia-snail.el* files. Let’s first make sure the Snail installation is not broken.

nesteiner commented 2 years ago

2022-01-31 18-33-52 的屏幕截图

gcv commented 2 years ago

That's still an init-julia.el file. I'm asking for ls -la output of your Snail installation directory, not your configuration code.

nesteiner commented 2 years ago

here you are ![Uploading 2022-02-01 01-49-46 的屏幕截图.png…]()

gcv commented 2 years ago

There's nothing attached to your message.

nesteiner commented 2 years ago

2022-02-01 01-49-46 的屏幕截图

gcv commented 2 years ago

That's the installation directory. I want to see the files inside it, specifically the julia-snail.elc file.

nesteiner commented 2 years ago

2022-02-01 13-41-16 的屏幕截图

gcv commented 2 years ago

Your installation looks good.

Can you post the values of julia-mode-hook both when you do and do not have the byte-compiled init-julia file available? I want to understand if the byte compiler is messing something up for your configuration file.

nesteiner commented 2 years ago

2022-02-01 13-52-00 的屏幕截图

both hook are the same like this, maybe it the problem of my configuration code ?

nesteiner commented 2 years ago

holy shit, this code works !

(use-package julia-mode
  :hook (julia-mode . julia-snail-mode)
  :config
  (setq julia-repl-switches nil
    julia-snail-extra-args nil
    julia-indent-offset 2)
  :commands julia-snail-mode)

I think I have took you too much time

gcv commented 2 years ago

Very interesting. You're the second person to report this problem and this exact workaround (see #70). For completeness and so I can look into this later, what version of Emacs are you using? What OS? Do you have native compilation enabled?

nesteiner commented 2 years ago

maybe we are not so familiar with emacs-lisp, I think the major mode once loaded, so that its hook can be called.

gcv commented 2 years ago

What we don't understand is use-package. I managed to reproduce the problem you reported. Remove :requires vterm from your original example, and it should work.

It looks like this bug occurs because of :requires: https://github.com/jwiegley/use-package#prevent-loading-if-dependencies-are-missing — so if your (use-package vterm) form is not evaluated first, even if the vterm package is installed, julia-snail is not loaded. It looks like your case and #70 both happened because of this.

I'll update the Snail README and remove :requires vterm and see if that causes a separate set of problems.

nesteiner commented 2 years ago

@gcv hey I think I found the problem, using this code

(use-package julia-snail
  :ensure t
  :after julia-mode
  :requires vterm
  :config
  (setq-default julia-snail-extra-args "--sysimage /home/steiner/.julia-images/julia-dev.so")
  (setq julia-snail-executable "/usr/local/bin/julia"))

and I found that when load julia file, watching the local varibale and the julia-snail-extra-args is nil, so I think this code is not loaded at all

nesteiner commented 2 years ago

how about trying this code, and check the local buffer variable, you will find out

gcv commented 2 years ago

You need to remove requires :vterm from there. I discovered this upthread: https://github.com/gcv/julia-snail/issues/75#issuecomment-1026930872