[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Basic Literate Program
From: |
Thorsten Jolitz |
Subject: |
Re: [O] Basic Literate Program |
Date: |
Fri, 11 Jul 2014 00:28:28 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Jacob Gerlach <address@hidden> writes:
> - On a related note, are there any tools to take org content from
> outside the SRC blocks and tangle it into comments in the C++ files?
When I call M-: (outorg-convert-org-to-outshine) on this Org-mode buffer:
,----
| * ORG SCRATCH
|
| ** A bit C++
|
| This program displays a string
| and then it exits
|
| This program justs displays a string and exits, variation 2
| #+begin_src c
| #include <iostream>
|
| int main() {
| std::cout << "Hello World!";
| std::cout << std::endl;
|
| return 0;
| }
| #+end_src
|
| #+results:
| : Hello World!
`----
I get
,----
| /* * ORG SCRATCH */
|
| /* ** A bit C++ */
|
| /* This program displays a string */
| /* and then it exits */
|
| /* This program justs displays a string and exits, variation 2 */
| #include <iostream>
|
| int main() {
| std::cout << "Hello World!";
| std::cout << std::endl;
|
| return 0;
| }
|
| /* #+results: */
| /* : Hello World! */
`----
This uses C, because thats in my org-babel-load-languages, should work
with C++ too. Some modes need a little fix due to inconsistent mode
naming, e.g. ESS[R]:
,----
| ;; special case R-mode
| (if (eq mode 'ess-mode)
| (funcall 'R-mode)
| (funcall mode)))
`----
maybe C++ needs this kind of special handling too, let me know if it
does not work out-of-the-box.
--
cheers,
Thorsten