o-b-worg.org: general proofreading / editing
This commit is contained in:
parent
afcebc3edd
commit
14be1aed89
|
@ -68,7 +68,7 @@
|
||||||
3) Finally, activate the subset of supported Org-babel languages
|
3) Finally, activate the subset of supported Org-babel languages
|
||||||
which you want to be able to execute on your system. As an
|
which you want to be able to execute on your system. As an
|
||||||
example, the following activates python, ruby and R. For a full
|
example, the following activates python, ruby and R. For a full
|
||||||
list of languages and notes on their dependencies see the
|
list of languages, with notes on their dependencies see the
|
||||||
[[#reference-and-documentation][Reference / Documentation]] section below.
|
[[#reference-and-documentation][Reference / Documentation]] section below.
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(require 'org-babel-python)
|
(require 'org-babel-python)
|
||||||
|
@ -90,15 +90,15 @@
|
||||||
:END:
|
:END:
|
||||||
|
|
||||||
Org-babel is all about *source code blocks* in org mode. These are
|
Org-babel is all about *source code blocks* in org mode. These are
|
||||||
blocks of code (in whatever language), surrounded by special
|
blocks of code (in whatever language), that can occur anywhere in
|
||||||
starting and ending lines. For example, the following is a source
|
an org-mode file. For example, the following is a source block
|
||||||
block containing [[http://www.ruby-lang.org/][ruby]] code:
|
containing [[http://www.ruby-lang.org/][ruby]] code:
|
||||||
|
|
||||||
: #+begin_src ruby
|
: #+begin_src ruby
|
||||||
: "This file was last evaluated on #{Date.today}"
|
: "This file was last evaluated on #{Date.today}"
|
||||||
: #+end_src
|
: #+end_src
|
||||||
|
|
||||||
If you are unfamiliar with the notion of source code blocks in
|
If you are unfamiliar with the notion of a source code block in
|
||||||
org-mode, please have a look at the [[http://orgmode.org/manual/Literal-examples.html][relevant manual section]] before
|
org-mode, please have a look at the [[http://orgmode.org/manual/Literal-examples.html][relevant manual section]] before
|
||||||
proceding.
|
proceding.
|
||||||
|
|
||||||
|
@ -129,9 +129,11 @@ allows the plain text version to be viewed (non-interactively) in a web browser.
|
||||||
For interpreted languages such as shell, python, R, etc, org-babel
|
For interpreted languages such as shell, python, R, etc, org-babel
|
||||||
allows source blocks to be executed: the code is passed to the
|
allows source blocks to be executed: the code is passed to the
|
||||||
interpreter and you have control over what is done with the results of
|
interpreter and you have control over what is done with the results of
|
||||||
excecution. E.g. place point anywhere in the following blocks and use
|
excecution. Here are three examples of code blocks in three different
|
||||||
=C-c C-c= to run the code[fn:1]. In the first two cases the code comes
|
languages, followed by their output. If you are viewing the plain text
|
||||||
first, followed by the results of evlauting the block.
|
version of this document in emacs, place point anywhere inside the
|
||||||
|
blocks and use =C-c C-c= to run the code[fn:1] (and feel free to alter
|
||||||
|
it!).
|
||||||
|
|
||||||
**** Ruby
|
**** Ruby
|
||||||
#+begin_src ruby
|
#+begin_src ruby
|
||||||
|
@ -174,21 +176,24 @@ The basic syntax of source-code blocks in Org-babel is as follows:
|
||||||
: #+end_src
|
: #+end_src
|
||||||
|
|
||||||
- name :: This name is associated with the source-code block. This is
|
- name :: This name is associated with the source-code block. This is
|
||||||
similar to the =#+TBLNAME= lines which can be used to name tables
|
similar to the =#+tblname= lines which can be used to name tables
|
||||||
in org-mode files. By referencing the srcname of a source-code
|
in org-mode files. By referencing the srcname of a source-code
|
||||||
block it is possible to evaluate the block from other places,
|
block it is possible to evaluate the block from other places,
|
||||||
files, or from inside tables.
|
files, or from inside tables.
|
||||||
- arguments :: Code blocks can have arguments (see [[#arguments-to-source-code-blocks][below]]) which are
|
- arguments :: Code blocks can have arguments (see [[#arguments-to-source-code-blocks][below]]) which are
|
||||||
provided using a familiar function-call syntax similar
|
provided using a familiar function-call syntax similar
|
||||||
to (e.g.) python or R.
|
to (e.g.) python or R.
|
||||||
- language :: The language of the code in the source-code block, valid
|
- language :: The language of the code in the source-code block. Valid
|
||||||
values must be members of `org-babel-interpreters'.
|
values must be members of `org-babel-interpreters'.
|
||||||
- header-arguments :: Header arguments control many facets of the
|
- header-arguments :: Header arguments control many facets of the
|
||||||
evaluation, and output of source-code blocks. See the [[* Header Arguments][Header
|
evaluation and output of source-code blocks. See the [[* Header Arguments][Header
|
||||||
Arguments]] section for a complete review of available header
|
Arguments]] section for a complete review of available header
|
||||||
arguments.
|
arguments.
|
||||||
- body :: The actual source code which will be evaluated. This can be
|
- body :: The actual source code which will be evaluated. An
|
||||||
edited with `org-edit-special'.
|
important key-binding to become familiar with is =C-c
|
||||||
|
'=. This calls `org-edit-special' which brings up an edit
|
||||||
|
buffer containing the code using the emacs major mode
|
||||||
|
appropriate to the language.
|
||||||
|
|
||||||
*** What happens to the results?
|
*** What happens to the results?
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
|
@ -227,7 +232,7 @@ the last statement, and nothing else.
|
||||||
as a 'scripting' mode: the code block contains a series of
|
as a 'scripting' mode: the code block contains a series of
|
||||||
commands, and you get the output of all the commands. Unlike in
|
commands, and you get the output of all the commands. Unlike in
|
||||||
the 'functional' mode, the code block has no return value. (This
|
the 'functional' mode, the code block has no return value. (This
|
||||||
mode will be familiar to Sweave users).
|
mode will be more familiar to Sweave users).
|
||||||
|
|
||||||
Now consider the result of evaluating the same source block as
|
Now consider the result of evaluating the same source block as
|
||||||
before, but under scripting mode.
|
before, but under scripting mode.
|
||||||
|
|
Loading…
Reference in New Issue