问题描述
我目前正在尝试在组织模式下设置Raku脚本。但是,Raku主要模式未定义注释语法。有没有办法告诉Org Mode注释标头参数哪种注释语法用作标头参数?
例如,此代码块
* This should be a comment
#+BEGIN_SRC raku :comments org
lorem ipsum
#+END_SRC
当编译时提示我有关未定义注释语法的信息。 作为参考,在Raku Major模式(正式模式)中,注释会像这样正确突出显示
# This is a comment
constant Str this = "is not.";
解决方法
根据我对组织模式文档的了解,:comments
标头参数仅在还使用:tangle
标头参数时才有意义。它与上下文注释如何添加到纠结的代码有关。
https://orgmode.org/manual/Extracting-Source-Code.html#Extracting-Source-Code
下面的代码块显示了三种可用的注释插入方法:
* 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
(与Ctrl-c Ctrl-v t
纠缠之后,生成的.raku文件如下所示:
#!/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
我认为这种行为与我从Melpa安装的 raku-mode 没有任何关系。它确实需要Org Babel的Raku后端。我正在使用ob-raku.el,我想我是从这里得到的: