Problem installing Julia plugin in TeXmacs (Windows)

It would be good to see the ouput of

(plugin-list)

and the contents of $TEXMACS_HOME_PATH/system/cache/plugin_cache.scm as well.

@mgubi the Julia plugin is installed in

C:\Users\mille\AppData\Roaming\TeXmacs\plugins\julia

What seems curious to me is that inside the julia folder there is another julia folder, I wonder if this is a problem?

And I’m not sure exactly what you want to say with “Julia executable”. Please look at the file highlighted in the image below and tell me if you mean that one.

In that case the path is

C:\Users\mille\AppData\Local\Programs\Julia 1.5.3\bin

Now the file “init-julia.scm” is located in

C:\Users\mille\AppData\Roaming\TeXmacs\plugins\julia\progs

and I added the the line (:winpath "Julia*" "bin"), you can see the content of the file, here:

https://drive.google.com/file/d/1ziH8htDL2HJxQJTaZyE47IvHA_mnWVf2/view?usp=sharing

@pireddag When I run that in a Scheme session, it return

Unbound variable: julia-launcher

I think we are getting closer to understanding what does not work.
Could you now please execute

(define (julia-launcher)
  (with boot (raw-quote (julia-entry))
    (if (url-exists-in-path? "julia")
        (string-append "julia " boot)
        (string-append "julia " boot))))

and then afterwards again the plugin-configure function above.

Edit: the double quotes might get copied over to the Scheme session as two single quotes, if this happens you have to correct them.

What is the output of (url-exists? "$TEXMACS_HOME_PATH/plugins/julia/julia/TeXmacsJulia.jl")?

@jeroen

return

(CMakeLists.txt README.md aspell asymptote axiom caas cadabra cocoa5 coq dratex eukleides feynmf fricas giac gnuplot graph graphviz gtybalt julia lisp lush macaulay2 maple mathemagix mathematica matlab maxima mmi mmshell mupad mycas octave pari plantuml python qcl r reduce sage scilab shell sympy texgraph tikz tmpy xypic yacas)

and the contents of

C:\Users\mille\AppData\Roaming\TeXmacs\system\cache\plugin_cache.scm

you can see in:

https://drive.google.com/file/d/1KZBF3FRdCDbgTBxzyWBiMLQmxVxBFnlI/view?usp=sharing

@pireddag now it returns

Unbound variable: julia-entry

it returns #t

Yes yes, I have taken it into account.

Ok, now please

(define (julia-serialize lan t)
    (with u (pre-serialize lan t)
      (with s (texmacs->code (stree->tree u) "SourceCode")
        (string-append s "\n<EOF>\n"))))
(define (julia-entry)
  (system-url->string
    (if (url-exists? "$TEXMACS_HOME_PATH/plugins/julia/julia/TeXmacsJulia.jl")
       "$TEXMACS_HOME_PATH/plugins/julia/julia/TeXmacsJulia.jl"
       "$TEXMACS_PATH/plugins/julia/julia/TeXmacsJulia.jl")))

each in a separate prompt in the Scheme session; and then again the plugin-configure function.
My impression is that TeXmacs is not seeing the julia.scm file. @mgubi: can this be?

Now it doesn’t return nothing, i.e, there is not error.

This is very strange. Could you please try

(let* ((name "julia")
         (file (string-append "plugins/" name "/progs/init-" name ".scm"))
        (u (url-unix "$TEXMACS_HOME_PATH:$TEXMACS_PATH" file))) 
(if (url-exists? u)
        (url-materialize u "r")
))
1 Like

I have got an idea. plugin-list is a function in the glue, and I just saw that it is defined in System/Boot/init_texmacs.cpp (as plugin_list).
I am guessing: it gets executed at startup, and then not anymore. If this is true, and if Tools->Update->Plugins uses it to see which plugins it should update, then a restart of TeXmacs would be necessary to get TeXmacs to recognize a new plugin.
@MillerSilva: did you restart TeXmacs after you copied the plugin into the directory?

Ok, judging from

yes :slight_smile:

I don’t think a restart is necessary for the Update tool to work. I just removed a plugin directory from under a running TeXmacs, ran update, put the folder back and ran update again. The list of plugins was updated correctlt in both cases.

1 Like

Moreover @MillerSilva has julia in his (plugin-list). And in fact (plugin-list), not plugin-list, which tells that the function is run every time.

@MillerSilva, what is the output of (url-exists? "$TEXMACS_PATH/plugins/julia/julia/TeXmacsJulia.jl") ?

1 Like

I did it and it doesn’t return any error.

I suppose that “restart” means close and reopen TeXmacs, and yes I did it.

It returns #t

Okay, that might get us somewhere. It should return the path to init-julia.scm

1 Like

Next attempt :slight_smile:

(let* ((name "julia")
     (file (string-append "plugins/" name "/progs/init-" name ".scm"))
    (u (url-unix "$TEXMACS_HOME_PATH:$TEXMACS_PATH" file))) 
u
)
1 Like

It returns

<url {C:\Users\mille\AppData\Roaming\TeXmacs;C:\Program Files (x86)\TeXmacs}\plugins\julia\progs\init-julia.scm>

Thanks, @MillerSilva. I don’t see why TeXmacs can’t find the init-julia.scm file.

Could you please verify the file permissions on

  • C:\Users\mille\AppData\Roaming\TeXmacs\plugins\julia\progs\init-julia.scm
  • C:\Program Files (x86)\TeXmacs\plugins\julia\progs\init-julia.scm

And compare them to those of the init files of other plugins that do work.

This file should not be there. Why it is there? There should be a julia directory only in C:\Users\mille\AppData\Roaming\TeXmacs\plugins\julia

@MillerSilva please delete all the directory C:\Program Files (x86)\TeXmacs\plugins\julia and be sure that the file in C:\Users\mille\AppData\Roaming\TeXmacs\plugins\julia\progs\init-julia.scm is correct. There should be only one directory with the plugin.

Why not? Either TEXMACS_PATH or TEXMACS_HOME_PATH should work, no?