1 #+OPTIONS: H:3 num:nil toc:3 \n:nil @:t ::t |:t ^:{} -:t f:t *:t TeX:t LaTeX:nil skip:nil d:(HIDE) tags:not-in-toc
2 #+STARTUP: align fold nodlcheck hidestars oddeven lognotestate hideblocks
3 #+SEQ_TODO: TODO(t) INPROGRESS(i) WAITING(w@) | DONE(d) CANCELED(c@)
4 #+TAGS: Write(w) Update(u) Fix(f) Check(c) noexport(n)
5 #+TITLE: Org-babel: Reference
6 #+AUTHOR: Eric Schulte, Dan Davison, Tom Dye
7 #+EMAIL: schulte.eric at gmail dot com, davison at stats dot ox dot ac dot uk, tsd at tsdye dot com
9 #+STYLE: <style type="text/css">#outline-container-syntax { clear:both; }</style>
12 <style type="text/css">
13 <!--/*--><![CDATA[/*><!--*/
22 [[file:index.org][{Back to Babel's index}]]
25 <div id="logo2" style="float: left; text-align: center; max-width:
26 400px; font-size: 8pt; margin: 1em;">
28 <img src="../../images/babel/babelfish.png" alt="Babel Fish"/>
30 The Babel Fish is small, yellow, and simultaneously translates
31 from one spoken language to another.
34 – The Hitchhiker's Guide to the Galaxy, Douglas Adams
46 The basic syntax of source code blocks in Org-babel is as follows:
48 : #+begin_src language header-arguments
52 - language :: The language of the code in the source code block. Valid
53 values must be members of =org-babel-interpreters=.
54 - header-arguments :: Header arguments control many facets of the
55 evaluation and output of source code blocks. See the [[header-arguments][Header
56 Arguments]] section for a complete review of available header
58 - body :: The source code to be evaluated. An important key-binding
59 is C-c '. This calls =org-edit-src-code=, a function that brings
60 up an edit buffer containing the code using the Emacs major mode
61 appropriate to the language. You can edit your source code block
62 as you regularly would in Emacs.
64 This syntax can be expanded by naming the source code block.
67 : #+begin_src language header-arguments
71 - name :: This name is associated with the source code block. This is
72 similar to the =#+tblname= lines which can be used to name tables
73 in Org-mode files. By referencing the name of a source code
74 block it is possible to evaluate the block from other places in
75 the file, from other files, or from inside Org-mode tables. It
76 is also possible to pass arguments to a source code block through
77 this =#+source:= line (see [[alternate-argument-syntax][Alternate argument syntax]]).
80 [[file:library-of-babel.org][Library of Babel]] functions can be called using the following syntax.
82 : #+lob: R-plot(data=R-plot-example-data)
85 A number of aliases for Org-babel keywords have emerged that may
86 be more natural than their predecessors. The following aliases
87 could be used in the following example
89 ,#+srcname: alias-example
90 ,#+begin_src emacs-lisp
92 (source function srcname)
96 ,#+results: alias-example
98 | source | function | srcname |
99 | results | resname | |
101 - =#+srcname:= could be replaced with either of two aliases, =#+source:= or =#+function:=.
102 - =#+results:= could be replaced with its alias, =#+resname:=.
104 When calling Library of Babel functions, as in the following
105 example, there are two acceptable keywords. The =#+lob= call in
106 the example could be replaced with its alias, =#+call=.
108 ,#+lob: R-plot(data=R-plot-example-data)
113 :CUSTOM_ID: languages
116 Org-babel has support for the following languages.
118 | Language | Documentation | Identifier | Requirements |
119 |----------------+--------------------------+------------+---------------------------------------------|
120 | Asymptote | org-babel-doc-asymptote | asymptote | [[http://asymptote.sourceforge.net/][asymptote]], [[http://asymptote.sourceforge.net/doc/Editing-modes.html][asy-mode]] |
121 | C | [[file:languages/org-babel-doc-C.org][org-babel-doc-C]] | C | none |
122 | Clojure | [[file:languages/org-babel-doc-clojure.org][org-babel-doc-clojure]] | clojure | [[http://clojure.org/][clojure]], [[http://www.emacswiki.org/emacs/clojure-mode.el][clojure-mode]], [[http://common-lisp.net/project/slime/][slime]], [[http://clojure.codestuffs.com/][swank-clojure]] |
123 | css | org-babel-doc-css | css | none |
124 | ditaa | org-babel-doc-ditaa | ditaa | [[http://ditaa.org/ditaa/][ditaa]] (bundled with Org-mode) |
125 | Graphviz | org-babel-doc-dot | dot | [[http://www.graphviz.org/][dot]] |
126 | Emacs Lisp | org-babel-doc-emacs-lisp | emacs-lisp | none |
127 | gnuplot | org-babel-doc-gnuplot | gnuplot | [[http://www.gnuplot.info/][gnuplot]], [[http://cars9.uchicago.edu/~ravel/software/gnuplot-mode.html][gnuplot-mode]] |
128 | Haskell | org-babel-doc-haskell | haskell | [[http://www.haskell.org/][haskell]], [[http://projects.haskell.org/haskellmode-emacs/][haskell-mode]], [[http://www.haskell.org/haskellwiki/Haskell_mode_for_Emacs#inf-haskell.el:_the_best_thing_since_the_breadknife][inf-haskell]], [[http://people.cs.uu.nl/andres/lhs2tex/][lhs2tex]] |
129 | LaTeX | [[file:languages/org-babel-doc-LaTeX.org][org-babel-doc-latex]] | latex | [[http://www.latex-project.org/][latex]], [[http://www.gnu.org/software/auctex/][auctex]], [[http://www.gnu.org/software/auctex/reftex.html][reftex]] |
130 | Objective Caml | org-babel-doc-ocaml | ocaml | [[http://caml.inria.fr/][ocaml]], [[http://www-rocq.inria.fr/~acohen/tuareg/][tuareg-mode]] |
131 | Perl | org-babel-doc-perl | perl | [[http://www.perl.org/][perl]], [[http://www.emacswiki.org/emacs/CPerlMode][cperl-mode]] (optional) |
132 | Python | org-babel-doc-python | python | [[http://www.python.org/][python]], [[https://launchpad.net/python-mode][python-mode]] (optional) |
133 | R | [[file:languages/org-babel-doc-R.org][org-babel-doc-R]] | R | [[http://www.r-project.org/][R]], [[http://ess.r-project.org/][ess-mode]] |
134 | Ruby | org-babel-doc-ruby | ruby | [[http://www.ruby-lang.org/][ruby]], [[http://www.ruby-lang.org/][irb]], [[http://github.com/eschulte/rinari/raw/master/util/ruby-mode.el][ruby-mode]], [[http://github.com/eschulte/rinari/raw/master/util/inf-ruby.el][inf-ruby mode]] |
135 | Sass | org-babel-doc-sass | sass | [[http://sass-lang.com/][sass]], [[http://github.com/nex3/haml/blob/master/extra/sass-mode.el][sass-mode]] |
136 | GNU Screen | [[file:languages/org-babel-doc-screen.org][org-babel-doc-screen]] | screen | [[http://www.gnu.org/software/screen/][screen]], a terminal |
137 | shell | org-babel-doc-sh | sh[fn:1] | a shell |
138 | SQL | org-babel-doc-sql | sql | none |
140 To add support for a particular language to your Org-babel
141 installation first make sure that the requirements of the language
142 are met, then add a line like the following to your Emacs
143 configuration, (replace "identifier" with one of the
144 entries in the Identifier column of the table).
145 #+begin_src emacs-lisp
146 (require 'org-babel-identifier)
151 :CUSTOM_ID: header-arguments
154 Definitions of all Org-babel header arguments are given [[header-argument-specific-documentation][below]]. In
155 addition, some languages may add their own header arguments. Please
156 see the language-specific documentation for information on
157 language-specific header arguments.
159 ** Using Header Arguments
161 The values of header arguments can be set in three different ways,
162 each more specific than the last.
166 :CUSTOM_ID: system-wide-header-argument
169 System-wide values of header arguments can be specified by
170 customizing the =org-babel-default-header-args= variable:
172 org-babel-default-header-args is a variable defined in `org-babel.el'.
175 (:results . "replace")
182 Default arguments to use when evaluating a source block.
185 For example, the following example could be used to set the default value
186 of =:noweb= header arguments to =yes=. This would have the effect of
187 expanding =:noweb= references by default when evaluating source code blocks.
188 #+begin_src emacs-lisp :results silent :exports code
189 (setq org-babel-default-header-args
190 (cons '(:noweb . "yes")
191 (assq-delete-all :noweb org-babel-default-header-args)))
194 *** Org-mode Properties
196 Header arguments are also read from [[http://orgmode.org/manual/Properties-and-Columns.html#Properties-and-Columns][Org-mode properties]], which
197 means they can be set on the outline header level. For example, the
198 value of the =:cache= header argument will default to true in all
199 source code blocks under the following example of an Org-mode outline header:
204 :CUSTOM_ID: property-set-header-arguments
207 Properties defined in this way override the properties set in
208 =org-babel-default-header-args=. It is convenient to use the
209 =org-set-property= function bound to =C-c C-x p= to set properties
210 in Org-mode documents.
212 *** Source Code Block
214 :CUSTOM_ID: single-block-header-arguments
216 The most common way to assign values to header arguments is at the
217 source code block level. This can be done by listing a sequence of
218 header arguments and their values as part of the =#+begin_src=
219 line. Properties set in this way override both the values of
220 =org-babel-default-header-args= and header argument specified as
221 properties. In the following example, the
222 =:results= header argument is set to =silent=, meaning the results
223 of execution will not be inserted in the buffer, and the =:exports=
224 header argument is set to =code=, meaning only the body of the
226 will be preserved on export to HTML or LaTeX.
229 ,#+begin_src haskell :results silent :exports code
231 fac n = n * fac (n-1)
235 ** Specific Header Arguments
237 :CUSTOM_ID: header-argument-specific-documentation
242 :CUSTOM_ID: header-argument-var
245 The =:var= header argument is used to pass arguments to
246 source code blocks. The specifics of how arguments are included
247 in a source code block are language specific and are
248 addressed in the language-specific documentation. However, the
249 syntax used to specify arguments is the same across all
250 languages. The values passed to arguments can be or
252 - values from org-mode tables
253 - the results of other source code blocks
255 These values can be indexed in a manner similar to arrays -- see
256 [[var-argument-indexing][argument indexing]].
258 The following syntax is used to pass arguments to source code
259 blocks using the =:var= header argument.
265 where =assign= can take one of the following forms
267 - literal value :: either a string ="string"= or a number =9=.
268 - reference :: a table name:
271 ,#+tblname: example-table
277 ,#+source: table-length
278 ,#+begin_src emacs-lisp :var table=example-table
282 ,#+results: table-length
286 a source code block name, as assigned by =#+srcname:=,
287 followed by parentheses:
290 ,#+begin_src emacs-lisp :var length=table-length()
298 In addition, an argument can be passed to the source code
299 block referenced by =:var=. The argument is passed within
300 the parentheses following the source code block name:
304 ,#+begin_src emacs-lisp :var input=8
312 ,#+begin_src emacs-lisp :var input=double(input=1)
320 **** alternate argument syntax
322 :CUSTOM_ID: alternate-argument-syntax
325 It is also possible to specify arguments in a potentially more
326 natural way using the =#+source:= line of a source code block.
327 As in the following example arguments can be packed inside of
328 parenthesis following the source name.
330 ,#+source: double(input=0)
331 ,#+begin_src emacs-lisp
336 **** indexable variable values
338 :CUSTOM_ID: var-argument-indexing
341 It is possible to assign a portion of a value to a
342 variable in a source block. The following example
343 assigns the second and third rows of the table
344 =example-table= to the variable =data=:
347 :var data=example-table[1:2]
350 *Note:* ranges are indexed using the =:= operator.
352 *Note:* indices are 0 based.
354 The following example assigns the second column of the
355 first row of =example-table= to =data=:
358 :var data=example-table[0,1]
361 It is possible to index into the results of source code blocks
362 as well as tables. Any number of dimensions can be indexed.
363 Dimensions are separated from one another by commas.
365 For more information on indexing behavior see the documentation
366 for the =org-babel-ref-index-list= function -- provided below.
369 org-babel-ref-index-list is a Lisp function in `org-babel-ref.el'.
371 (org-babel-ref-index-list INDEX LIS)
373 Return the subset of LIS indexed by INDEX. If INDEX is
374 separated by ,s then each PORTION is assumed to index into the
375 next deepest nesting or dimension. A valid PORTION can consist
376 of either an integer index, or two integers separated by a : in
377 which case the entire range is returned.
380 *Note:* In Emacs, the documentation for any function or variable
381 can be read using the =describe-function= (M-x describe
382 function) and =describe-variable= (M-x describe variable)
383 functions, respectively.
387 :CUSTOM_ID: header-argument-results
390 There are three types of results header argument:
391 - *collection* header arguments specify how the results should be collected from
392 the source code block;
393 - *type* header arguments specify what type of result the source code block
394 will return -- which has implications for how they will be
395 inserted into the Org-mode buffer; and
396 - *handling* header arguments specify how the results of
397 evaluating the source code block should be handled.
399 *Note:* only one option from each type may be supplied per source code
403 The following options are mutually exclusive, and specify how the
404 results should be collected from the source code block.
406 - value :: This is the default. The result is the value
407 of the last statement in the source code block.
408 This header argument places Org-babel in functional
409 mode. Note that in some languages, e.g., python,
410 use of this result type requires that a =return=
411 statement be included in the body of the source code
412 block. E.g., =:results value=.
413 - output :: The result is the collection of everything printed
414 to stdout during the execution of the source code
415 block. This header argument places Org-babel in scripting
416 mode. E.g., =:results output=.
419 The following options are mutually exclusive and specify what
420 type of results the code block will return. By default, results
421 are inserted as either a *table* or *scalar* depending on their
424 - table, vector :: The results should be interpreted as an Org-mode table.
425 If a single value is returned, Org-babel will convert it
426 into a table with one row and one column. E.g., =:results
428 - scalar, verbatim :: The results should be interpreted
429 literally -- meaning they will not be converted into a table.
430 The results will be inserted into the Org-mode buffer as
431 quoted text. E.g., =:results value verbatim=.
432 - file :: The results will be interpreted as the path to a file,
433 and will be inserted into the Org-mode buffer as a file
434 link. E.g., =:results value file=.
435 - raw, org :: The results are interpreted as raw Org-mode code and
436 are inserted directly into the buffer. If the results look
437 like a table they will be aligned as such by Org-mode.
438 E.g., =:results value raw=.
439 - html :: Results are assumed to be HTML and will be enclosed in
440 a =begin_html= block. E.g., =:results value html=.
441 - latex :: Results assumed to be LaTeX and are enclosed in a
442 =begin_latex= block. E.g., =:results value latex=.
443 - code :: Result are assumed to be parseable code and are
444 enclosed in a code block. E.g., =:results value code=.
445 - pp :: The result is converted to pretty-printed code and is
446 enclosed in a code block. This option currently supports
447 Emacs Lisp, python, and ruby. E.g., =:results value pp=.
450 The following results options indicate what Org-babel should do
451 with the results once they are collected.
453 - silent :: The results will be echoed in the minibuffer but
454 will not be inserted into the Org-mode buffer. E.g.,
455 =:results output silent=.
456 - replace :: The default value. The results will be inserted
457 into the Org-mode buffer. E.g., =:results output
462 :CUSTOM_ID: header-argument-exports
465 Specify what should be included in HTML or LaTeX exports of the
468 - code :: the default. The body of code is included
469 into the exported file. E.g., =:exports code=.
470 - results :: the result of evaluating the code is included in the
471 exported file. E.g., =:exports results=.
472 - both :: both the code and results are included in the exported
473 file. E.g., =:exports both=.
474 - none :: nothing is included in the exported file. E.g.,
479 :CUSTOM_ID: tangle-header-arguments
482 Specify whether or not the source code block should be included
483 in tangled extraction of source code files.
485 - yes :: the source code block is exported to a source code file
486 named after the basename (name w/o extension) of the
487 Org-mode file. E.g., =:tangle yes=.
488 - no :: the default. The source code block is not
489 exported to a source code file. E.g., =:tangle no=.
490 - other :: Any other string passed to the =:tangle= header argument
491 is interpreted as a file basename to which the block will
492 be exported. E.g., =:tangle basename=.
496 :CUSTOM_ID: header-argument-session
499 Start a session for an interpreted language where state is
500 preserved. This applies particularly to the supported languages
501 perl, python, R and ruby.
503 By default, a session is not started.
505 A string passed to the =:session= header argument will give the
506 session a name. This makes it possible to run concurrent
507 sessions for each interpreted language.
509 Results are handled somewhat differently if a session is invoked.
512 | | non-session (default) | =:session= |
513 |-------------------+--------------------------+-------------------------------------|
514 | =:results value= | value of last expression | value of last expression |
515 | =:results output= | contents of stdout | concatenation of interpreter output |
519 *Note:* With =:results value=, the result in both =:session= and
520 non-session is returned to Org-mode as a table (a one- or
521 two-dimensional vector of strings or numbers) when appropriate.
524 ***** =:results value=
525 This is the default. Internally, the value is obtained by
526 wrapping the code in a function definition in the external
527 language, and evaluating that function. Therefore, code should be
528 written as if it were the body of such a function. In particular,
529 note that python does not automatically return a value from a
530 function unless a =return= statement is present, and so a
531 'return' statement will usually be required in python.
533 This is the only one of the four evaluation contexts in which the
534 code is automatically wrapped in a function definition.
536 ***** =:results output=
537 The code is passed to the interpreter as an external process, and
538 the contents of the standard output stream are returned as
539 text. (In certain languages this also contains the error output
540 stream; this is an area for future work.)
543 ***** =:results value=
544 The code is passed to the interpreter running as an interactive
545 Emacs inferior process. The result returned is the result of the
546 last evaluation performed by the interpreter. (This is obtained in
547 a language-specific manner: the value of the variable =_= in
548 python and ruby, and the value of =.Last.value= in R).
550 ***** =:results output=
551 The code is passed to the interpreter running as an interactive
552 Emacs inferior process. The result returned is the concatenation
553 of the sequence of (text) output from the interactive
554 interpreter. Notice that this is not necessarily the same as what
555 would be sent to stdout if the same code were passed to a
556 non-interactive interpreter running as an external process. For
557 example, compare the following two blocks:
559 #+begin_src python :results output
569 In non-session mode, the '2' is not printed and does not appear.
571 #+begin_src python :results output :session
582 But in =:session= mode, the interactive interpreter receives input '2'
583 and prints out its value, '2'. (Indeed, the other print statements are
588 :CUSTOM_ID: header-argument-noweb
591 Controls the expansion of [[noweb-reference-syntax][noweb syntax]] references in a
592 source code block. This header argument can have one of two
593 values: =yes= or =no=.
594 - =no= :: the default. No [[noweb-reference-syntax][noweb syntax]] specific action is taken
595 on evaluating source code blocks/ However, noweb references
596 will still be expanded during tangling.
597 - =yes= :: all [[noweb-reference-syntax][noweb syntax]] references in the body of the source
598 code block will be expanded before the block is evaluated.
600 **** Noweb Prefix Lines
602 Noweb insertions are now placed behind the line prefix of the
605 This behavior is illustrated in the following example. Because
606 the =<<example>>= noweb reference appears behind the SQL
607 comment syntax, each line of the expanded noweb reference will
610 This source code block:
621 -- multi-line body of example
624 Note that noweb replacement text that does *not* contain any
625 newlines will not be affected by this change, so it is still
626 possible to use inline noweb references.
628 Thanks to Sébastien Vauban for this idea.
632 :CUSTOM_ID: header-argument-cache
635 Controls the use of in-buffer caching of source code block
636 results to avoid re-running unchanged source code blocks. This
637 header argument can have one of two values: =yes= or =no=.
638 - =no= :: The default. No caching takes place and the source
639 code block will be run every time it is executed.
640 - =yes= :: every time the source code block is run a sha1 hash of
641 the code and arguments passed to the block will be
642 generated. This hash is packed into the =#+results:= line
643 of the results and will be checked on subsequent executions
644 of the source code block. If the source code block has not
645 changed since the last time it was evaluated, it will not be
648 * Noweb Reference Syntax
650 :CUSTOM_ID: noweb-reference-syntax
653 The [[http://www.cs.tufts.edu/~nr/noweb/][Noweb]] Literate Programming system allows named blocks of code to
654 be referenced by using the familiar Noweb syntax:
655 : <<code-block-name>>
657 Noweb references are handled differently during evaluation and
660 When a document is tangled, Noweb references are replaced with the
661 named source code block.
663 When a source code block is evaluated, the action depends upon the
664 value of the =:noweb= header argument. If =:noweb yes=, then a
665 Noweb reference is expanded before evaluation. If =:noweb no=,
666 the default, then the reference is not expanded before
669 *Note:* the default value, =:noweb no=, was chosen to ensure that
670 Org-babel does not break correct code in a language, such as Ruby,
671 where =<<arg>>= is a syntactically valid construct. If =<<arg>>= is
672 not syntactically valid in languages that you use, then please
673 consider [[*System%20wide][setting the default value]].
675 An example that uses the Noweb reference syntax is provided in the
676 [[literate programming example]].
678 * Key Bindings & Useful Functions
680 Org-babel re-binds many common Org-mode key sequences depending on
681 the context. When in a source-code block the following sequences
683 | \C-c \C-c | [[function-org-babel-execute][org-babel-execute-src-block]] |
684 | \C-c \C-o | [[function-org-babel-open-src-block-result][org-babel-open-src-block-result]] |
685 | \C-up | [[function-org-babel-load-in-session][org-babel-load-in-session]] |
686 | \M-down | [[function-org-babel-pop-to-session][org-babel-pop-to-session]] |
688 Org-babel also exposes a number of functions behind a the common
689 org-babel-key-prefix of "\C-c \M-b". These functions are as follows
690 #+begin_src emacs-lisp :exports none
692 (list (format "\\C-c \\M-b %s"
694 (format "[[function-%s][%s]]"
695 (cdr binding) (cdr binding))))
696 org-babel-key-bindings)
698 | \C-c \M-b t | [[function-org-babel-tangle][org-babel-tangle]] |
699 | \C-c \M-b T | [[function-org-babel-tangle-file][org-babel-tangle-file]] |
700 | \C-c \M-b e | [[function-org-babel-execute-src-block][org-babel-execute-src-block]] |
701 | \C-c \M-b s | [[function-org-babel-execute-subtree][org-babel-execute-subtree]] |
702 | \C-c \M-b b | [[function-org-babel-execute-buffer][org-babel-execute-buffer]] |
703 | \C-c \M-b h | [[function-org-babel-sha1-hash][org-babel-sha1-hash]] |
704 | \C-c \M-b g | [[function-org-babel-goto-named-source-block][org-babel-goto-named-source-block]] |
705 | \C-c \M-b l | [[function-org-babel-lob-ingest][org-babel-lob-ingest]] |
708 *** org-babel-execute-src-block
710 :CUSTOM_ID: function-org-babel-execute-src-block
714 org-babel-execute-src-block is an interactive Lisp function in
717 (org-babel-execute-src-block &optional ARG INFO PARAMS)
719 Execute the current source code block, and insert the results
720 into the buffer. Source code execution and the collection and
721 formatting of results can be controlled through a variety of
724 Optionally supply a value for INFO in the form returned by
725 `org-babel-get-src-block-info'.
727 Optionally supply a value for PARAMS which will be merged with
728 the header arguments specified at the front of the source code
732 *** org-babel-open-src-block-result
734 :CUSTOM_ID: function-org-babel-open-src-block-result
738 org-babel-open-src-block-result is an interactive Lisp function in
741 (org-babel-open-src-block-result &optional RE-RUN)
743 If `point' is on a src block then open the results of the
744 source code block, otherwise return nil. With optional prefix
745 argument RE-RUN the source-code block is evaluated even if
746 results already exist.
749 *** org-babel-load-in-session
751 :CUSTOM_ID: function-org-babel-load-in-session
755 org-babel-load-in-session is an interactive Lisp function in
758 (org-babel-load-in-session &optional ARG INFO)
760 Load the body of the current source-code block. Evaluate the
761 header arguments for the source block before entering the
762 session. After loading the body this pops open the session.
767 *** org-babel-pop-to-session
769 :CUSTOM_ID: function-org-babel-pop-to-session
773 org-babel-pop-to-session is an interactive Lisp function in
776 (org-babel-pop-to-session &optional ARG INFO)
778 Pop to the session of the current source-code block. If
779 called with a prefix argument then evaluate the header arguments
780 for the source block before entering the session. Copy the body
781 of the source block to the kill ring.
788 :CUSTOM_ID: function-org-babel-tangle
792 org-babel-tangle is an interactive Lisp function in
793 `org-babel-tangle.el'.
795 It is bound to C-c M-b t.
797 (org-babel-tangle &optional TARGET-FILE LANG)
799 Extract the bodies of all source code blocks from the current
800 file into their own source-specific files. Optional argument
801 TARGET-FILE can be used to specify a default export file for all
802 source blocks. Optional argument LANG can be used to limit the
803 exported source code blocks by language.
806 *** org-babel-execute-subtree
808 :CUSTOM_ID: function-org-babel-execute-subtree
812 org-babel-execute-subtree is an interactive Lisp function in
815 It is bound to C-c M-b s.
817 (org-babel-execute-subtree &optional ARG)
819 Replace EVAL snippets in the entire subtree.
822 *** org-babel-execute-buffer
824 :CUSTOM_ID: function-org-babel-execute-buffer
828 org-babel-execute-buffer is an interactive Lisp function in
831 It is bound to C-c M-b b.
833 (org-babel-execute-buffer &optional ARG)
835 Replace EVAL snippets in the entire buffer.
838 *** org-babel-sha1-hash
840 :CUSTOM_ID: function-org-babel-sha1-hash
844 org-babel-sha1-hash is an interactive Lisp function in `org-babel.el'.
846 It is bound to C-c M-b h.
848 (org-babel-sha1-hash &optional INFO)
853 *** org-babel-goto-named-source-block
855 :CUSTOM_ID: function-org-babel-goto-named-source-block
859 org-babel-goto-named-source-block is an interactive Lisp function in
862 It is bound to C-c M-b g.
864 (org-babel-goto-named-source-block &optional NAME)
866 Go to a named source-code block.
869 *** org-babel-lob-ingest
871 :CUSTOM_ID: function-org-babel-lob-ingest
875 org-babel-lob-ingest is an interactive Lisp function in
878 It is bound to C-c M-b l.
880 (org-babel-lob-ingest &optional FILE)
882 Add all source-blocks defined in FILE to `org-babel-library-of-babel'.
886 It is possible to call Org-babel functions from the command line.
887 This shell script calls `[[function-org-babel-tangle][org-babel-tangle]]' on every one of it's
890 Be sure to adjust the paths to fit your system.
893 # -*- mode: shell-script -*-
895 # tangle a file with org-babel
900 # wrap each argument in the code required to call tangle on it
902 FILES="$FILES \"$i\""
907 (add-to-list 'load-path (expand-file-name \"~/src/org/lisp/\"))
908 (add-to-list 'load-path (expand-file-name \"~/src/org/contrib/lisp/\"))
909 (require 'org)(require 'org-exp)(require 'org-babel)
911 (find-file (expand-file-name file \"$DIR\"))
913 (kill-buffer)) '($FILES)))"
918 [fn:1] The former use of the =shell= identifier is now deprecated.