* Basic Literate Program
@ 2014-07-10 21:31 Jacob Gerlach
2014-07-10 22:28 ` Thorsten Jolitz
2014-07-10 23:31 ` Grant Rettke
0 siblings, 2 replies; 4+ messages in thread
From: Jacob Gerlach @ 2014-07-10 21:31 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1130 bytes --]
Hi List,
I only became aware of literate programming through org and have been
looking for a chance to try it out. I need to write a small command
line utility that parses through a plain text log file and performs
some operations, which I think is a reasonably simple use case for me
to try out this new method.
I have the basics of the program outlined in org mode already, and
envision simply adding SRC blocks to each list item. Tangling the org
file and compiling the result will give me my program.
I have several questions:
- Does this sound like a reasonable use case and approach?
- I am writing this program in C++. I believe that I can interweave
SRC blocks with different header arguments so that they tangle to my
.h file and .cpp file as appropriate. Is this correct?
- I may need to share the tangled cpp files with colleagues. Are there
any ways to control the sequence of code in the resulting files
other than the sequence of SRC blocks in org mode?
- 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?
Thanks,
Jake
[-- Attachment #2: Type: text/html, Size: 1451 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Basic Literate Program
2014-07-10 21:31 Basic Literate Program Jacob Gerlach
@ 2014-07-10 22:28 ` Thorsten Jolitz
2014-07-10 22:54 ` Jacob Gerlach
2014-07-10 23:31 ` Grant Rettke
1 sibling, 1 reply; 4+ messages in thread
From: Thorsten Jolitz @ 2014-07-10 22:28 UTC (permalink / raw)
To: emacs-orgmode
Jacob Gerlach <jacobgerlach@gmail.com> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Basic Literate Program
2014-07-10 22:28 ` Thorsten Jolitz
@ 2014-07-10 22:54 ` Jacob Gerlach
0 siblings, 0 replies; 4+ messages in thread
From: Jacob Gerlach @ 2014-07-10 22:54 UTC (permalink / raw)
To: Thorsten Jolitz; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 668 bytes --]
On Thu, Jul 10, 2014 at 6:28 PM, Thorsten Jolitz <tjolitz@gmail.com> wrote:
> When I call M-: (outorg-convert-org-to-outshine) on this Org-mode buffer:
>
Thanks for this suggestion. It seems outorg/outshine are not distributed
with org and must be added separately? I have to watch the size of bites I
take when experimenting with org, or otherwise I spend all my time
tinkering instead of getting work done. I'm already reaching a bit to try
tangling this project instead of just writing it, so I want to avoid
setting up additional pieces and parts. If I run in to trouble with good
commenting down the road and there are no other suggestions, I will revisit
this.
[-- Attachment #2: Type: text/html, Size: 982 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Basic Literate Program
2014-07-10 21:31 Basic Literate Program Jacob Gerlach
2014-07-10 22:28 ` Thorsten Jolitz
@ 2014-07-10 23:31 ` Grant Rettke
1 sibling, 0 replies; 4+ messages in thread
From: Grant Rettke @ 2014-07-10 23:31 UTC (permalink / raw)
To: Jacob Gerlach; +Cc: emacs-orgmode@gnu.org
On Thu, Jul 10, 2014 at 4:31 PM, Jacob Gerlach <jacobgerlach@gmail.com> wrote:
> - Does this sound like a reasonable use case and approach?
Yes.
> - I am writing this program in C++. I believe that I can interweave
> SRC blocks with different header arguments so that they tangle to my
> .h file and .cpp file as appropriate. Is this correct?
Yes.
> - I may need to share the tangled cpp files with colleagues. Are there
> any ways to control the sequence of code in the resulting files
> other than the sequence of SRC blocks in org mode?
Yes.
> - 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?
Yes.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-07-10 23:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-10 21:31 Basic Literate Program Jacob Gerlach
2014-07-10 22:28 ` Thorsten Jolitz
2014-07-10 22:54 ` Jacob Gerlach
2014-07-10 23:31 ` Grant Rettke
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).