diff options
author | Eric Schulte <schulte.eric@gmail.com> | 2010-08-26 10:01:21 -0600 |
---|---|---|
committer | Eric Schulte <schulte.eric@gmail.com> | 2010-08-26 10:01:21 -0600 |
commit | 2c33b2eb660f98537c7b2c5c05c93564191ed30e (patch) | |
tree | d5f89a9aa8dd12ca02c679eed559601de5e65388 | |
parent | a89dc43e835515eff9dd6bd864e015a3729cd63c (diff) | |
download | org-mode-2c33b2eb660f98537c7b2c5c05c93564191ed30e.tar.gz |
Introducing ob-org and now wrapping ":results org" in org code block
ob-org has two non-standard header arguments in that it exports it's
results by default and the result type defaults to raw, this ensures
that the body of a begin_src org block exports transparently.
This is a breaking change in that if you are currently using org
code blocks to export org-fontified code you will have to set the
":exports" header argument for org-mode blocks to "code" on a block,
file, language or system-wide basis.
* Makefile (LISPF): adding ob-org.el to the makefile
* lisp/ob-org.el: defines handling of org code blocks
* lisp/ob.el (org-babel-insert-result): now when "org" is a result
type the results are wrapped in an org code block
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | lisp/ob-org.el | 53 | ||||
-rw-r--r-- | lisp/ob.el | 11 | ||||
-rw-r--r-- | lisp/org.el | 1 |
4 files changed, 65 insertions, 3 deletions
@@ -148,7 +148,8 @@ LISPF = org.el \ ob-gnuplot.el \ ob-octave.el \ ob-screen.el \ - ob-plantuml.el + ob-plantuml.el \ + ob-org.el LISPFILES0 = $(LISPF:%=lisp/%) LISPFILES = $(LISPFILES0) lisp/org-install.el diff --git a/lisp/ob-org.el b/lisp/ob-org.el new file mode 100644 index 0000000..ad3b013 --- /dev/null +++ b/lisp/ob-org.el @@ -0,0 +1,53 @@ +;;; ob-org.el --- org-babel functions for org code block evaluation + +;; Copyright (C) 2010 Free Software Foundation, Inc. + +;; Author: Eric Schulte +;; Keywords: literate programming, reproducible research +;; Homepage: http://orgmode.org +;; Version: 7.01trans + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;; This is the simplest of code blocks, where upon evaluation the +;; contents of the code block are returned in a raw result. + +;;; Code: +(require 'ob) + +(defvar org-babel-default-header-args:org + '((:results . "raw") (:exports . "results")) + "Default arguments for evaluating a org source block.") + +(defun org-babel-expand-body:org (body params &optional processed-params) + "Expand BODY according to PARAMS, return the expanded body." body) + +(defun org-babel-execute:org (body params) + "Execute a block of Org code with. +This function is called by `org-babel-execute-src-block'." + body) + +(defun org-babel-prep-session:org (session params) + "Return an error because org does not support sessions." + (error "Org does not support sessions")) + +(provide 'ob-org) + +;; arch-tag: 130af5fe-cc56-46bd-9508-fa0ebd94cb1f + +;;; ob-org.el ends here @@ -1202,7 +1202,12 @@ raw ----- results are added directly to the org-mode file. This is a good option if you code block will output org-mode formatted text. -org ----- this is the same as the 'raw' option +org ----- similar in effect to raw, only the results are wrapped + in an org code block. Similar to the raw option, on + export the results will be interpreted as org-formatted + text, however by wrapping the results in an org code + block they can be replaced upon re-execution of the + code block. html ---- results are added inside of a #+BEGIN_HTML block. This is a good option if you code block will output html @@ -1279,7 +1284,9 @@ code ---- the results are extracted in the syntax of the source ((member "code" result-params) (insert (format "#+BEGIN_SRC %s%s\n%s#+END_SRC\n" (or lang "none") results-switches result))) - ((or (member "raw" result-params) (member "org" result-params)) + ((member "org" result-params) + (insert (format "#+BEGIN_SRC org\n%s#+END_SRC\n" result))) + ((member "raw" result-params) (save-excursion (insert result)) (if (org-at-table-p) (org-cycle))) (t (org-babel-examplize-region diff --git a/lisp/org.el b/lisp/org.el index 89fcdae..1456b95 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -160,6 +160,7 @@ requirements) is loaded." (const :tag "Mscgen" mscgen) (const :tag "Ocaml" ocaml) (const :tag "Octave" octave) + (const :tag "Org" org) (const :tag "Perl" perl) (const :tag "PlantUML" plantuml) (const :tag "Python" python) |