Search code examples
emacsorg-modej

How to configure org mode to evaluate J code blocks?


When I run a J code block in org mode the java jconsole pops up instead. So must be sending a jconsole command instead of ijconsole... Of course J code block is not evaluated. How do I fix this so that J code blocks are correctly evaluated in org mode?

A background on my setup: I got j-mode working once I set j-console-cmd to "ijconsole-9.01". So j-mode works fine it is just evaluating J code blocks in org mode that I have problems with.

FYI the J portion of my init file is this (as recommended on the j-mode github readme):

(add-to-list 'load-path "~/.emacs.d/elpa/j-mode-20171224.1856/")
(autoload 'j-mode "j-mode.el" "Major mode for editing J files" t)
;; Add for detection of j source files if the auto-load fails
(add-to-list 'auto-mode-alist '("\\.ij[rstp]$" . j-mode))

Here's the babel part of my init.el:

(org-babel-do-load-languages
 'org-babel-load-languages
 '((J . t)
   (python . t)))

The j.org file I am attempting to run is:

This is an example j org mode doc.

#+begin_src J :exports both
'Hello , World!'
#+end_src

#+begin_src J
load 'plot'
plot 1 o. 0.1 * i.200
#+end_src

Thanks.


Solution

  • Okay I solved it!

    Variable org-babel-J-command was(incorrectly) set to "jconsole".This opened java instead of evaluating J code in ijconsole...

    I added this to init.el:

    (setq org-babel-J-command "ijconsole-9.01")
    

    And now J code blocks evaluate correctly.

    :)