1
votes

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.

2
How did you set j-console-cmd to get it working in j-mode? Did you customize it? If you do C-h v j-mode-cmd in the Org mode buffer, what do you get? - NickD
I have no variable called j-mode-cmd. The value for j-console-cmd is ijconsole-9.01. I needed to change it to that else Java jconsole would pop up instead when attempting to evaluate J code in j-mode. - jc52766
Sorry, I meant j-console-cmd. I can see nothing wrong here. - NickD
It's as though org mode is running j-console to eval Jcode blocks. Instead of j-console-9.01 as it does when I am in j-mode in emacs. I'm thinking maybe org-mode isn't in j-mode when evaluating J code blocks but I don't know how to solve this problem (yet). - jc52766

2 Answers

1
votes

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.

:)

0
votes

I'll be honest and say that I have not seen this done before, so it is completely outside of my range of experience. What I was able to do within J console was to wrap your commands in an anonymous verb. This essentially makes the sentences execute as one line and it may be the multi-line issue that is creating this problem.

I would try running

   3 : 0 ''
load 'plot'
plot 1 o. 0.1 * i.200
)

within your org mode and see if this 'single line' form gets around your problem.