Hi,
This is just a noob question and absolutely not a bug report :)
I'm currently trying to write a fork for the ob-julia
package, bringing back Julia into Org mode. Everything works great with polymode's autodetection: since the src blocks begin with #+begin_src julia
, it associates julia-mode
as innermodes for Julia source blocks. As I understand it, it's simply the result of the :mode-matcher #'poly-org-mode-matcher
part in poly-org.el
, that searches for the language in the header of the src block.
My goal would be to trigger automatically ess-julia-mode
as innermode for Julia code blocks, instead of julia-mode
. I.e., bypass the automated association made by poly-org-mode-matcher
, by defining a new polymode (I suppose?). How could I do that? I tried some naive approaches, such as:
(define-innermode poly-org-julia-innermode
:mode 'ess-julia-mode
:head-mode 'host
:tail-mode 'host
:head-matcher "^[ \t]*\\#\\+begin_src julia *\n"
:tail-matcher "^[ \t]*\\#\\+end_src")
(define-polymode poly-org-julia-mode
:hostmode 'poly-org-hostmode
:innermodes '(poly-org-julia-innermode))
(add-to-list 'auto-mode-alist '("\\.org\\'" . poly-org-julia-mode))
but this doesn't work. What could be the right way to do that?
Many thanks for your great package!
P.-S.: here is an example of Julia src block, just in case.
#+begin_src julia :results output :exports both
println("Hello world!")
#+end_src