emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <schulte.eric@gmail.com>
To: Thorsten Jolitz <tjolitz@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [ANN] Convert Org-mode file to Source-code file
Date: Thu, 20 Jun 2013 12:37:31 -0600	[thread overview]
Message-ID: <8738scsk5w.fsf@gmail.com> (raw)
In-Reply-To: <87wqppbpmk.fsf@gmail.com> (Thorsten Jolitz's message of "Thu, 20 Jun 2013 02:19:15 +0200")

[-- Attachment #1: Type: text/plain, Size: 63 bytes --]

How does this differ from ":tangle yes :comments org"?

e.g.,


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: foo.org --]
[-- Type: text/x-org, Size: 672 bytes --]

#+Property: tangle yes
#+Property: comments org

* This is the top

#+begin_src sh :shebang #!/bin/bash
  echo "##this file will cat itself"
  echo ""
#+end_src

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec
hendrerit tempor tellus. Donec pretium posuere tellus. Proin quam
nisl, tincidunt et, mattis eget, convallis nec, purus. Cum sociis
natoque penatibus et magnis dis parturient montes, nascetur ridiculus
mus. Nulla posuere. Donec vitae dolor. Nullam tristique diam non
turpis. Cras placerat accumsan nulla. Nullam rutrum. Nam vestibulum
accumsan nisl.

| a       | table |
| in      | the   |
| tangled | file  |

#+begin_src sh
  cat $0
#+end_src

[-- Attachment #3: Type: text/plain, Size: 13 bytes --]


tangles to


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: foo.sh --]
[-- Type: text/x-sh, Size: 579 bytes --]

#!/bin/bash

# This is the top

echo "##this file will cat itself"
echo ""

# Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec
# hendrerit tempor tellus. Donec pretium posuere tellus. Proin quam
# nisl, tincidunt et, mattis eget, convallis nec, purus. Cum sociis
# natoque penatibus et magnis dis parturient montes, nascetur ridiculus
# mus. Nulla posuere. Donec vitae dolor. Nullam tristique diam non
# turpis. Cras placerat accumsan nulla. Nullam rutrum. Nam vestibulum
# accumsan nisl.

# | a       | table |
# | in      | the   |
# | tangled | file  |

cat $0

[-- Attachment #5: Type: text/plain, Size: 1780 bytes --]


Thorsten Jolitz <tjolitz@gmail.com> writes:

> Hi List, 
>
> it is now possible to convert existing Org-mode files with source-blocks into
> machine-executable source-code files, using the following function from
> `outorg.el':
>
> #+begin_src emacs-lisp
> (defun outorg-convert-org-file-to-source-code
>   (&optional mode infile outfile BATCH)
>   "Convert an existing Org-mode file into an Outshine buffer.
>
> If MODE is non-nil, the Outshine buffer will be put in this
> major-mode, otherwise the major-mode of the language of the first
> source-code block in the Org-mode buffer will be used.
>
> If INFILE is non-nil, the specified Org-mode file will be visited
> and its buffer converted, otherwise the current buffer will be
> converted.
>
> If OUTFILE is non-nil, the converted Outshine buffer will be saved in this
> file. Its the user's responsability to make sure that OUTFILE's
> file-extension is suited for the major-mode of the Outshine buffer to be
> saved. When in doubt, consult variable  `auto-mode-alist' for associations
> between file-extensions and major-modes.
>
> If BATCH is non-nil (and OUTFILE is non-nil, otherwise it makes
> no sense), the new Outshine file is saved and its buffer
> deleted."...)
> #+end_src
>
> Usage example:
>
> ,----------------------------------------------------------------
> | (outorg-convert-org-file-to-source-code
> |    "emacs-lisp-mode" "~/junk/test.org" "~/junk/test.el" 'BATCH)
> `----------------------------------------------------------------
>
> I'm not sure about the general use case for this, but I do have my uses for
> it, so I announce it here because it might serve others too.
>
> PS 
> This is *not* about tangling, try it out to see the (big) difference.

-- 
Eric Schulte
http://cs.unm.edu/~eschulte

  parent reply	other threads:[~2013-06-20 18:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-20  0:19 [ANN] Convert Org-mode file to Source-code file Thorsten Jolitz
2013-06-20 18:17 ` Charles Berry
2013-06-21  9:00   ` Thorsten Jolitz
2013-06-21 16:11     ` Charles Berry
2013-06-21 17:16       ` Thorsten Jolitz
2013-06-20 18:37 ` Eric Schulte [this message]
2013-06-21  9:58   ` Thorsten Jolitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8738scsk5w.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=tjolitz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).