From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: [ANN] Convert Org-mode file to Source-code file Date: Thu, 20 Jun 2013 12:37:31 -0600 Message-ID: <8738scsk5w.fsf@gmail.com> References: <87wqppbpmk.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50914) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Upjkq-00071o-9h for emacs-orgmode@gnu.org; Thu, 20 Jun 2013 14:38:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Upjkn-0005LG-T4 for emacs-orgmode@gnu.org; Thu, 20 Jun 2013 14:38:44 -0400 Received: from mail-pa0-x235.google.com ([2607:f8b0:400e:c03::235]:42855) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Upjkn-0005L1-IJ for emacs-orgmode@gnu.org; Thu, 20 Jun 2013 14:38:41 -0400 Received: by mail-pa0-f53.google.com with SMTP id tj12so6547577pac.40 for ; Thu, 20 Jun 2013 11:38:40 -0700 (PDT) In-Reply-To: <87wqppbpmk.fsf@gmail.com> (Thorsten Jolitz's message of "Thu, 20 Jun 2013 02:19:15 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Thorsten Jolitz Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain How does this differ from ":tangle yes :comments org"? e.g., --=-=-= Content-Type: text/x-org Content-Disposition: inline; filename=foo.org #+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 --=-=-= Content-Type: text/plain tangles to --=-=-= Content-Type: text/x-sh Content-Disposition: inline; filename=foo.sh #!/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 --=-=-= Content-Type: text/plain Thorsten Jolitz 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 --=-=-=--