How do I tell org mode what comment syntax to use?

Viewed 364

I am currently trying to set up a Raku script in Org Mode. However, the Raku major mode does not define a comment syntax. Is there a way to tell the Org Mode comment header argument what comment syntax to use as a header argument?

For example, this code block

* This should be a comment
#+BEGIN_SRC raku :comments org
lorem ipsum
#+END_SRC

when compiled prompts me about not having a defined comment syntax. For reference, in the Raku Major mode (the official one), comments are properly highlighted like this

# This is a comment
constant Str this = "is not.";
1 Answers

From what I can figure out by reading the Org Mode documentation, the :comments header argument is only meaningful when also using the :tangle header argument. It relates to how contextual comments get added to the tangled code.

https://orgmode.org/manual/Extracting-Source-Code.html#Extracting-Source-Code

The following code block shows three of the comment insertion methods that are available:

* Tangled Header Comment
#+begin_src raku :results output :comments org :tangle yes :shebang #!/usr/bin/env raku
  say 'hi';
#+end_src

#+RESULTS:

* Link Comments
#+begin_src raku :results output :comments link :tangle yes :shebang #!/usr/bin/env raku
  say 'hello';
#+end_src

* Both Link and Org Comments
#+begin_src raku :results output :comments both :tangle yes :shebang #!/usr/bin/env raku
  say 'hello';
#+end_src

After tangling (with Ctrl-c Ctrl-v t) the resulting .raku file looks like this:

#!/usr/bin/env raku
# Tangled Header Comment

say 'hi';

# [[file:~/git/play.org::*Link Comments][Link Comments:1]]
say 'hello';
# Link Comments:1 ends here

# Both Link and Org Comments

# [[file:~/git/play.org::*Both Link and Org Comments][Both Link and Org Comments:1]]
say 'hello';
# Both Link and Org Comments:1 ends here

I don't think this behaviour has anything to do with raku-mode which I installed from Melpa. It does require a Raku backend for Org Babel. I am using ob-raku.el which I think I got from here:

https://github.com/tmtvl/ob-raku

Related