1

I've installed j-mode and it works.

But in an org-babel code block I have a strange issue.

Spelling like begin_src J (capital J) allows me to evaluate the block, but has no syntax highlighting:

#+begin_src J
(+/%#) 0.2 + i.24  NB. avg
#+end_src

#+RESULTS:
: 11.7

Also, I can't use C-c ' to edit the code in a popup; instead I get an error message: No such language mode: J-mode.

Here's the strangest thing: when I change the spelling to begin_src j (lowercase j), then I get syntax highlighting and can use C-c ' to edit the code in a popup as expected.

However, now org-babel won't evaluate the source block, and when I try it complains with ob-j.elc failed to provide feature ‘ob-j’.

Is there anything I can do to get both sets of features at the same time?

7
  • ob-j.elc failed to provide feature ‘ob-j’ sounds strange - maybe ob-j.elc is corrupt or needs to be recompiled?
    – Tyler
    Oct 7, 2021 at 20:13
  • This looks like a bug to me. I think org-babel uses ob-J (uppercase) but org's own syntax highlighting uses j-mode (lowercase).
    – Mathletics
    Oct 7, 2021 at 20:46
  • I have ob-J.elc but no ob-j.elc. Will try a recompile. Oct 7, 2021 at 20:53
  • ob-J.el ends with (provide 'ob-J). Should I edit it so it says (provide 'ob-j) instead? Oct 7, 2021 at 20:56
  • I wonder how ob-C.el and c-mode coexist. If there is a trick there, it might be applied to ob-J.el. You might want to bring it up on the Org mode mailing list.
    – NickD
    Oct 7, 2021 at 21:56

2 Answers 2

1

I believe you are looking for this in your init file:

(add-to-list 'org-src-lang-modes '("J" . j))

that should allow you to edit and give you syntax highlighting

0

Found a hacky workaround. A the bottom of .emacs.d/.local/straight/repos/org/lisp/ob-J.el, I added a line:

(provide 'ob-J)
(provide 'ob-j) ;; this line added by me

Now everything works as expected. Seems dumb that this is necessary though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.