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.";
Lines starting with zero or more whitespace characters followed by one ' # ' and a whitespace are treated as comments and, as such, are not exported. Likewise, regions surrounded by ' #+BEGIN_COMMENT ' … ' #+END_COMMENT ' are not exported.
Code Blocks in Org Code blocks can be entered directly into the Org file, but it is often easier to enter code with the function org-edit-src-code , which is called with the keyboard shortcut, C-c ' . This places the code block in a new buffer with the appropriate mode activated.
Org Mode offers the ability to insert source code in the document being edited, which is automatically exported and/or executed when exporting the document; the result(s) produced by this code can be automatically fetched back in the resulting output.
Org mode is routinely used to build and manage complex workflows. It does this using an elegantly simple syntax that scales from basic markup to full LaTeX typesetting and from plain text notes to literate programs. Everything you need to get started is demonstrated in the example.
This is an Org mode document, using the .orgextension (supported by GitHub). Org modeis an easy-to-write plain textformatting syntax for authoring notes, articles, LaTeX documents, books, Web pages, Beamer slide decks and much more!
The command below helps changing the comment status of a headline. Toggle the ‘ COMMENT ’ keyword at the beginning of an entry. For a less drastic behavior, consider using a select tag (see Export Settings) instead.
Org mode uses #+BEGIN … #+END blocks for many purposes. Some of the basic blocks types quote, example, and src. If you all you need is monospace text, you can use an example block. However, example blocks do not give you the power of Org babel . For that you need a source block.
You can write Org syntax in any text editor. However, to experience the full potential of Org you need an editor that transforms Org syntax into a living, interactive document. At the start of a file (before the first heading), it is common to set the title, author and other export options . Lines that start with an asterisk * are headings .
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With