~bzg/worg

729b967982ffd0869a3a13c3fa2f79376c206ea2 — Ihor Radchenko 2 months ago 1c56837
Escape #+ and * inside all the example blocks and src blocks
M exporters/ox-groff.org => exporters/ox-groff.org +16 -16
@@ 465,9 465,9 @@ processing.

For example:
#+begin_example
   #+begin_src emacs-lisp
   ,#+begin_src emacs-lisp
     (message "Hello World")
   #+end_src
   ,#+end_src
#+end_example

The resultant text will have Groff formatted text that corresponds to


@@ 542,16 542,16 @@ Groff commands can be exported literally by surrounding the text on a
pair of #+BEGIN_GROFF/#+END_GROFF lines.  These are a couple of
commands that can be useful during export to control the output.

#+begin_src dummy
#+BEGIN_GROFF
#+begin_src org
,#+BEGIN_GROFF
.SK
#+END_GROFF
,#+END_GROFF
#+end_src

Page break. Skips to a new page.

#+begin_src dummy
#+BEGIN_GROFF
#+begin_src org
,#+BEGIN_GROFF
.DS C
.EQ



@@ 559,20 559,20 @@ Page break. Skips to a new page.
.EN
.DE
.EC
#+END_GROFF
,#+END_GROFF
#+end_src

EQN escape. This is used to add equations in your exported document. The
Groff export uses the =eqn= processor to add them in your output. EQN
statements must be placed between .EQ and .EN.

#+begin_src dummy
#+BEGIN_GROFF
#+begin_src org
,#+BEGIN_GROFF
.AS

.AE
.MT 0
#+END_GROFF
,#+END_GROFF
#+end_src

Used with the dummy document class, it can be used to add an abstract block to


@@ 607,7 607,7 @@ solvable.
    2. For images generated directly from an Org mode table will have
       to be included afterwards after its generation.  For example:
       #+BEGIN_EXAMPLE
         #+PLOT: title "X" ... set:"term gpic" "set:output 'table.pic'"
         ,#+PLOT: title "X" ... set:"term gpic" "set:output 'table.pic'"
         | a | b | c |
         | 1 | 2 | 3 |
         [[file:table.pic]]


@@ 615,17 615,17 @@ solvable.
    3. While using Org Babel, gpic output specification needs to be
       stated. Otherwise, the image will not be included on export.
       #+BEGIN_EXAMPLE
         #+begin_src gnuplot :file salida.pic
         ,#+begin_src gnuplot :file salida.pic
           set term gpic
           plot sin(x)
         #+end_src
         ,#+end_src
       #+END_EXAMPLE
- PlantUML :: Plantuml is supported but the output type must be
              EPS. This is done by using /.eps/ as the file suffix.
  #+BEGIN_EXAMPLE
     #+begin_src plantuml :file x.eps
     ,#+begin_src plantuml :file x.eps
        [A] --> [B]
     #+end_src
     ,#+end_src
  #+END_EXAMPLE
- Other Babel Graphics :: Other babel graphics should be supported if
     either PS, EPS or GnuPIC are used as their output format.

M org-contrib/babel/examples/finances.org => org-contrib/babel/examples/finances.org +34 -34
@@ 2,13 2,13 @@ I like to track my expenses in Org tables.  For example:

#+begin_src org
  ,#+tblname: daily-expenses
  ,| Expense | Category |
  ,|---------+----------|
  ,|       2 | Food     |
  ,|       1 | House    |
  ,|      10 | Clothes  |
  ,|       3 | Food     |
  ,|       5 | House    |
  | Expense | Category |
  |---------+----------|
  |       2 | Food     |
  |       1 | House    |
  |      10 | Clothes  |
  |       3 | Food     |
  |       5 | House    |
#+end_src

At the of the month, I want to see how much was spent in each


@@ 17,26 17,26 @@ category.  I wrote the following Babel function to calculate this:
#+begin_src org
  ,#+name: group-categories
  ,#+begin_src emacs-lisp :var table=daily-expenses :colnames nil
  ,  (defun category-sums (catcol valcol)
  ,    "Sum each of the categories in an Org table.
  ,  
  ,  \(fn CATEGORYCOLUMN VALUECOLUMN)"
  ,    (let (gcats
  ,          result)
  ,      (dolist (row table)
  ,        (let ((cat (nth (1- catcol) row)))
  ,          (when (not (member cat gcats))
  ,            (push cat gcats))))
  ,      (dolist (gcat gcats)
  ,        (let ((sum 0))
  ,          (dolist (row table)
  ,            (let ((val (nth (1- valcol) row))
  ,                  (cat (nth (1- catcol) row)))
  ,              (when (equal gcat cat)
  ,                (cl-incf sum val))))
  ,          (push (list gcat sum) result)))
  ,      result))
  ,  (category-sums 2 1)
    (defun category-sums (catcol valcol)
      "Sum each of the categories in an Org table.
    
    \(fn CATEGORYCOLUMN VALUECOLUMN)"
      (let (gcats
            result)
        (dolist (row table)
          (let ((cat (nth (1- catcol) row)))
            (when (not (member cat gcats))
              (push cat gcats))))
        (dolist (gcat gcats)
          (let ((sum 0))
            (dolist (row table)
              (let ((val (nth (1- valcol) row))
                    (cat (nth (1- catcol) row)))
                (when (equal gcat cat)
                  (cl-incf sum val))))
            (push (list gcat sum) result)))
        result))
    (category-sums 2 1)
  ,#+end_src
#+end_src



@@ 44,11 44,11 @@ Here is an example of the output:

#+begin_src org
  ,#+results: group-categories
  ,| Category | Expense |
  ,|----------+---------|
  ,| Food     |       5 |
  ,| House    |       6 |
  ,| Clothes  |      10 |
  | Category | Expense |
  |----------+---------|
  | Food     |       5 |
  | House    |       6 |
  | Clothes  |      10 |
#+end_src

Dan Davison provided an alternate way of doing this using an R


@@ 56,8 56,8 @@ function:

#+begin_src org
  ,#+begin_src R :var tab=daily-expenses :colnames yes
  ,  attach(tab)
  ,  aggregate(Expense ~ Category, FUN=sum)
    attach(tab)
    aggregate(Expense ~ Category, FUN=sum)
  ,#+end_src
#+end_src


M org-contrib/babel/how-to-use-Org-Babel-for-R.org => org-contrib/babel/how-to-use-Org-Babel-for-R.org +6 -6
@@ 48,20 48,20 @@ followed by TAB key.  Then a skeleton like the following is
automatically inserted:

#+begin_example
#+begin_src 
,#+begin_src 

#+end_src
,#+end_src
#+end_example

All you need to do next is type a single letter =R= in the header and
begin typing R code:

#+begin_example
#+begin_src R
,#+begin_src R
  ## Edit Your R Code Here.
  x <- rnorm(100)
  summary(x)
#+end_src
,#+end_src
#+end_example

I recommend you to edit R code in [[http://ess.r-project.org/][ESS]] (Emacs Speaks Statistics) mode by


@@ 153,12 153,12 @@ example file.
  you try to use

  #+begin_example
  #+MACRO: p  :file $1.png :width 1000 :height 800
  ,#+MACRO: p  :file $1.png :width 1000 :height 800
  #+end_example

  to shorten the header to

  #+begin_example
  #+begin_src R {{{p(plot)}}}
  ,#+begin_src R {{{p(plot)}}}
  #+end_example
  

M org-contrib/babel/intro.org => org-contrib/babel/intro.org +1 -1
@@ 30,7 30,7 @@
     (assq-delete-all :nocache org-babel-default-header-args)))

   - It is now possible to fold results by tabbing on the beginning of the
     #+results line.  This can be done automatically to all results on
     =#+results= line.  This can be done automatically to all results on
     opening of a file by adding the following to your org-mode hook

     (add-hook 'org-mode-hook 'org-babel-result-hide-all)

M org-contrib/babel/languages/lang-compat.org => org-contrib/babel/languages/lang-compat.org +168 -168
@@ 69,7 69,7 @@ cases don't apply.
The following examples use this data:

#+begin_example
#+name: int-item-data
,#+name: int-item-data
10
#+end_example



@@ 78,7 78,7 @@ quotes.  This is the expected response:

#+name: int-item-expected
#+begin_example
#+RESULTS:
,#+RESULTS:
: '10'
#+end_example



@@ 86,7 86,7 @@ Some languages return this instead:

#+name: int-item-variant1
#+begin_example
#+RESULTS:
,#+RESULTS:
: '10
: '
#+end_example


@@ 102,9 102,9 @@ endline and C doesn't allow multiline string literals.

**** java
#+begin_example
#+begin_src java :results output :var item=int-item-data
,#+begin_src java :results output :var item=int-item-data
System.out.println(String.format("'%s'", item));
#+end_src
,#+end_src
#+end_example

This does not compile because the variable value includes the trailing


@@ 117,22 117,22 @@ print("'{}'".format(item))
#+end_example
**** elisp
#+begin_example
#+begin_src elisp :results output :var item=int-item-data
,#+begin_src elisp :results output :var item=int-item-data
(princ (format "'%s'" item))
#+end_src
,#+end_src
#+end_example
**** shell
#+begin_example
#+begin_src sh :results output :var item=int-item-data
,#+begin_src sh :results output :var item=int-item-data
echo "'$item'"
#+end_src
,#+end_src
#+end_example

*** double
The following examples use this data:

#+begin_example
#+name: double-item-data
,#+name: double-item-data
10.1
#+end_example



@@ 141,7 141,7 @@ quotes.  This is the expected response:

#+name: double-item-expected
#+begin_example
#+RESULTS:
,#+RESULTS:
: '10.1'
#+end_example



@@ 149,15 149,15 @@ Some languages return this instead:

#+name: double-item-variant1
#+begin_example
#+RESULTS:
,#+RESULTS:
: '10.1
: '
#+end_example
**** C
#+begin_example
#+begin_src C :results output :var item=double-item-data
,#+begin_src C :results output :var item=double-item-data
printf("'%s'", item);
#+end_src
,#+end_src
#+end_example

This does not compile because the variable value includes the trailing


@@ 165,37 165,37 @@ endline and C doesn't allow multiline string literals.

**** java
#+begin_example
#+begin_src java :results output :var item=double-item-data
,#+begin_src java :results output :var item=double-item-data
System.out.println(String.format("'%s'", item));
#+end_src
,#+end_src
#+end_example

This does not compile because the variable value includes the trailing
endline and java doesn't allow multiline string literals.
**** python
#+begin_example
#+begin_src python :results output :var item=double-item-data
,#+begin_src python :results output :var item=double-item-data
print("'{}'".format(item))
#+end_src
,#+end_src
#+end_example
**** elisp
#+begin_example
#+begin_src elisp :results output :var item=double-item-data
,#+begin_src elisp :results output :var item=double-item-data
(princ (format "'%s'" item))
#+end_src
,#+end_src
#+end_example
**** shell
#+begin_example
#+begin_src sh :results output :var item=double-item-data
,#+begin_src sh :results output :var item=double-item-data
echo "'$item'"
#+end_src
,#+end_src
#+end_example

*** string
The following examples use this data:

#+begin_example
#+name: string-item-data
,#+name: string-item-data
ten
#+end_example



@@ 204,7 204,7 @@ quotes.  This is the expected response:

#+name: string-item-expected
#+begin_example
#+RESULTS:
,#+RESULTS:
: 'ten'
#+end_example



@@ 212,15 212,15 @@ Some languages return this instead:

#+name: string-item-variant1
#+begin_example
#+RESULTS:
,#+RESULTS:
: 'ten
: '
#+end_example
**** C
#+begin_example
#+begin_src C :results output :var item=string-item-data
,#+begin_src C :results output :var item=string-item-data
printf("'%s'", item);
#+end_src
,#+end_src
#+end_example

This does not compile because the variable value includes the trailing


@@ 228,30 228,30 @@ endline and C doesn't allow multiline string literals.

**** java
#+begin_example
#+begin_src java :results output :var item=string-item-data
,#+begin_src java :results output :var item=string-item-data
System.out.println(String.format("'%s'", item));
#+end_src
,#+end_src
#+end_example

This does not compile because the variable value includes the trailing
endline and java doesn't allow multiline string literals.
**** python
#+begin_example
#+begin_src python :results output :var item=string-item-data
,#+begin_src python :results output :var item=string-item-data
print("'{}'".format(item))
#+end_src
,#+end_src
#+end_example
**** elisp
#+begin_example
#+begin_src elisp :results output :var item=string-item-data
,#+begin_src elisp :results output :var item=string-item-data
(princ (format "'%s'" item))
#+end_src
,#+end_src
#+end_example
**** shell
#+begin_example
#+begin_src sh :results output :var item=string-item-data
,#+begin_src sh :results output :var item=string-item-data
echo "'$item'"
#+end_src
,#+end_src
#+end_example

** List


@@ 259,7 259,7 @@ echo "'$item'"
The following examples use this data:

#+begin_example
#+name: int-list-data
,#+name: int-list-data
- 1
- 2
- 3


@@ 269,56 269,56 @@ All examples compute the sum of the numbers in the list.
Output should look like:

#+begin_example
#+RESULTS:
,#+RESULTS:
: 6
#+end_example
**** C
#+begin_example
#+begin_src C :results output :var items=int-list-data
,#+begin_src C :results output :var items=int-list-data
int sum = 0;
for (int ii=0; ii<items_rows; ii++) {
    sum += atoi(items[ii][0]);
}
printf("%d", sum);
#+end_src
,#+end_src
#+end_example

**** java
#+begin_example
#+begin_src java :results value :var items=int-list-data
,#+begin_src java :results value :var items=int-list-data
import java.util.stream.Collectors;
return items.stream()
    .collect(Collectors.summingInt(x -> Integer.parseInt(x.get(0))));
#+end_src
,#+end_src
#+end_example
**** python
#+begin_example
#+begin_src python :var items=int-list-data
,#+begin_src python :var items=int-list-data
return sum([int(x[0]) for x in items])
#+end_src
,#+end_src
#+end_example
**** elisp
#+begin_example
#+begin_src elisp :var items=int-list-data
,#+begin_src elisp :var items=int-list-data
(apply '+ (mapcar (lambda (x) (string-to-number (car x)))
                  items))
#+end_src
,#+end_src
#+end_example
**** shell
#+begin_example
#+begin_src sh :var items=int-list-data
,#+begin_src sh :var items=int-list-data
sum=0
for item in $items; do
    sum=$(($sum + $item))
done
echo $sum
#+end_src
,#+end_src
#+end_example
*** List of doubles
The following examples use this data

#+begin_example
#+name: double-list-data
,#+name: double-list-data
- 1.1
- 2.2
- 3.3


@@ 328,39 328,39 @@ All examples compute the sum of the numbers in the list.
Output should look like:

#+begin_example
#+RESULTS:
,#+RESULTS:
: 6.6
#+end_example
**** C
#+begin_example
#+begin_src C :var items=double-list-data :includes <stdlib.h>
,#+begin_src C :var items=double-list-data :includes <stdlib.h>
double sum = 0;
for (int ii=0; ii<items_rows; ii++) {
    sum += atof(items[ii][0]);
}
printf("%lf", sum);
#+end_src
,#+end_src
#+end_example
**** java
#+begin_example
#+begin_src java :results value :var items=double-list-data
,#+begin_src java :results value :var items=double-list-data
import java.util.stream.Collectors;
return items.stream()
    .collect(Collectors.summingDouble(x -> Double.parseDouble(x.get(0))));
#+end_src
,#+end_src
#+end_example
**** python
#+begin_example
#+begin_src python :var items=double-list-data
,#+begin_src python :var items=double-list-data
return sum([float(x[0]) for x in items])
#+end_src
,#+end_src
#+end_example
**** elisp
#+begin_example
#+begin_src elisp :var items=double-list-data
,#+begin_src elisp :var items=double-list-data
(apply '+ (mapcar (lambda (x) (string-to-number (car x)))
                  items))
#+end_src
,#+end_src
#+end_example
**** shell



@@ 369,7 369,7 @@ Shell doesn't support doubles.
The following examples use this data:

#+begin_example
#+name: string-list-data
,#+name: string-list-data
- a
- b
- c


@@ 379,13 379,13 @@ Each example conncatenates the input into a space delimited list.
Output looks like:

#+begin_example
#+RESULTS:
,#+RESULTS:
: a b c
#+end_example

**** C
#+begin_example
#+begin_src C :results output :var items=string-list-data :include <string.h>
,#+begin_src C :results output :var items=string-list-data :include <string.h>
char ret[8];
memset(ret, 0, 8);
for (int ii=0; ii<items_rows; ii++) {


@@ 393,38 393,38 @@ for (int ii=0; ii<items_rows; ii++) {
    strcat(ret, items[ii][0]);
}
printf("%s", ret);
#+end_src
,#+end_src
#+end_example
**** java
#+begin_example
#+begin_src java :results value :var items=string-list-data
,#+begin_src java :results value :var items=string-list-data
import java.util.stream.Collectors;
return items.stream()
    .map(x -> x.get(0))
    .collect(Collectors.joining(" "));
#+end_src
,#+end_src
#+end_example
**** python
#+begin_example
#+begin_src python :var items=string-list-data
,#+begin_src python :var items=string-list-data
return " ".join([x[0] for x in items])
#+end_src
,#+end_src
#+end_example
**** elisp
#+begin_example
#+begin_src elisp :var items=string-list-data
,#+begin_src elisp :var items=string-list-data
(mapconcat #'car items " ")
#+end_src
,#+end_src
#+end_example
**** shell
#+begin_example
#+begin_src sh :var items=string-list-data
,#+begin_src sh :var items=string-list-data
ret=""
for item in $items; do
    ret="$ret $item"
done
echo $ret
#+end_src
,#+end_src
#+end_example
*** Singleton List
There is inconsistent behavior between lists of one vs many items.


@@ 433,7 433,7 @@ See [[*Trimming a List to One Item][Trimming a List to One Item]] for details.
The following examples use this data:

#+begin_example
#+name: single-list-data
,#+name: single-list-data
- one
#+end_example



@@ 441,7 441,7 @@ Each source block just iterates over the input list, printing each
value.  Expected output is:

#+begin_example
#+RESULTS:
,#+RESULTS:
: one
#+end_example



@@ 449,7 449,7 @@ Some languages give this result:

#+name: single-variant1
#+begin_example
#+RESULTS:
,#+RESULTS:
: o
: n
: e


@@ 457,56 457,56 @@ Some languages give this result:

**** C
#+begin_example
#+begin_src C :results output :var items=single-list-data[,0] :include <string.h>
,#+begin_src C :results output :var items=single-list-data[,0] :include <string.h>
for (int ii=0; ii<items_cols; ii++) {
    printf("%s\n", items[ii]);
}
#+end_src
,#+end_src
#+end_example

This doesn't compile since =items= is passed as a =char*= instead of
=char*[]=.
**** java
#+begin_example
#+begin_src java :var items=single-list-data[,0]
,#+begin_src java :var items=single-list-data[,0]
for (String item : items)
   System.out.println(item);
#+end_src
,#+end_src
#+end_example

This doesn't compile since =items= is passed as a =String= instead of
=String[]=.
**** python
#+begin_example
#+begin_src python :results output :var items=single-list-data[,0]
,#+begin_src python :results output :var items=single-list-data[,0]
for item in items:
    print(item)
#+end_src
,#+end_src
#+end_example
**** elisp
#+begin_example
#+begin_src elisp :results output :var items=single-list-data[,0]
,#+begin_src elisp :results output :var items=single-list-data[,0]
(dolist (item items)
  (princ (format "%s\n" item)))
#+end_src
,#+end_src
#+end_example

This fails with a type error because =items= is passed as a string
instead of a list.
**** shell
#+begin_example
#+begin_src sh :var items=single-list-data[,0]
,#+begin_src sh :var items=single-list-data[,0]
for item in $items; do
    echo $item
done
#+end_src
,#+end_src
#+end_example
** Table
*** Table of ints
The following source blocks operate on this table:

#+begin_example
#+name: int-table-data
,#+name: int-table-data
| 1 | 2 |
| 3 | 4 |
#+end_example


@@ 515,12 515,12 @@ Each source block sums the values found in the table.  The output show
look like:

#+begin_example
#+RESULTS:
,#+RESULTS:
: 10
#+end_example
**** C
#+begin_example
#+begin_src C :var items=int-table-data
,#+begin_src C :var items=int-table-data
int sum = 0;
for (int ii=0; ii<items_rows; ii++) {
    for (int jj=0; jj<items_cols; jj++) {


@@ 528,11 528,11 @@ for (int ii=0; ii<items_rows; ii++) {
    }
 }
printf("%d", sum);
#+end_src
,#+end_src
#+end_example
**** java
#+begin_example
#+begin_src java :results value :var items=int-table-data
,#+begin_src java :results value :var items=int-table-data
int sum = 0;
for (List<Integer> row : items) {
    for (Integer col : row) {


@@ 540,23 540,23 @@ for (List<Integer> row : items) {
    }
}
return sum;
#+end_src
,#+end_src
#+end_example
**** python
#+begin_example
#+begin_src python :var items=int-table-data
,#+begin_src python :var items=int-table-data
sum = 0
for row in items:
    for col in row:
        sum += col
return sum
#+end_src
,#+end_src
#+end_example
**** elisp
#+begin_example
#+begin_src elisp :var items=int-table-data
,#+begin_src elisp :var items=int-table-data
(apply '+ (mapcar (lambda (x) (apply '+ x)) items))
#+end_src
,#+end_src
#+end_example
**** shell
The table becomes an associated list instead of a 2d array.  Bash


@@ 565,7 565,7 @@ doesn't support multidimensional arrays.
The following source blocks operate on this table:

#+begin_example
#+name: double-table-data
,#+name: double-table-data
| 1.1 | 2.3 |
| 3.1 | 4.3 |
#+end_example


@@ 574,12 574,12 @@ Each source block sums the values found in the table.  The output show
look like:

#+begin_example
#+RESULTS:
,#+RESULTS:
: 10.8
#+end_example
**** C
#+begin_example
#+begin_src C :var items=double-table-data
,#+begin_src C :var items=double-table-data
double sum = 0;
for (int ii=0; ii<items_rows; ii++) {
    for (int jj=0; jj<items_cols; jj++) {


@@ 587,11 587,11 @@ for (int ii=0; ii<items_rows; ii++) {
    }
 }
printf("%lf", sum);
#+end_src
,#+end_src
#+end_example
**** java
#+begin_example
#+begin_src java :results value :var items=double-table-data
,#+begin_src java :results value :var items=double-table-data
double sum = 0;
for (List<Double> row : items) {
    for (Double col : row) {


@@ 599,23 599,23 @@ for (List<Double> row : items) {
    }
}
return sum;
#+end_src
,#+end_src
#+end_example
**** python
#+begin_example
#+begin_src python :var items=double-table-data
,#+begin_src python :var items=double-table-data
sum = 0
for row in items:
    for col in row:
        sum += col
return sum
#+end_src
,#+end_src
#+end_example
**** elisp
#+begin_example
#+begin_src elisp :var items=double-table-data
,#+begin_src elisp :var items=double-table-data
(apply '+ (mapcar (lambda (x) (apply '+ x)) items))
#+end_src
,#+end_src
#+end_example
**** shell
The table becomes an associated list instead of a 2d array.  Bash


@@ 624,7 624,7 @@ doesn't support multidimensional arrays.
The following source blocks operate on this table:

#+begin_example
#+name: string-table-data
,#+name: string-table-data
| a | b |
| c | d |
#+end_example


@@ 633,12 633,12 @@ concatenates the strings found in the table. The output show
look like:

#+begin_example
#+RESULTS:
,#+RESULTS:
: a b c d
#+end_example
**** C
#+begin_example
#+begin_src C :results output :var items=string-table-data :includes <string.h>
,#+begin_src C :results output :var items=string-table-data :includes <string.h>
char ret[8];
memset(ret, 0, 8);
for (int ii=0; ii<items_rows; ii++) {


@@ 648,29 648,29 @@ for (int ii=0; ii<items_rows; ii++) {
    }
 }
printf("%s", ret);
#+end_src
,#+end_src
#+end_example
**** java
#+begin_example
#+begin_src java :results value :var items=string-table-data
,#+begin_src java :results value :var items=string-table-data
import java.util.stream.Collectors;
return items.stream()
    .map(x -> String.join(" ", x))
    .collect(Collectors.joining(" "));
#+end_src
,#+end_src
#+end_example
**** python
#+begin_example
#+begin_src python :var items=string-table-data
,#+begin_src python :var items=string-table-data
return " ".join([" ".join(x) for x in items])
#+end_src
,#+end_src
#+end_example
**** elisp
#+begin_example
#+begin_src elisp :var items=string-table-data
,#+begin_src elisp :var items=string-table-data
(mapconcat (lambda (x) (mapconcat #'identity x " "))
           items " ")
#+end_src
,#+end_src
#+end_example
**** shell
The table becomes an associated list instead of a 2d array.  Bash


@@ 703,7 703,7 @@ like an org list.

#+name: list-expected
#+begin_example
#+RESULTS:
,#+RESULTS:
- one
- two
#+end_example


@@ 716,22 716,22 @@ The following examples use =:results value list=.
C has no support for =:results value=.
**** java
#+begin_example
#+begin_src java :results value list
,#+begin_src java :results value list
  String[] ret = {"one", "two"};
  return ret;
#+end_src
,#+end_src
#+end_example
**** python
#+begin_example
#+begin_src python :python python3 :results value list
,#+begin_src python :python python3 :results value list
return ("one", "two")
#+end_src
,#+end_src
#+end_example
**** elisp
#+begin_example
#+begin_src elisp :results value list
,#+begin_src elisp :results value list
'("one" "two")
#+end_src
,#+end_src
#+end_example
*** :results output



@@ 740,39 740,39 @@ use =raw= in order to work.

**** C
#+begin_example
#+begin_src C :results output raw list
,#+begin_src C :results output raw list
printf("one\n");
printf("two\n");
#+end_src
,#+end_src
#+end_example
**** java
#+begin_example
#+begin_src java :results output raw list
,#+begin_src java :results output raw list
System.out.println("one");
System.out.println("two");
#+end_src
,#+end_src
#+end_example
**** python
#+begin_example
#+begin_src python :python python3 :results output raw list
,#+begin_src python :python python3 :results output raw list
print("one")
print("two")
#+end_src
,#+end_src
#+end_example
**** elisp
#+begin_example
#+begin_src elisp :results output raw list
,#+begin_src elisp :results output raw list
  (princ "one\n")
  (princ "two")
#+end_src
,#+end_src
#+end_example

**** shell
#+begin_example
#+begin_src sh :results output raw list
,#+begin_src sh :results output raw list
echo "one"
echo "two"
#+end_src
,#+end_src
#+end_example
** Table



@@ 781,7 781,7 @@ like an org table.

#+name: table-expected
#+begin_example
#+RESULTS:
,#+RESULTS:
| one   | two  |
| three | four |
#+end_example


@@ 790,7 790,7 @@ Some languages return this instead.

#+name: table-variant1
#+begin_example
#+RESULTS:
,#+RESULTS:
: one, two
: three, four
#+end_example


@@ 803,22 803,22 @@ The following examples use =:results value table=.
C has no support for =:results value=.
**** java
#+begin_example
#+begin_src java :results value table
,#+begin_src java :results value table
  String [][] ret = {{"one","two"}, {"three", "four"}};
  return ret;
#+end_src
,#+end_src
#+end_example
**** python
#+begin_example
#+begin_src python :python python3 :results value table
,#+begin_src python :python python3 :results value table
return (("one", "two"), ("three", "four"))
#+end_src
,#+end_src
#+end_example
**** elisp
#+begin_example
#+begin_src elisp :results value table
,#+begin_src elisp :results value table
'(("one" "two") ("three" "four"))
#+end_src
,#+end_src
#+end_example
*** :results output



@@ 826,51 826,51 @@ The following examples use =:results output table=.

**** C
#+begin_example
#+begin_src C :results output table
,#+begin_src C :results output table
printf("one, two\n");
printf("three, four\n");
#+end_src
,#+end_src
#+end_example
**** java
#+begin_example
#+begin_src java :results output table
,#+begin_src java :results output table
System.out.println("one, two");
System.out.println("three, four");
#+end_src
,#+end_src
#+end_example

that fails but this "raw table" output works:

#+begin_example
#+begin_src java :results output raw table
,#+begin_src java :results output raw table
System.out.println("|one| two");
System.out.println("|three| four");
#+end_src
,#+end_src
#+end_example

**** python
#+begin_example
#+begin_src python :python python3 :results output table
,#+begin_src python :python python3 :results output table
  print("one, two")
  print("three, four")
#+end_src
,#+end_src
#+end_example

doesn't work but raw table works
**** elisp
#+begin_example
#+begin_src elisp :results output table
,#+begin_src elisp :results output table
  (princ "one, two\n")
  (princ "three, four")
#+end_src
,#+end_src
#+end_example

doesn't work but raw table works
**** shell
#+begin_example
#+begin_src sh :results output table
,#+begin_src sh :results output table
echo "one, two\nthree, four"
#+end_src
,#+end_src
#+end_example

* Round Trip Between Source Blocks


@@ 878,15 878,15 @@ If a source block (=ret-list-source=) returns a single dimensional
array or list, it becomes an org list (=ret-list-result=).

#+begin_example
#+name: ret-list-source
#+begin_src python :results list
,#+name: ret-list-source
,#+begin_src python :results list
return [1,2,3]
#+end_src
,#+end_src
#+end_example

#+begin_example
#+name: ret-list-result
#+RESULTS: ret-list-source
,#+name: ret-list-result
,#+RESULTS: ret-list-source
- 1
- 2
- 3


@@ 897,14 897,14 @@ from the org buffer, it becomes a two dimensional table with one
column.

#+begin_example
#+name: read-list-result
#+begin_src python :var a=ret-list-result :results list
,#+name: read-list-result
,#+begin_src python :var a=ret-list-result :results list
return a
#+end_src
,#+end_src
#+end_example

#+begin_example
#+RESULTS: read-list-result
,#+RESULTS: read-list-result
- ("1")
- ("2")
- ("3")


@@ 914,14 914,14 @@ But if a source block accepts the output directly from the
=ret-list-source=, the input will be a single dimensional array.

#+begin_example
#+name: read-list-direct
#+begin_src python :var a=ret-list-source :results list
,#+name: read-list-direct
,#+begin_src python :var a=ret-list-source :results list
return a
#+end_src
,#+end_src
#+end_example

#+begin_example
#+RESULTS: read-list-direct
,#+RESULTS: read-list-direct
- 1
- 2
- 3


@@ 933,22 933,22 @@ blocks can access its items as a single dimensional list by indexing.
Given the following data and source block:

#+begin_example
#+name: two-list-data
,#+name: two-list-data
- one
- two
#+end_example

#+begin_example
#+begin_src python :results output :var items=one-list-data[,0]
,#+begin_src python :results output :var items=one-list-data[,0]
for item in items:
    print (item)
#+end_src
,#+end_src
#+end_example

The result, as expected, is:

#+begin_example
#+RESULTS:
,#+RESULTS:
: one
: two
#+end_example


@@ 957,7 957,7 @@ But if the list only contains one item, as in =one-list-data=, it is
no longer passed to the source block as a list.

#+begin_example
#+name: one-list-data
,#+name: one-list-data
- one
#+end_example



@@ 965,7 965,7 @@ Execution of the same source block as used above, but pointing at
=one-list-data=, results in:

#+begin_example
#+RESULTS:
,#+RESULTS:
: o
: n
: e

M org-contrib/babel/languages/ob-doc-C.org => org-contrib/babel/languages/ob-doc-C.org +18 -18
@@ 182,9 182,9 @@ Here is Hello World!

This source code block:
#+begin_example
#+begin_src C :exports results
,#+begin_src C :exports results
  printf ("Hello World!\n");
#+end_src
,#+end_src
#+end_example

yields this result (type =C-c C-c= in the source block):


@@ 200,9 200,9 @@ Hello World!

This source code block:
#+begin_example
#+begin_src C++ :includes <iostream>
,#+begin_src C++ :includes <iostream>
  std::cout<<"Hello World!\n";
#+end_src
,#+end_src
#+end_example

yields this result (type =C-c C-c= in the source block):


@@ 223,9 223,9 @@ Here is Hello World!

This source code block:
#+begin_example
#+begin_src D :exports results
,#+begin_src D :exports results
  writefln ("Hello World!");
#+end_src
,#+end_src
#+end_example

yields this result (type =C-c C-c= in the source block):


@@ 274,18 274,18 @@ Three types are supported, based on the look of the value:

Example in C or C++:
#+begin_example
#+header: :var mystring="Sunday" :var myint=145 :var mydouble=3.14
#+BEGIN_SRC C
,#+header: :var mystring="Sunday" :var myint=145 :var mydouble=3.14
,#+BEGIN_SRC C
  printf ("mystring %s\n", mystring);
  printf ("myint    %d\n", myint);
  printf ("mydouble %g\n", mydouble);
#+END_SRC
,#+END_SRC
#+end_example

yields this result (type =C-c C-c=):

#+begin_example
#+RESULTS:
,#+RESULTS:
| mystring | Sunday |
| myint    |    145 |
| mydouble |   3.14 |


@@ 293,18 293,18 @@ yields this result (type =C-c C-c=):

Example in D:
#+begin_example
#+header: :var mystring="Sunday" :var myint=145 :var mydouble=3.14
#+BEGIN_SRC D
,#+header: :var mystring="Sunday" :var myint=145 :var mydouble=3.14
,#+BEGIN_SRC D
  writefln ("mystring %s", mystring);
  writefln ("myint    %d", myint);
  writefln ("mydouble %g", mydouble);
#+END_SRC
,#+END_SRC
#+end_example

yields this result (type =C-c C-c=):

#+begin_example
#+RESULTS:
,#+RESULTS:
| mystring | Sunday |
| myint    |    145 |
| mydouble |   3.14 |


@@ 383,9 383,9 @@ To convert a string cell to a numeric value on the fly, use standard convertors:
This code:

#+begin_example
#+name: c-table
#+header: :exports results
#+begin_src C++ :var somedata=somedata
,#+name: c-table
,#+header: :exports results
,#+begin_src C++ :var somedata=somedata
  #include "stdlib.h"
  #include "stdio.h"
  int main()


@@ 400,7 400,7 @@ This code:
    }
    return 0;
  }
#+end_src
,#+end_src
#+end_example

yields this result:

M org-contrib/babel/languages/ob-doc-clojure.org => org-contrib/babel/languages/ob-doc-clojure.org +12 -12
@@ 151,9 151,9 @@ Let's start really simple. We will test the evaluation of a
simple Clojure form. Insert the following into the org file:

#+begin_example
#+begin_src clojure :results silent
,#+begin_src clojure :results silent
  (+ 1 4)
#+end_src
,#+end_src
#+end_example
    
Now place the cursor in the code block and enter the command:


@@ 166,9 166,9 @@ Now let's insert the results into the buffer immediately after the Clojure code
block. Insert the following into your org file:

#+begin_example
#+begin_src clojure :results value
,#+begin_src clojure :results value
  [ 1 2 3 4]
#+end_src
,#+end_src
#+end_example

Execute as before:


@@ 178,7 178,7 @@ Execute as before:
Now, immediately following the code block, the following results block will be inserted:

#+begin_example
#+RESULTS
,#+RESULTS
[ 1 2 3 4]
#+end_example



@@ 186,12 186,12 @@ The result of the last form evaluated will be inserted into the results block.

Here is another simple example, with the results of evaluation included:
#+begin_example
#+begin_src clojure :results value
,#+begin_src clojure :results value
  (def small-map {:a 2 :b 4 :c 8})
  (:b small-map)
#+end_src
,#+end_src

#+RESULTS:
,#+RESULTS:
: 4
#+end_example



@@ 221,7 221,7 @@ The following code block shows how the Incanter library is
used to create an x-y line plot.  The =view= function will display the plot. 
The plot is also saved to both PDF and PNG format image files.
#+begin_example
#+begin_src clojure
,#+begin_src clojure
  (use '(incanter core charts pdf))
  ;;; Create the x and y data:
  (def x-data [0.0 1.0 2.0 3.0 4.0 5.0])


@@ 230,13 230,13 @@ The plot is also saved to both PDF and PNG format image files.
  (view xy-line)
  (save-pdf xy-line "incanter-xy-line.pdf")
  (save xy-line "incanter-xy-line.png")
#+end_src
,#+end_src
#+end_example

To insert the image into the exported document, add this code:
#+begin_example
  #+CAPTION: A basic x-y line plot
  #+NAME: fig:xy-line
  ,#+CAPTION: A basic x-y line plot
  ,#+NAME: fig:xy-line
  [[./incanter-xy-line.pdf]]
#+end_example


M org-contrib/babel/languages/ob-doc-eukleides.org => org-contrib/babel/languages/ob-doc-eukleides.org +5 -5
@@ 103,14 103,14 @@ seen in geometry texts. This is for the most part a two part process:
Let's go through this example:

#+begin_example
#+begin_src eukleides :file test.eps
,#+begin_src eukleides :file test.eps
O = point (2,2)
C = circle(O,2)
draw
  O plus 
  C 
end
#+end_src
,#+end_src
#+end_example

There are two shapes being drawn in this example:


@@ 130,14 130,14 @@ execution of an =eukleides= script.

#+begin_example

#+begin_src eukleides :file /dev/null
,#+begin_src eukleides :file /dev/null
write "myfile.txt"
print "Hello"
print 1,2,3
release
#+end_src
,#+end_src

#+RESULTS:
,#+RESULTS:
[[file:/dev/null]]

#+end_example

M org-contrib/babel/languages/ob-doc-gnuplot.org => org-contrib/babel/languages/ob-doc-gnuplot.org +18 -18
@@ 81,7 81,7 @@ like this:

*Data Table* (if pulling from a table and not a formula)
#+BEGIN_EXAMPLE
#+tblname: data-table
,#+tblname: data-table
| x | y1 | y2 |
|---+----+----|
| 0 |  3 |  6 |


@@ 91,11 91,11 @@ like this:

*Gnuplot Source Block*
#+BEGIN_EXAMPLE
#+begin_src gnuplot :var data=data-table :file output.png
,#+begin_src gnuplot :var data=data-table :file output.png

  gnuplot code goes here

#+end_src
,#+end_src
#+END_EXAMPLE

To run gnuplot and produce a resultant graph (or to produce any result


@@ 320,7 320,7 @@ like when all of the above is combined.
** Function Plot
A full babel block of code for a few functions might look like this:
#+begin_example
#+begin_src gnuplot :exports code :file file.png
,#+begin_src gnuplot :exports code :file file.png
reset

set title "Putting it All Together"


@@ 339,7 339,7 @@ g(x) = x**3
h(x) = 10*sqrt(abs(x))

plot f(x) w lp lw 1, g(x) w p lw 2, h(x) w l lw 3
#+end_src
,#+end_src
#+end_example

#+attr_html: :width 800


@@ 407,7 407,7 @@ an example of a running distance log:[fn:6]
|-----------+----------|

#+begin_example
#+begin_src gnuplot :var data=xtics :exports code :file file.png
,#+begin_src gnuplot :var data=xtics :exports code :file file.png
  reset

  set title "Running Stats"


@@ 419,7 419,7 @@ an example of a running distance log:[fn:6]
  set ylabel "Distance (mi)"

  plot data u 2:xticlabels(1) w lp lw 2 notitle
#+end_src
,#+end_src
#+end_example

The =2:xticlabels(1)= tells gnuplot to use the values in column 1 for


@@ 453,7 453,7 @@ values should correspond to these x-values. Here is an example:
|----------+---------+----------|

#+begin_example
#+begin_src gnuplot :var data=named-xtics :exports code :file file.png
,#+begin_src gnuplot :var data=named-xtics :exports code :file file.png
  reset

  set yrange [0:25]


@@ 466,7 466,7 @@ values should correspond to these x-values. Here is an example:
  set title 'War Deaths'

  plot data using 2:3:xticlabels(1) w p lw 3 notitle
#+end_src
,#+end_src
#+end_example

For multiple data sets, simply include multiple columns for y-values


@@ 478,7 478,7 @@ same). Here is an example:
plot data u 2:3:xticlabels(1) title 'Set1',\
data u 2:4:xticlabels(1) title 'Set2', \
data u 2:5:xticlabels(1) title 'Set3'
#+end_src
,#+end_src
#+end_example

** Multiple X/Y Axes


@@ 508,7 508,7 @@ be plotted in the same graph:[fn:18]
|-----------+-------+----------|

#+begin_example
#+begin_src gnuplot :var data=multi-axes :exports code :file file.png
,#+begin_src gnuplot :var data=multi-axes :exports code :file file.png
  reset

  set title "Running Stats"


@@ 529,7 529,7 @@ be plotted in the same graph:[fn:18]
  set style data points
  plot data u 2:xticlabels(1) axis x1y1 lw 3 title 'Time', \
       data u 3:xticlabels(1) axis x1y2 lw 3 title 'Distance'
#+end_src
,#+end_src
#+end_example

Walking through the new items in the code:


@@ 610,7 610,7 @@ Here is some data on the population of the world through time:[fn:12]
|----------+--------+------|

#+begin_example
#+begin_src gnuplot :var data=diff-scales :exports code :file file.png
,#+begin_src gnuplot :var data=diff-scales :exports code :file file.png
  reset

  set xrange [ -10000 : 1 ]


@@ 648,7 648,7 @@ Here is some data on the population of the world through time:[fn:12]
  plot data using 2:3:xticlabels(1) with lines lw 3 notitle

  set nomultiplot
#+end_src
,#+end_src
#+end_example

Walking through the code:


@@ 751,7 751,7 @@ slight modifications.
|-----------+-------+-----+------|

#+begin_example
#+begin_src gnuplot :var data=broken-axis :exports code :file file.png
,#+begin_src gnuplot :var data=broken-axis :exports code :file file.png
  reset

  A=1725


@@ 778,7 778,7 @@ slight modifications.
  set title 'World Population'

  plot data u 2:3:xticlabels(1) w l lw 3 notitle, data u 2:4:xticlabels(1) w l lw 3 lc 1 notitle
#+end_src
,#+end_src
#+end_example

Here are some notes on the above:


@@ 836,12 836,12 @@ acceptable. The mailing list provided an excellent solution
for increased gnuplot image quality:[fn:16]

#+BEGIN_EXAMPLE
#+begin_src gnuplot :file file.eps
,#+begin_src gnuplot :file file.eps
  reset
  set terminal postscript [color] [solid] eps enhanced 20
  ...
  ...
#+end_src
,#+end_src
#+END_EXAMPLE

Note the output to /file.eps/, which corresponds to the =set

M org-contrib/babel/languages/ob-doc-haxe.org => org-contrib/babel/languages/ob-doc-haxe.org +46 -46
@@ 85,13 85,13 @@ headers arguments are optional.
This is hello world:

#+begin_example
#+begin_src haxe :results output
,#+begin_src haxe :results output
  class Main {
      public static function main() {
          Sys.print("hello, world");
      }
  }
#+end_src
,#+end_src
#+end_example

** Class and Main Method Definitions


@@ 105,9 105,9 @@ both omitted, the class will be named =Main=.
This is exactly equivalent to the above hello world:

#+begin_example
#+begin_src haxe :results output
,#+begin_src haxe :results output
  Sys.print("hello, world");
#+end_src
,#+end_src
#+end_example

** Classname and Package Name


@@ 121,9 121,9 @@ contain the package name, such as =com.pkg.Greeter=.  This example
names the class =Greeter= and puts it in the =com.pkg= package.

#+begin_example
#+begin_src haxe :results output :classname com.pkg.Greeter
,#+begin_src haxe :results output :classname com.pkg.Greeter
  Sys.print("hello, world");
#+end_src
,#+end_src
#+end_example

** Source Files and Tangling


@@ 154,17 154,17 @@ We've already seen hello world in scripting mode, but here it is
again:

#+begin_example
#+begin_src haxe :results output
,#+begin_src haxe :results output
  Sys.print("hello, world");
#+end_src
,#+end_src
#+end_example

This is what hello world looks like in functional mode:

#+begin_example
#+begin_src haxe :results value
,#+begin_src haxe :results value
  return "hello, world";
#+end_src
,#+end_src
#+end_example

*** Return a List


@@ 174,16 174,16 @@ show up as a list in the org buffer, notice that the =:results= must
be set to =raw list=.

#+begin_example
#+begin_src haxe :results output raw list
,#+begin_src haxe :results output raw list
  Sys.println("1");
  Sys.println("2");
#+end_src
,#+end_src
#+end_example

This is the output:

#+begin_example
#+RESULTS:
,#+RESULTS:
- 1
- 2
#+end_example


@@ 193,9 193,9 @@ Returning a list in functional mode is straightforward.  Simply say
This example results in identical output to the previous example.

#+begin_example
#+begin_src haxe :results value list
,#+begin_src haxe :results value list
  return [1, 2];
#+end_src
,#+end_src
#+end_example

*** Return a Table


@@ 205,16 205,16 @@ output includes pipe characters to build the table, and the =:results=
header specifies the type is =raw=.

#+begin_example
#+begin_src haxe :results output raw
,#+begin_src haxe :results output raw
  Sys.println("|1|2|3");
  Sys.println("|4|5|6");
#+end_src
,#+end_src
#+end_example

This is the output:

#+begin_example
#+RESULTS:
,#+RESULTS:
| 1 | 2 | 3 |
| 4 | 5 | 6 |
#+end_example


@@ 222,10 222,10 @@ This is the output:
The same output is achieved with the following:

#+begin_example
#+begin_src haxe :results value table
,#+begin_src haxe :results value table
    return [[1, 2, 3],
            [4, 5, 6]];
#+end_src
,#+end_src
#+end_example

*** Return a Table with Headers


@@ 235,18 235,18 @@ hline is created the same way as it is created while editing an org
table, by inserting a =|-= at the start of a line inside the table.

#+begin_example
#+begin_src haxe :results output raw
,#+begin_src haxe :results output raw
  Sys.println("|col1|col2|col3");
  Sys.println("|-");
  Sys.println("|1|2|3");
  Sys.println("|4|5|6");
#+end_src
,#+end_src
#+end_example

This is the output:

#+begin_example
#+RESULTS:
,#+RESULTS:
| col1 | col2 | col3 |
|------+------+------|
|    1 |    2 |    3 |


@@ 259,13 259,13 @@ to using a =List<Object>= since the header row items are =String= but
the rest of the data items are =int=.

#+begin_example
#+begin_src haxe :results value table
,#+begin_src haxe :results value table
  var a :Array<Dynamic> = [["col1", "col2", "col3"],
                           null,
                           [1, 2, 3],
                           [4, 5, 6]];
  return a;
#+end_src
,#+end_src
#+end_example

** Variables


@@ 279,26 279,26 @@ Pass variables with the =:var= header.  Variable types are inferred.
This example accepts two integers and adds them:

#+begin_example
#+begin_src haxe :var a=1 b=2 :results output
,#+begin_src haxe :var a=1 b=2 :results output
  Sys.print("sum: " + (a+b));
#+end_src
,#+end_src
#+end_example

When passing string variables, be sure to escape the quotes, like this:

#+begin_example
#+begin_src haxe :var a="some string" :results output
,#+begin_src haxe :var a="some string" :results output
  Sys.print(a);
#+end_src
,#+end_src
#+end_example

Haxe source code blocks can accept elisp =list= or =vector=.  In
either case the variables are typed as =Array<Dynamic>=.

#+begin_example
#+begin_src haxe :var a='("one" "two") :results output
,#+begin_src haxe :var a='("one" "two") :results output
  Sys.print(a[0] + " " + a[1]);
#+end_src
,#+end_src
#+end_example

This example accepts a named list taken from the org buffer.  Note


@@ 307,13 307,13 @@ that lists appear to be a table with one item in each row.  =a= is a
inside array contains columns.

#+begin_example
#+name: some-list
,#+name: some-list
- one
- two

#+begin_src haxe :var a=some-list :results output
,#+begin_src haxe :var a=some-list :results output
  Sys.print(a[0][0] + " " + a[1][0]);
#+end_src
,#+end_src
#+end_example

Another way to accept an org list is to slice it when it is assigned.


@@ 321,27 321,27 @@ The =[,0]= in this examples selects the first column of each row.  =a=
is still an =Array<Dynamic>= but now each item is a single list item.

#+begin_example
#+name: some-list
,#+name: some-list
- one
- two

#+begin_src haxe :var a=some-list[,0] :results output
,#+begin_src haxe :var a=some-list[,0] :results output
  Sys.print(a[0] + " " + a[1]);
#+end_src
,#+end_src
#+end_example

The following example transposes and doubles the values in a 2x2
table.

#+begin_example
#+name: some-table
,#+name: some-table
| 1 | 2 |
| 3 | 4 |

#+begin_src haxe :var a=some-table :results output
,#+begin_src haxe :var a=some-table :results output
  Sys.println((a[0][0]*2) + " " + (a[1][0]*2));
  Sys.println((a[0][1]*2) + " " + (a[1][1]*2));
#+end_src
,#+end_src
#+end_example

** Imports


@@ 355,24 355,24 @@ blocks that omit the boilerplate class and main method definitions.
This example imports a class using the =:imports= header argument:

#+begin_example
#+begin_src haxe :results output :imports haxe.crypto.Base64 haxe.io.Bytes
,#+begin_src haxe :results output :imports haxe.crypto.Base64 haxe.io.Bytes
  var encoded = Base64.encode(Bytes.ofString("42"));
  var decoded = Base64.decode(encoded);
  Sys.print('encoded=$encoded, decoded=$decoded');
#+end_src
,#+end_src
#+end_example

This is exactly equivalent, but specifies the import within the source
code block:

#+begin_example
#+begin_src haxe :results output
,#+begin_src haxe :results output
  import haxe.crypto.Base64;
  import haxe.io.Bytes;
  var encoded = Base64.encode(Bytes.ofString("42"));
  var decoded = Base64.decode(encoded);
  Sys.print('encoded=$encoded, decoded=$decoded');
#+end_src
,#+end_src
#+end_example

** Source and Class File Locations


@@ 390,9 390,9 @@ In order to override override the default and compile in the current
directory, set the =:dir= parameter on the source code block.

#+begin_example
#+begin_src haxe :results output :dir "."
,#+begin_src haxe :results output :dir "."
  Sys.print("hello, world");
#+end_src
,#+end_src
#+end_example

** Tramp Support

M org-contrib/babel/languages/ob-doc-java.org => org-contrib/babel/languages/ob-doc-java.org +54 -54
@@ 105,13 105,13 @@ headers arguments are optional.
This is hello world:

#+begin_example
#+begin_src java :results output
,#+begin_src java :results output
  public class Main {
      public static void main(String[] args) {
          System.out.print("hello, world");
      }
  }
#+end_src
,#+end_src
#+end_example

** Class and Main Method Definitions


@@ 125,9 125,9 @@ both omitted, the class will be named =Main=.
This is exactly equivalent to the above hello world:

#+begin_example
#+begin_src java :results output
,#+begin_src java :results output
  System.out.print("hello, world");
#+end_src
,#+end_src
#+end_example

** Classname and Package Name


@@ 141,9 141,9 @@ contain the package name, such as =com.package.Greeter=.  This example
names the class =Greeter= and puts it in the =com.package= package.

#+begin_example
#+begin_src java :results output :classname com.package.Greeter
,#+begin_src java :results output :classname com.package.Greeter
  System.out.print("hello, world");
#+end_src
,#+end_src
#+end_example

** Source Files and Tangling


@@ 179,17 179,17 @@ We've already seen hello world in scripting mode, but here it is
again:

#+begin_example
#+begin_src java :results output
,#+begin_src java :results output
  System.out.print("hello, world");
#+end_src
,#+end_src
#+end_example

This is what hello world looks like in functional mode:

#+begin_example
#+begin_src java :results value
,#+begin_src java :results value
  return "hello, world";
#+end_src
,#+end_src
#+end_example

*** Return a List


@@ 199,16 199,16 @@ show up as a list in the org buffer, notice that the =:results= must
be set to =raw list=.

#+begin_example
#+begin_src java :results output raw list
,#+begin_src java :results output raw list
  System.out.println("1");
  System.out.println("2");
#+end_src
,#+end_src
#+end_example

This is the output:

#+begin_example
#+RESULTS:
,#+RESULTS:
- 1
- 2
#+end_example


@@ 218,20 218,20 @@ Returning a list in functional mode is straightforward.  Simply say
example results in identical output to the previous example.

#+begin_example
#+begin_src java :results value list
,#+begin_src java :results value list
  List<Integer> a = Arrays.asList(1, 2);
  return a;
#+end_src
,#+end_src
#+end_example

Another way to achieve the same result is to use an array, as in the
following example.

#+begin_example
#+begin_src java :results value list
,#+begin_src java :results value list
  Integer[] a = {4, 1};
  return a;
#+end_src
,#+end_src
#+end_example

*** Return a Table


@@ 241,16 241,16 @@ output includes pipe characters to build the table, and the =:results=
header specifies the type is =raw=.

#+begin_example
#+begin_src java :results output raw
,#+begin_src java :results output raw
  System.out.println("|1|2|3");
  System.out.println("|4|5|6");
#+end_src
,#+end_src
#+end_example

This is the output:

#+begin_example
#+RESULTS:
,#+RESULTS:
| 1 | 2 | 3 |
| 4 | 5 | 6 |
#+end_example


@@ 258,11 258,11 @@ This is the output:
The same output is achieved with the following:

#+begin_example
#+begin_src java :results value table
,#+begin_src java :results value table
    List<List<Integer>> a = Arrays.asList(Arrays.asList(1, 2, 3),
                                          Arrays.asList(4, 5, 6));
    return a;
#+end_src
,#+end_src
#+end_example

*** Return a Table with Headers


@@ 272,18 272,18 @@ hline is created the same way as it is created while editing an org
table, by inserting a =|-= at the start of a line inside the table.

#+begin_example
#+begin_src java :results output raw
,#+begin_src java :results output raw
  System.out.println("|col1|col2|col3");
  System.out.println("|-");
  System.out.println("|1|2|3");
  System.out.println("|4|5|6");
#+end_src
,#+end_src
#+end_example

This is the output:

#+begin_example
#+RESULTS:
,#+RESULTS:
| col1 | col2 | col3 |
|------+------+------|
|    1 |    2 |    3 |


@@ 296,13 296,13 @@ to using a =List<Object>= since the header row items are =String= but
the rest of the data items are =int=.

#+begin_example
#+begin_src java :results value table
,#+begin_src java :results value table
  List<List<Object>> a = Arrays.asList(Arrays.asList("col1", "col2", "col3"),
                                       null,
                                       Arrays.asList(1, 2, 3),
                                       Arrays.asList(4, 5, 6));
  return a;
#+end_src
,#+end_src
#+end_example

** Variables and Arguments


@@ 317,17 317,17 @@ Pass variables with the =:var= header.  Variable types are inferred.
This example accepts two integers and adds them:

#+begin_example
#+begin_src java :var a=1 b=2 :results output
,#+begin_src java :var a=1 b=2 :results output
  System.out.print("sum: " + (a+b));
#+end_src
,#+end_src
#+end_example

This example passes a string variable:

#+begin_example
#+begin_src java :var a="some string" :results output
,#+begin_src java :var a="some string" :results output
  System.out.print(a);
#+end_src
,#+end_src
#+end_example

Multi-line string literals are not supported in java.  To pass a


@@ 339,9 339,9 @@ either case the variables are typed as =java.util.List=.  In this
example =a= is a =List<String>=.

#+begin_example
#+begin_src java :var a='("one" "two") :results output
,#+begin_src java :var a='("one" "two") :results output
  System.out.print(a.get(0) + " " + a.get(1));
#+end_src
,#+end_src
#+end_example

This example accepts a named list taken from the org buffer.  Note


@@ 351,13 351,13 @@ the inside list contains columns.  See [[*Imports][Imports]] to find out how to
import =List=, or why we didn't do it here.

#+begin_example
#+name: some-list
,#+name: some-list
- one
- two

#+begin_src java :var a=some-list :results output
,#+begin_src java :var a=some-list :results output
  System.out.print(a.get(0).get(0) + " " + a.get(1).get(0));
#+end_src
,#+end_src
#+end_example

Another way to accept a list is to slice it when it is assigned.  The


@@ 365,27 365,27 @@ Another way to accept a list is to slice it when it is assigned.  The
=a= is a =List<String>=.

#+begin_example
#+name: some-list
,#+name: some-list
- one
- two

#+begin_src java :var a=some-list[,0] :results output
,#+begin_src java :var a=some-list[,0] :results output
  System.out.print(a.get(0) + " " + a.get(1));
#+end_src
,#+end_src
#+end_example

The following example transposes and doubles the values in a 2x2
table.  =a= is available as a =List<List<Integer>>=.

#+begin_example
#+name: some-table
,#+name: some-table
| 1 | 2 |
| 3 | 4 |

#+begin_src java :var a=some-table :results output
,#+begin_src java :var a=some-table :results output
  System.out.println((a.get(0).get(0)*2) + " " + (a.get(1).get(0)*2));
  System.out.println((a.get(0).get(1)*2) + " " + (a.get(1).get(1)*2));
#+end_src
,#+end_src
#+end_example

*** Arguments


@@ 395,26 395,26 @@ All arguments are typed as strings.
Here is an example that passes an argument:

#+begin_example
#+begin_src java :results output :cmdargs "argument"
,#+begin_src java :results output :cmdargs "argument"
  System.out.print(args[0]);
#+end_src
,#+end_src
#+end_example

Pass multiple arguments by separating them by spaces.

#+begin_example
#+begin_src java :results output :cmdargs "two arguments"
,#+begin_src java :results output :cmdargs "two arguments"
  System.out.print(args[0] + " " + args[1]);
#+end_src
,#+end_src
#+end_example

In order to pass a string with spaces, quote the string twice and
escape the inner quotes.

#+begin_example
#+begin_src java :results output :cmdargs "\"this is one argument\""
,#+begin_src java :results output :cmdargs "\"this is one argument\""
  System.out.print(args[0]);
#+end_src
,#+end_src
#+end_example

** Imports


@@ 433,23 433,23 @@ The following classes can be used without explicitly importing them:
This example imports a class using the =:imports= header argument:

#+begin_example
#+begin_src java :results output :imports java.util.Base64
,#+begin_src java :results output :imports java.util.Base64
  byte[] encoded = Base64.getEncoder().encode("encoded message".getBytes());
  String decoded = new String(Base64.getDecoder().decode(encoded));
  System.out.print(String.format("encoded=%s, decoded=%s", new String(encoded), decoded));
#+end_src
,#+end_src
#+end_example

This is exactly equivalent, but specifies the import within the source
code block:

#+begin_example
#+begin_src java :results output
,#+begin_src java :results output
  import java.util.Base64;
  byte[] encoded = Base64.getEncoder().encode("encoded message".getBytes());
  String decoded = new String(Base64.getDecoder().decode(encoded));
  System.out.print(String.format("encoded=%s, decoded=%s", new String(encoded), decoded));
#+end_src
,#+end_src
#+end_example

** Source and Class File Locations


@@ 473,9 473,9 @@ source block that will override the default and compile in the babel
temporary directory:

#+begin_example
#+begin_src java :dir 'nil :classname com.package.Greeter
,#+begin_src java :dir 'nil :classname com.package.Greeter
  System.out.print("hello, world");
#+end_src
,#+end_src
#+end_example

To change the default behavior see [[*Configure Defaults][Configure Defaults]].

M org-contrib/babel/languages/ob-doc-lilypond.org => org-contrib/babel/languages/ob-doc-lilypond.org +2 -2
@@ 53,7 53,7 @@ Note that in =basic-mode= a lilypond source block requires a =:file=
parameter as shown below.

#+begin_example
#+begin_src lilypond :file mixolydian.png
,#+begin_src lilypond :file mixolydian.png
\relative c' {
  g a b c
  d e f g


@@ 64,7 64,7 @@ parameter as shown below.
  d c b a
  g1
}
#+end_src
,#+end_src
#+end_example

The previous block will produce an image file in ~.png~ format, which

M org-contrib/babel/languages/ob-doc-mathomatic.org => org-contrib/babel/languages/ob-doc-mathomatic.org +15 -15
@@ 93,12 93,12 @@ in the minibuffer when asked about executing the code.
An example of a Mathomatic  block in Org-babel is as follows:

#+begin_example
#+begin_src mathomatic :results output
,#+begin_src mathomatic :results output
x + 2
eliminate x
#+end_src
,#+end_src

#+RESULTS: mathotest
,#+RESULTS: mathotest
: #1: x = 0
: #2: x + 2
: Eliminating variable x using solved equation #1...


@@ 110,14 110,14 @@ code. using =:results value= will write the results in a table. For
example:

#+begin_example
#+begin_src mathomatic :results value
,#+begin_src mathomatic :results value
x = 0
x + 2
eliminate x
ans = x
#+end_src
,#+end_src

#+RESULTS:
,#+RESULTS:
| #1:         | x        | = |     0 |        |          |       |
| #2:         | x        | + |     2 |        |          |       |
| Eliminating | variable | x | using | solved | equation | #1... |


@@ 136,11 136,11 @@ within Mathomatic: [fn:1]
- Groff PIC =.pic=

#+begin_example
#+begin_src mathomatic :results graphics :file sine.png
,#+begin_src mathomatic :results graphics :file sine.png
plot sin(x)
#+end_src
,#+end_src

#+RESULTS:
,#+RESULTS:
[[file:sine.png]]
#+end_example



@@ 159,13 159,13 @@ aforementioned program later on in your org document.  The following
example is a program that evaluates X+2.

#+begin_example
#+name: mathotest(x=0)
#+begin_src mathomatic :results output
,#+name: mathotest(x=0)
,#+begin_src mathomatic :results output
x + 2
eliminate x
#+end_src
,#+end_src

#+RESULTS: mathotest
,#+RESULTS: mathotest
: #1: x = 0
: #2: x + 2
: Eliminating variable x using solved equation #1...


@@ 176,9 176,9 @@ Calling the named script with a different value will result in a
different execution. For example:

#+begin_example
#+call: mathotest(x=30)
,#+call: mathotest(x=30)

#+RESULTS: mathotest(x=30)
,#+RESULTS: mathotest(x=30)
: #1: x = 30
: #2: x + 2
: Eliminating variable x using solved equation #1...

M org-contrib/babel/languages/ob-doc-perl.org => org-contrib/babel/languages/ob-doc-perl.org +24 -24
@@ 81,11 81,11 @@ variables. See below.
These are two simple examples:

#+BEGIN_EXAMPLE
#+BEGIN_SRC perl :results value
,#+BEGIN_SRC perl :results value
"hello world";
#+END_SRC
,#+END_SRC

#+RESULTS:
,#+RESULTS:
: hello world
#+END_EXAMPLE



@@ 110,11 110,11 @@ it is interpreted as a table. Some examples below:


#+BEGIN_EXAMPLE
#+BEGIN_SRC perl :results value
,#+BEGIN_SRC perl :results value
[[1,2],[2,4]]
#+END_SRC
,#+END_SRC

#+RESULTS:
,#+RESULTS:
| 1 | 2 |
| 2 | 4 |
#+END_EXAMPLE


@@ 133,7 133,7 @@ When returning an array, it is important to return a reference to the array. Oth
For example, this returns the size of the array:

#+BEGIN_EXAMPLE
#+BEGIN_SRC perl :results value
,#+BEGIN_SRC perl :results value
my @result ;
$i = 0;
for $j ('a'..'e')  {


@@ 141,15 141,15 @@ for $j ('a'..'e')  {
   $i ++;
}
@result;
#+END_SRC
,#+END_SRC

#+RESULTS:
,#+RESULTS:
: 5
#+END_EXAMPLE
But this returns the values of the array and creates the corresponding table

#+BEGIN_EXAMPLE
#+BEGIN_SRC perl :results value
,#+BEGIN_SRC perl :results value
my @result ;
$i = 0;
for $j ('a'..'e')  {


@@ 157,9 157,9 @@ for $j ('a'..'e')  {
   $i ++;
}
\@result;
#+END_SRC
,#+END_SRC

#+RESULTS:
,#+RESULTS:
| a |
| b |
| c |


@@ 168,7 168,7 @@ for $j ('a'..'e')  {
#+END_EXAMPLE

#+BEGIN_EXAMPLE
#+BEGIN_SRC perl :results value
,#+BEGIN_SRC perl :results value
my @result ;
for $i (0..3) {
   for $j (0..2) {


@@ 176,9 176,9 @@ for $i (0..3) {
   }
}
\@result;
#+END_SRC
,#+END_SRC

#+RESULTS:
,#+RESULTS:
| 0 | 1 | 2 |
| 0 | 2 | 4 |
| 0 | 3 | 6 |


@@ 193,7 193,7 @@ tables as input to scripts.
Let us assume we have the following table:

#+BEGIN_EXAMPLE
#+NAME:exampletable
,#+NAME:exampletable
| 1 | a |
| 2 | b |
| 3 | c |


@@ 208,12 208,12 @@ For instance, this block simply returns the input table. Please note
that because data is already a reference we can simply return it.

#+BEGIN_EXAMPLE
#+name: example1usingTable
#+begin_src perl :var data=exampletable :results table :type value
,#+name: example1usingTable
,#+begin_src perl :var data=exampletable :results table :type value
$data
#+end_src
,#+end_src

#+RESULTS: example1usingTable
,#+RESULTS: example1usingTable
| 1 | a |
| 2 | b |
| 3 | c |


@@ 226,8 226,8 @@ can have any size). In the block below we use a function (~org_table_size~) to
return the number of columns and rows in a table.

#+BEGIN_EXAMPLE
#+name: example2usingTable
#+begin_src perl :results value :var data=exampletable
,#+name: example2usingTable
,#+begin_src perl :results value :var data=exampletable
# first we need to define two functions that will make our life easier
sub org_table_size
{


@@ 249,9 249,9 @@ for my $i ($0..$cols-1) {
    }
}
\@result;
#+end_src
,#+end_src

#+RESULTS: example2usingTable
,#+RESULTS: example2usingTable
| 1 | 2 | 3 | 4 |
| a | b | c | d |
#+END_EXAMPLE

M org-contrib/babel/languages/ob-doc-sql.org => org-contrib/babel/languages/ob-doc-sql.org +16 -16
@@ 140,8 140,8 @@ source code block.

#+begin_example

#+name: quote-blks
#+BEGIN_SRC emacs-lisp :var blk="abc" :var sep="\"\n\""
,#+name: quote-blks
,#+BEGIN_SRC emacs-lisp :var blk="abc" :var sep="\"\n\""
    (save-excursion
      (replace-regexp-in-string "\"\"" ""
       (mapconcat


@@ 151,7 151,7 @@ source code block.
        (split-string blk "," t)
        sep)
       t t))
#+END_SRC
,#+END_SRC

#+end_example



@@ 159,11 159,11 @@ The query is written in a named SQL source code block:

#+begin_example

#+name: my-query
#+begin_src sql
,#+name: my-query
,#+begin_src sql
  SELECT * FROM mytable
  WHERE id > 500
#+end_src
,#+end_src

#+end_example



@@ 180,7 180,7 @@ reference to =quote-blkes= and the SQL source code block name

#+begin_example

#+begin_src R :colnames yes :noweb yes
,#+begin_src R :colnames yes :noweb yes
  library(RMySQL)
  con <- dbConnect(MySQL(), user="user", password="pwd", dbname="dbname", host="host")
  q <-


@@ 188,7 188,7 @@ reference to =quote-blkes= and the SQL source code block name
  c <- dbGetQuery(con, q)
  dbDisconnect(con)
  c
#+end_src
,#+end_src

#+end_example



@@ 211,15 211,15 @@ Alternatively, the query could be set up to run on its own:

#+begin_example

#+name: my-query
#+header: :engine mysql
#+header: :dbhost host
#+header: :dbuser user
#+header: :dbpassword pwd
#+header: :database dbname
#+begin_src sql
,#+name: my-query
,#+header: :engine mysql
,#+header: :dbhost host
,#+header: :dbuser user
,#+header: :dbpassword pwd
,#+header: :database dbname
,#+begin_src sql
  SELECT * FROM mytable
  WHERE id > 500
#+end_src
,#+end_src

#+end_example

M org-contrib/babel/languages/ob-doc-tcl.org => org-contrib/babel/languages/ob-doc-tcl.org +25 -25
@@ 94,11 94,11 @@ default is to return a value being this the last value from a =return=
statement. 

#+begin_example
#+begin_src tcl
,#+begin_src tcl
  return "Hello"
#+end_src
,#+end_src

#+RESULTS: 
,#+RESULTS: 
: Hello
#+end_example



@@ 109,12 109,12 @@ To change this behavior, the keyword
=:results output= must be written in the header. For example: 

#+begin_example
#+begin_src tcl :results output
,#+begin_src tcl :results output
puts "Hi"
return "Hello"
#+end_src 
,#+end_src 

#+RESULTS:
,#+RESULTS:
: Hi
#+end_example



@@ 130,11 130,11 @@ example is a program that just writes the value of the variable.

#+begin_example
#+name: reflector(x=0)
#+begin_src tcl :results output
,#+begin_src tcl :results output
puts $x
#+end_src
,#+end_src

#+RESULTS: reflector
,#+RESULTS: reflector
: 0
#+end_example 



@@ 143,8 143,8 @@ the named block later on with a different value will result on that
value been written in the =#RESULTS:= For example: 

#+begin_example
#+call: reflector(20)
#+RESULTS: reflector(20)
,#+call: reflector(20)
,#+RESULTS: reflector(20)
: 20
#+end_example



@@ 152,12 152,12 @@ This is not constrained only to =:results output= headers. Procedures in
which the result is a =value= can also be used. For example: 

#+begin_example
#+name: square(x=0)
#+begin_src tcl :results value
,#+name: square(x=0)
,#+begin_src tcl :results value
return [expr $x * $x]
#+end_src
,#+end_src

#+RESULTS: square
,#+RESULTS: square
: 0
#+end_example



@@ 165,9 165,9 @@ Executing it with C-c C-c with different values will result to that value being
returned. For example:

#+begin_example
#+call: square(x=2)
,#+call: square(x=2)

#+RESULTS: square(x=2)
,#+RESULTS: square(x=2)
: 4
#+end_example 



@@ 175,9 175,9 @@ Sending Tcl code as part of the parameter is also supported. For
example: 

#+begin_example
#+call: square(x=[expr 2 + 10])
,#+call: square(x=[expr 2 + 10])

#+RESULTS: square(x=[expr 2 + 10])
,#+RESULTS: square(x=[expr 2 + 10])
: 144
#+end_example 



@@ 186,17 186,17 @@ structure in  Tcl is a list of lists. For example:


#+begin_example
#+tblname: testtbl
,#+tblname: testtbl
| 1 | 2 |
| 3 | 4 |

#+name: processtbl(x=0)
#+begin_src tcl :results output
,#+name: processtbl(x=0)
,#+begin_src tcl :results output
puts $x
foreach y $x {
  puts [expr [lindex $y 0] * [lindex $y 1]]
}
#+end_src
,#+end_src
#+end_example

The program prints the table as a list, add the first and second values and


@@ 204,9 204,9 @@ writing the results. Calling this block later on in the Org document
will result in the following output.

#+begin_example
#+call: processtbl(x=testtbl)
,#+call: processtbl(x=testtbl)

#+RESULTS: processtbl(x=testtbl)
,#+RESULTS: processtbl(x=testtbl)
: {1  2}  {3  4}
: 2
: 12

M org-contrib/org-depend.org => org-contrib/org-depend.org +9 -9
@@ 108,13 108,13 @@ have been activated, i.e. include the following line and press C-c C-c
on the line before working with the example:

#+begin_example
  #+TYP_TODO: TODO NEXT | DONE
  ,#+TYP_TODO: TODO NEXT | DONE
#+end_example

OK, here is the example.

#+begin_src org
  ,* TODO Win a million in Las Vegas
,* TODO Win a million in Las Vegas
    :PROPERTIES:
      :ID: I-cannot-do-it-without-money
    :END:


@@ 122,29 122,29 @@ OK, here is the example.
    The "third" TODO (see above) cannot become a TODO without this money.


  ,* Do this by doing a chain of TODOs
  ,** NEXT This is the first in this chain
,* Do this by doing a chain of TODOs
,** NEXT This is the first in this chain
     :PROPERTIES:
       :TRIGGER: chain-siblings(NEXT)
     :END:

  ,** This is the second in this chain
,** This is the second in this chain

  ,** This is the third in this chain
,** This is the third in this chain
     :PROPERTIES:
       :BLOCKER: I-cannot-do-it-without-money
     :END:

  ,** This is the forth in this chain
,** This is the forth in this chain
     :PROPERTIES:
       :TRIGGER: XYZ-is-my-id(TODO)
     :END:

     When this is DONE, we will also trigger entry XYZ-is-my-id

  ,** This is the fifth in this chain
,** This is the fifth in this chain

  ,* Start writing report
,* Start writing report
     :PROPERTIES:
       :ID: XYZ-is-my-id
     :END:

M org-contrib/org-exp-blocks.org => org-contrib/org-exp-blocks.org +2 -2
@@ 204,12 204,12 @@ path at which the final pdf image should be created as the first
element of headers, any additional elements of headers will be
passed to the dot utility as command line arguments.

#+begin_dot_and_eps duh
,#+begin_dot_and_eps duh
digraph test {
a -> { b c d e };
e -> { f g h i };
};
#+end_dot"
,#+end_dot"
  (message "dot-and-eps-formatting...")
  (let ((out-file (if headers (car headers)))
	(args (if (cdr headers) (mapconcat 'identity (cdr headers) " ")))

M org-contrib/org-wikinodes.org => org-contrib/org-wikinodes.org +1 -1
@@ 32,7 32,7 @@ single CamelCase word, optionally with a TODO keyword, a priority
cookie and tags, are treated as a wiki node.

#+begin_src org
  ,* TODO [#C] ThisIsAWikiNodeInOrgMode    :test:
,* TODO [#C] ThisIsAWikiNodeInOrgMode    :test:
#+end_src

Writing the CamelCase word plainly in the text will create a link to

M org-faq.org => org-faq.org +6 -6
@@ 3319,14 3319,14 @@ The item in the org file looks like this:
    is one day after.

    #+begin_src org
    ,* Good Friday
      <%%(= -2 (calendar-days-from-easter))>
,* Good Friday
<%%(= -2 (calendar-days-from-easter))>

    ,* Easter Sunday
      <%%(= 0 (calendar-days-from-easter))>
,* Easter Sunday
<%%(= 0 (calendar-days-from-easter))>

    ,* Easter Monday
      <%%(= 1 (calendar-days-from-easter))>
,* Easter Monday
<%%(= 1 (calendar-days-from-easter))>
    #+end_src

   [Source: Posted by Paul Sexton on Org-mode mailing list.]

M org-hacks.org => org-hacks.org +10 -10
@@ 2481,7 2481,7 @@ source blocks in the current file during evaluation of the ~call~
lines (thus during export as well).

#+BEGIN_SRC org
  ,* Setup                                                            :noexport:
,* Setup :noexport:
  ,#+name: fetchsrc
  ,#+BEGIN_SRC emacs-lisp :results raw :var f="foo" :var s="Definition" :var e="\\. *$" :var b=()
    (defvar coqfiles nil)


@@ 3710,15 3710,15 @@ below without leading stars through ~#+STARTUP: odd hidestars
hidestarsfile~:

#+BEGIN_SRC org
  ,#+STARTUP: odd hidestars
  [...]
  ***** TODO section
  ******* subsection
  ********* subsubsec
            - bla bla
  ***** section
        - bla bla
  ******* subsection
,#+STARTUP: odd hidestars
[...]
,***** TODO section
,******* subsection
,********* subsubsec
          - bla bla
,***** section
      - bla bla
,******* subsection
#+END_SRC

#+BEGIN_SRC org

M org-release-notes.org => org-release-notes.org +141 -141
@@ 1075,7 1075,7 @@ A task using a =.+= repeater and hours step is repeated starting from
now. E.g.,

#+begin_example
,,** TODO Wash my hands
,** TODO Wash my hands
   DEADLINE: <2019-04-05 08:00 Sun .+1h>
   Marking this DONE shifts the date to exactly one hour from now.
#+end_example


@@ 1775,9 1775,9 @@ Archiving headers through ~org-archive-subtree~ and
~org-archive-to-archive-sibling~ such as the ones listed below:

#+BEGIN_SRC org
  ,* Top [1/2]
  ,** DONE Completed
  ,** TODO Working
,* Top [1/2]
,** DONE Completed
,** TODO Working
#+END_SRC

Will update the status cookie in the top level header.


@@ 1819,20 1819,20 @@ conditional on another entry. E.g. given this configuration:
You can have a file =bananas.org= containing:

#+BEGIN_SRC org
  ,#+columns: %ITEM %CONFIRMED %Bananas{+} %Bananas(Confirmed Bananas){X+}
,#+columns: %ITEM %CONFIRMED %Bananas{+} %Bananas(Confirmed Bananas){X+}

  ,* All shipments
  ,** Shipment 1
     :PROPERTIES:
     :CONFIRMED: [X]
     :Bananas:  4
     :END:
,* All shipments
,** Shipment 1
   :PROPERTIES:
   :CONFIRMED: [X]
   :Bananas:  4
   :END:

  ,** Shipment 2
     :PROPERTIES:
     :CONFIRMED: [ ]
     :BANANAS:  7
     :END:
,** Shipment 2
   :PROPERTIES:
   :CONFIRMED: [ ]
   :BANANAS:  7
   :END:
#+END_SRC

... and when going to the top of that file and entering column view


@@ 3318,7 3318,7 @@ given tags can be used on the headline at the same time.  Example:
[ group : sub1 sub2 ]

#+BEGIN_SRC org
  ,* Test                                                            :sub1:sub2:
,* Test                                                            :sub1:sub2:
#+END_SRC

This is a more general case than the already existing syntax for


@@ 6489,56 6489,56 @@ This results in the following behavior.
  ,#+property: var+ bar=2
  
  ,#+begin_src emacs-lisp
  ,  (+ foo bar)
     (+ foo bar)
  ,#+end_src
  
  ,#+results:
  ,: 3
   : 3
  
  ,#+begin_src emacs-lisp
  ,  (org-entry-get (point) "var" t)
     (org-entry-get (point) "var" t)
  ,#+end_src
  
  ,#+results:
  ,: foo=1 bar=2
   : foo=1 bar=2
  
  ,* overwriting a file-wide property
  ,  :PROPERTIES:
  ,  :var:      foo=7
  ,  :END:
,* overwriting a file-wide property
     :PROPERTIES:
     :var:      foo=7
     :END:
  
  ,#+begin_src emacs-lisp
  ,  foo
     foo
  ,#+end_src
  
  ,#+results:
  ,: 7
   : 7
  
  ,#+begin_src emacs-lisp
  ,  (org-entry-get (point) "var" t)
     (org-entry-get (point) "var" t)
  ,#+end_src
  
  ,#+results:
  ,: foo=7
   : foo=7
  
  ,* appending to a file-wide property
  ,  :PROPERTIES:
  ,  :var+:      baz=3
  ,  :END:
,* appending to a file-wide property
     :PROPERTIES:
     :var+:      baz=3
     :END:
  
  ,#+begin_src emacs-lisp
  ,  (+ foo bar baz)
     (+ foo bar baz)
  ,#+end_src
  
  ,#+results:
  ,: 6
   : 6
  
  ,#+begin_src emacs-lisp
  ,  (org-entry-get (point) "var" t)
     (org-entry-get (point) "var" t)
  ,#+end_src
  
  ,#+results:
  ,: foo=1 bar=2 baz=3
   : foo=1 bar=2 baz=3
#+end_src

*** =org-agenda-custom-commands= has a default value ([[git:b3de2dbb953dcadacafeb179899ab9df184da4ff][git]])


@@ 6966,17 6966,17 @@ used by the compiler to name =.java= and =.class= files.
Example Java code block:
#+begin_src org
  ,#+begin_src java :classname myfirstjavaprog
  ,  class myfirstjavaprog
  ,  {
  ,      public static void main(String args[])
  ,      {
  ,          System.out.println("Hello World!");
  ,      }
  ,  }
     class myfirstjavaprog
     {
         public static void main(String args[])
         {
             System.out.println("Hello World!");
         }
     }
  ,#+end_src
  
  ,#+results:
  ,: Hello World!
   : Hello World!
#+end_src

*** Babel: support for =fortran= code blocks by Sergey Litvinov


@@ 7274,24 7274,24 @@ Both custom IDs and Org mode IDs may be used.  For example;

#+begin_src org
  ,#+begin_src sh :var text=foo
  ,  echo "$text"|wc
     echo "$text"|wc
  ,#+end_src

  ,#+results:
  ,: 8      58     415
   : 8      58     415

  ,* example foo
  ,  :PROPERTIES:
  ,  :CUSTOM_ID: foo
  ,  :END:

  ,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.
     :PROPERTIES:
     :CUSTOM_ID: foo
     :END:

  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.
#+end_src

**** =org-babel-tangle-body-hook= for reprocessing code block bodies during tangling


@@ 7313,7 7313,7 @@ A no web reference like the following

#+begin_src org
  ,#+begin_src sh
  ,  <<the-ref>>
    <<the-ref>>
  ,#+end_src
#+end_src



@@ 7858,7 7858,7 @@ For example

#+begin_src org
  ,#+begin_src python :preamble # -*- coding: utf-8 -*- :return s
  ,s = "é"
  s = "é"
  ,#+end_src
#+end_src



@@ 7896,12 7896,12 @@ export.  For example

#+begin_src org
  ,#+begin_src emacs-lisp :results wrap
  ,  "code block results"
    "code block results"
  ,#+end_src

  ,#+results:
  ,#+BEGIN_RESULT
  ,: code block results
  : code block results
  ,#+END_RESULT
#+end_src



@@ 7918,13 7918,13 @@ contents from and to Org mode buffers.  For example

#+begin_src org
  ,#+results: a-list
  ,- babel
  ,- and
  ,- org-mode
  - babel
  - and
  - org-mode

  ,#+source: a-list
  ,#+begin_src emacs-lisp :var lst=a-list :results list
  ,  (reverse lst)
    (reverse lst)
  ,#+end_src
#+end_src



@@ 7936,23 7936,23 @@ calculation.  For example
#+begin_src org
  ,#+source: calc-stack
  ,#+begin_src calc
  ,  8
  ,  1
  ,  '+
  ,  9
  ,  '*
    8
    1
    '+
    9
    '*
  ,#+end_src

  ,#+results: calc-stack
  ,: 81
  : 81

  ,#+source: calc-arithmetic
  ,#+begin_src calc :var in=calc-stack
  ,  in / 9
    in / 9
  ,#+end_src

  ,#+results: calc-arithmetic
  ,: 9
  : 9
#+end_src

**** "org-babel-detangle" propagates change to source code files into code blocks


@@ 8091,19 8091,19 @@ can provide intuition for the new behavior.
#+begin_src org :exports code
  ,#+srcname: random
  ,#+begin_src R :cache yes
  ,runif(1)
  runif(1)
  ,#+end_src

  ,#+results[a2a72cd647ad44515fab62e144796432793d68e1]: random
  ,: 0.4659510825295
  : 0.4659510825295

  ,#+srcname: caller
  ,#+begin_src emacs-lisp :var x=random :cache yes
  ,x
  x
  ,#+end_src

  ,#+results[bec9c8724e397d5df3b696502df3ed7892fc4f5f]: caller
  ,: 0.254227238707244
  : 0.254227238707244
#+end_src

*** Added :headers header argument for LaTeX code blocks


@@ 8113,11 8113,11 @@ accepts either a single string or a list, e.g.

#+begin_src org
  ,#+begin_src latex :headers \usepackage{lmodern} :file name1.pdf
  ,  latex body
    latex body
  ,#+end_src

  ,#+begin_src latex :headers '("\\usepackage{mathpazo}" "\\usepackage{fullpage}") :file name2.pdf
  ,  latex body
    latex body
  ,#+end_src
#+end_src



@@ 8463,7 8463,7 @@ code block level, e.g.

#+begin_src org
  ,#+begin_src clojure :shebang #!/usr/bin/env clj
  ,  (println "with a shebang line, I can be run as a script!")
    (println "with a shebang line, I can be run as a script!")
  ,#+end_src
#+end_src



@@ 10616,25 10616,25 @@ it also looks better if you like to indent text under outline
headings.  For example:

#+begin_src org
  ,*** This is some headline
  ,    #+begin_example
  ,    here we have an example
  ,    #+end_example
  ,
  ,    - a plain list
  ,      - a sublist item
  ,        - a second sublist item

  ,          #+begin_center
  ,           centering within the plain list item
  ,          #+end_center

  ,      #+begin_example
  ,       This example does terminate the sublist,
  ,       the indentation of the #+begin line counts.
  ,      #+end_example

  ,    - but the top level plain lists continues here
,*** This is some headline
      ,#+begin_example
      here we have an example
      ,#+end_example
  
      - a plain list
        - a sublist item
          - a second sublist item

            ,#+begin_center
             centering within the plain list item
            ,#+end_center

        ,#+begin_example
         This example does terminate the sublist,
         the indentation of the #+begin line counts.
        ,#+end_example

      - but the top level plain lists continues here
#+end_src

From now on, the indentation of such a block decides whether it is part of


@@ 11184,8 11184,8 @@ Text can be exported centered with

#+begin_src org
  ,#+BEGIN_CENTER
  ,Everything should be made as simple as possible, \\
  ,but not any simpler
  Everything should be made as simple as possible, \\
  but not any simpler
  ,#+END_CENTER
#+end_src



@@ 11573,8 11573,8 @@ to that, you can define an arbitrary number of macros, for example:

#+begin_src org
  ,#+MACRO: myaddress 41 Onestreet, 12345 New York, NY
  ,...
  ,my address is {{{myaddress}}}, see you there.
  ...
  my address is {{{myaddress}}}, see you there.
#+end_src

Macro replacement is the very first thing that happens during export, and


@@ 11932,9 11932,9 @@ DONE.  Here is an example:
,** TODO two

,* Parent
,  :PROPERTIES:
,    :ORDERED: t
,  :END:
  :PROPERTIES:
  :ORDERED: t
  :END:
,** TODO a
,** TODO b, needs to wait for (a)
,** TODO c, needs to wait for (a) and (b)


@@ 12289,14 12289,14 @@ Here is an example:

#+begin_example -k
  ,#+begin_src emacs-lisp -n -r
  ,(defmacro org-unmodified (&rest body)                   (ref:def)
  ,  "Execute body without changing `buffer-modified-p'."
  ,  `(set-buffer-modified-p                              (ref:back)
  ,    (prog1 (buffer-modified-p) ,@body)))
  (defmacro org-unmodified (&rest body)                   (ref:def)
    "Execute body without changing `buffer-modified-p'."
    `(set-buffer-modified-p                              (ref:back)
      (prog1 (buffer-modified-p) ,@body)))
  ,#+end_src
  ,
  ,[[(def)][Line (def)]] contains the macro name.  Later at line
  ,[[(back)]], backquoting is used.
  
  [[(def)][Line (def)]] contains the macro name.  Later at line
  [[(back)]], backquoting is used.
#+end_example

When exported, this is translated to:


@@ 12727,8 12727,8 @@ tables like the ones using /org-collector.el/ by Eric Schulte.
    =//domain/path-to-my-file.html#dummy= work:

    #+begin_src org
      ,# <<dummy>>
      ,*** a headline
# <<dummy>>
,*** a headline
    #+end_src

    This is based on a request by Matt Lundin.


@@ 12904,8 12904,8 @@ tables like the ones using /org-collector.el/ by Eric Schulte.
    #+begin_src org
      ,* Level one
      ,** Level two
      ,(1)
      ,(2)* Level one again
      (1)
      (2)* Level one again
    #+end_src

    with (1) and (2) indicating possible cursor positions for the


@@ 13601,7 13601,7 @@ tables like the ones using /org-collector.el/ by Eric Schulte.
    /B.jpg/ can now be written like

    #+begin_src org
      ,[[./A.jpg][./B.jpg] ]
      [[./A.jpg][./B.jpg] ]
    #+end_src

*** Changes in iCalendar export


@@ 13935,17 13935,17 @@ and all those little foreign snippets like:
,#+HTML: this code can be edited in html-mode

,#+BEGIN_HTML
,Same here
Same here
,#+BEGIN_HTML

,#+LaTeX: this code can be edited in latex-mode

,#+BEGIN_LaTeX
,Same here
Same here
,#+BEGIN_LaTeX

,#+BEGIN_SRC fortran
,Here we can edit in fortran-mode
Here we can edit in fortran-mode
,#+END_SRC
#+end_src



@@ 13988,11 13988,11 @@ property will be overwritten.  For example:
#+begin_src org
,#+OPTIONS: skip:nil
,* Computer Tricks
,  :PROPERTIES:
,  :EXPORT_FILE_NAME: ct.html
,  :EXPORT_TITLE: Steve's collected computer tricks
,  :EXPORT_OPTIONS: h:2 toc:nil
,  :END:
  :PROPERTIES:
  :EXPORT_FILE_NAME: ct.html
  :EXPORT_TITLE: Steve's collected computer tricks
  :EXPORT_OPTIONS: h:2 toc:nil
  :END:
#+end_src

*** New way to define tags for an entire file.


@@ 14031,7 14031,7 @@ property will be overwritten.  For example:
  value on a per-file basis with

#+begin_src org
#+OPTIONS: skip:t
,#+OPTIONS: skip:t
#+end_src

** Details


@@ 14073,8 14073,8 @@ property will be overwritten.  For example:

    #+begin_src org
      ,#+BEGIN_QUOTE:
      ,Everything should be made as simple as possible,
      ,but not any simpler -- Albert Einstein
      Everything should be made as simple as possible,
      but not any simpler -- Albert Einstein
      ,#+BEGIN_QUOTE:
    #+end_src



@@ 14093,9 14093,9 @@ property will be overwritten.  For example:

    #+begin_src org
      ,#+BEGIN_SRC emacs-lisp
      ,  (defun org-xor (a b)
      ,    "Exclusive or."
      ,    (if a (not b) b))
        (defun org-xor (a b)
          "Exclusive or."
          (if a (not b) b))
      ,#+END_SRC
    #+end_src



@@ 14211,11 14211,11 @@ property will be overwritten.  For example:
    looks like this:

    #+begin_src org
      ,* Version 6.03
      ,  :PROPERTIES:
      ,    :VISIBILITY: content
      ,  :END:
      ,** Overview
,* Version 6.03
  :PROPERTIES:
  :VISIBILITY: content
  :END:
,** Overview
    #+end_src

    This was a proposal by Ben Alexander.


@@ 14896,7 14896,7 @@ list of small improvements and some new significant features.
      clocking out an item: `org-log-note-clock-out'.
    - Logging of state changes now has to be configured on a
      pre-keyword basis, either in `org-todo-keywords' or in the
      #+TODO in-buffer setting.
      =#+TODO= in-buffer setting.
    - These per-keyword settings allow more control.  For example

      : WAIT(w@)    Record a note when entering this state.


@@ 16450,7 16450,7 @@ list of small improvements and some new significant features.

     Buffer-local values are set like this:

       #+PROPERTY: NAME This is the value
       : #+PROPERTY: NAME This is the value

     When using org-entry-get to get the value of a property with
     the `inherit' flag and the hierarchy above the entry does


@@ 16749,7 16749,7 @@ list of small improvements and some new significant features.
      needs to be defined in the hierarchy above the table, not
      necessarily in the same entry as the table.  This was a
      request by Eddward.  File-wide constants can be defined with
      #+CONSTANTS, see below.
      =#+CONSTANTS=, see below.

    - Things that still need to be sorted out about drawers,
      properties and column view - comments and suggestions

M org-tutorials/advanced-searching.org => org-tutorials/advanced-searching.org +16 -16
@@ 288,16 288,16 @@ drawer, e.g.:

#+begin_src org
  ,* TODO Evensong's magisterial work on the Amazon           :science:read:BIB:
  ,  SCHEDULED: <2010-11-20 Sat>
  ,  [2010-11-16 Tue 23:11]
  ,  :PROPERTIES:
  ,  :BIB_AUTHOR: Walter Evensong
  ,  :BIB_TITLE: Mysteries of the Amazon
  ,  :BIB_PAGES: 1234
  ,  :BIB_PUBLISHER: Humbug University Press
  ,  :END:
  ,  
  ,  Lots of good stuff on Brazil.
    SCHEDULED: <2010-11-20 Sat>
    [2010-11-16 Tue 23:11]
    :PROPERTIES:
    :BIB_AUTHOR: Walter Evensong
    :BIB_TITLE: Mysteries of the Amazon
    :BIB_PAGES: 1234
    :BIB_PUBLISHER: Humbug University Press
    :END:
    
    Lots of good stuff on Brazil.
#+end_src

Let's imagine a free software aficionado named Mr. Gnu has added a


@@ 365,8 365,8 @@ Mr. Gnu jots down the following rule in his growing org file collection:

#+begin_src org
  ,* Tags/property search matching
  , - For exact matches, use quotation marks.
  , - For partial matches, use curly brackets.
   - For exact matches, use quotation marks.
   - For partial matches, use curly brackets.
#+end_src

[[http://www.gnu.org/s/emacs/manual/html_node/elisp/Regular-Expressions.html#Regular-Expressions][Regular expressions]] allow for more flexible searches. Let's say that


@@ 466,8 466,8 @@ to note: if you have a timestamp with time of day information, such
as...

#+begin_src org
  ,* Some task
  ,  SCHEDULED: <2010-08-20-Sat 10:30>
,* Some task
  SCHEDULED: <2010-08-20-Sat 10:30>
#+end_src

...the search above will not retrieve it. (This is not normally a


@@ 593,9 593,9 @@ enough keyboarding practice), our friend Mr. Gnu would like to locate
the following entry, which is buried somewhere in his agenda files:

#+begin_src org
  ,* A sentence to test my keyboarding skills
,* A sentence to test my keyboarding skills
  
  ,The quick brown fox jumped over the lazy dog.
The quick brown fox jumped over the lazy dog.
#+end_src

Mr. Gnu vaguely remembers that the entry contains the word "fox", so

M org-tutorials/org-R/org-R.org => org-tutorials/org-R/org-R.org +38 -38
@@ 87,7 87,7 @@
| A    | A    |
| A    | B    |
| B    | B    |
#+R: action:tabulate columns:2
,#+R: action:tabulate columns:2

#+end_example



@@ 130,7 130,7 @@ table in the org file, and refer to it by name:

#+begin_example

#+TBLNAME:data-set-1
,#+TBLNAME:data-set-1
| col1 | col2 |
|------+------|
| A    | A    |


@@ 139,7 139,7 @@ table in the org file, and refer to it by name:

[arbitrary other content of org buffer]

#+R: intable:data-set-1 action:tabulate
,#+R: intable:data-set-1 action:tabulate

#+end_example



@@ 196,8 196,8 @@ The available off-the-shelf actions are listed [[*Table of available actions][he

#+begin_example

#+RR: x <- c(rnorm(10, mean=-3, sd=1), rnorm(10, mean=3, sd=1))
#+R: title:"continuous-data" output-to-buffer:t
,#+RR: x <- c(rnorm(10, mean=-3, sd=1), rnorm(10, mean=3, sd=1))
,#+R: title:"continuous-data" output-to-buffer:t

#+end_example



@@ 206,7 206,7 @@ table with "#+TBLNAME"; we'll use that to refer to these data.

#+begin_example

#+TBLNAME:continuous-data
,#+TBLNAME:continuous-data
|            values |
|-------------------|
| -2.48627002467785 |


@@ 239,8 239,8 @@ name the file link to the graphical output).
#+begin_example

[[file:tmp.png][histogram example]]
#+R: action:hist columns:1 colour:hotpink 
#+R: intable:continuous-data outfile:"png" title:"histogram example"
,#+R: action:hist columns:1 colour:hotpink 
,#+R: intable:continuous-data outfile:"png" title:"histogram example"

#+end_example
[[file:../../images/org-R/histogram-example.png]]


@@ 261,8 261,8 @@ available output image formats: "jpg", "jpeg", "pdf", "ps", "bmp",
#+begin_example

[[file:density.png][density plot example]]
#+R: action:density columns:"values" colour:chartreuse4 args:(:lwd 4)
#+R: intable:continuous-data outfile:"density.png" title:"density plot example"
,#+R: action:density columns:"values" colour:chartreuse4 args:(:lwd 4)
,#+R: intable:continuous-data outfile:"density.png" title:"density plot example"

#+end_example
[[file:../../images/org-R/density.png]]


@@ 294,9 294,9 @@ we'll store them in a separate org file:
#+begin_example

[[file:org-variables-counts.org][org-variables-counts]]
#+R: action:tabulate columns:2 sort:t
#+R: infile:"variable-popcon.org" intable:"org-variables-table"
#+R: outfile:"org-variables-counts.org" title:"org-variables-counts"
,#+R: action:tabulate columns:2 sort:t
,#+R: infile:"variable-popcon.org" intable:"org-variables-table"
,#+R: outfile:"org-variables-counts.org" title:"org-variables-counts"

#+end_example
[[file:org-variables-counts.org]]


@@ 313,8 313,8 @@ We can see the top few rows of the table by using action:head
|           4 | org-todo-keywords           |    22 |
|           5 | org-agenda-include-diary    |    19 |
|           6 | org-hide-leading-stars      |    19 |
#+R: action:head
#+R: infile:"org-variables-counts.org" intable:"org-variables-counts" output-to-buffer:t
,#+R: action:head
,#+R: infile:"org-variables-counts.org" intable:"org-variables-counts" output-to-buffer:t

#+end_example



@@ 324,10 324,10 @@ org variables are customised by only one or two users.
#+begin_example

[[file:org-variables-barplot.png][org-variables barplot]]
#+R: action:barplot rownames:t columns:1 width:800 col:darkblue
#+R: args:(:names.arg "NULL")
#+R: infile:"org-variables-counts.org" intable:"org-variables-counts"
#+R: outfile:"org-variables-barplot.png" title:"org-variables barplot"
,#+R: action:barplot rownames:t columns:1 width:800 col:darkblue
,#+R: args:(:names.arg "NULL")
,#+R: infile:"org-variables-counts.org" intable:"org-variables-counts"
,#+R: outfile:"org-variables-barplot.png" title:"org-variables barplot"

#+end_example
[[file:../../images/org-R/org-variables-barplot.png]]


@@ 350,10 350,10 @@ org variables are customised by only one or two users.
#+begin_example

[[file:variable-popcon-restricted.org][org-variables-table]]
#+R: infile:"variable-popcon.org" intable:"org-variables-table"
#+R: outfile:"variable-popcon-restricted.org" title:"org-variables-table"
#+RR: tab <- table(x[,2])
#+RR: x <- subset(x, Variable %in% names(tab[tab > 4]))
,#+R: infile:"variable-popcon.org" intable:"org-variables-table"
,#+R: outfile:"variable-popcon-restricted.org" title:"org-variables-table"
,#+RR: tab <- table(x[,2])
,#+RR: x <- subset(x, Variable %in% names(tab[tab > 4]))

#+end_example
[[file:variable-popcon-restricted.org][org-variables-table]]


@@ 365,9 365,9 @@ customised variable i. We can do that without writing any R code:
#+begin_example

[[file:org-variables-incidence.org][incidence-matrix]]
#+R: action:tabulate columns:(1 2) rownames:t
#+R: infile:"variable-popcon-restricted.org" intable:"org-variables-table"
#+R: outfile:"org-variables-incidence.org" title:"incidence-matrix"
,#+R: action:tabulate columns:(1 2) rownames:t
,#+R: infile:"variable-popcon-restricted.org" intable:"org-variables-table"
,#+R: outfile:"org-variables-incidence.org" title:"incidence-matrix"

#+end_example
[[file:org-variables-incidence.org][incidence-matrix]]


@@ 380,10 380,10 @@ as a dendrogram:
#+begin_example

[[file:org-users-tree.png][org-users-tree.png]]
#+RR: par(bg="gray15", fg="turquoise2")
#+RR: plot(hclust(dist(x, method="binary")), ann=FALSE)
#+R: infile:"org-variables-incidence.org" intable:"incidence-matrix" rownames:t
#+R: outfile:"org-users-tree.png" title:"org-users-tree.png"
,#+RR: par(bg="gray15", fg="turquoise2")
,#+RR: plot(hclust(dist(x, method="binary")), ann=FALSE)
,#+R: infile:"org-variables-incidence.org" intable:"incidence-matrix" rownames:t
,#+R: outfile:"org-users-tree.png" title:"org-users-tree.png"

#+end_example
[[file:../../images/org-R/org-users-tree.png]]


@@ 393,10 393,10 @@ And to cluster org variables, we use the transpose of that incidence matrix:
#+begin_example

[[file:org-variables-tree.png][org-variables-tree.png]]
#+RR: par(bg="gray15", fg="turquoise2")
#+RR: plot(hclust(dist(t(x), method="binary")), ann=FALSE)
#+R: infile:"org-variables-incidence.org" intable:"incidence-matrix" rownames:t
#+R: outfile:"org-variables-tree.png" title:"org-variables-tree.png" width:1000
,#+RR: par(bg="gray15", fg="turquoise2")
,#+RR: plot(hclust(dist(t(x), method="binary")), ann=FALSE)
,#+R: infile:"org-variables-incidence.org" intable:"incidence-matrix" rownames:t
,#+R: outfile:"org-variables-tree.png" title:"org-variables-tree.png" width:1000

#+end_example
[[file:../../images/org-R/org-variables-tree.png]]


@@ 419,10 419,10 @@ recognise any usage affinities between the clustered org users?
#+begin_example

[[file:/usr/local/src/org-etc/Worg/org-tutorials/org-R/data/45/f39291-3abc-4d5b-96c9-3a32f77877a5/org-R-output-8119M2O.png][An example from the org-plot tutorial, plotted using org-R]]
#+R: action:lines columns:((1)(2 3))
#+R: infile:"../org-plot.org"
#+R: intable:"org-plot-example-1" outfile:"png"
#+R: title:"An example from the org-plot tutorial, plotted using org-R"
,#+R: action:lines columns:((1)(2 3))
,#+R: infile:"../org-plot.org"
,#+R: intable:"org-plot-example-1" outfile:"png"
,#+R: title:"An example from the org-plot tutorial, plotted using org-R"

#+end_example
[[file:../../images/org-R/org-plot-example-1.png]]

M org-tutorials/org-jekyll.org => org-tutorials/org-jekyll.org +5 -5
@@ 172,16 172,16 @@ in your page. See the Jekyll [[http://wiki.github.com/mojombo/jekyll/yaml-front-

Below is a short extract from one of my org files showing my setup:

#+BEGIN_EXAMPLE org
#+STARTUP: showall indent
#+STARTUP: hidestars
#+BEGIN_EXPORT html
#+BEGIN_EXAMPLE
,#+STARTUP: showall indent
,#+STARTUP: hidestars
,#+BEGIN_EXPORT html
---
layout: default
title: Benighted on the Ben.
excerpt: An unplanned bivouac on Ben Nevis.
---
#+END_EXPORT
,#+END_EXPORT
It was early January when six of us travelled up to ....
#+END_EXAMPLE


M org-tutorials/org-latex-export.org => org-tutorials/org-latex-export.org +38 -38
@@ 128,7 128,7 @@ Here is a standard setup for export to a LaTeX book class:
Then, in the Org file with a book-full of notes, add this line:

#+begin_src org
  #+LaTeX_CLASS: book
  ,#+LaTeX_CLASS: book
#+end_src

<<koma-script>>


@@ 152,7 152,7 @@ Then, this class can be used by including the following line in the
Org-mode file.

#+begin_src org :exports code
  #+LaTeX_CLASS: koma-article
  ,#+LaTeX_CLASS: koma-article
#+end_src

* Passing Options to Document Classes


@@ 166,7 166,7 @@ You can pass options to the LaTeX =\documentclass= macro by putting a
line like this in your Org-mode file:

#+begin_src org :exports code
  #+LaTeX_CLASS_OPTIONS: [a4paper,twoside,twocolumn]
  ,#+LaTeX_CLASS_OPTIONS: [a4paper,twoside,twocolumn]
#+end_src

A useful option with the [[koma-script][KOMA script]] classes typesets table captions


@@ 175,7 175,7 @@ exported by Org-mode above the table.  The following option to the
[[koma-script][KOMA script]] classes accomplishes this.

#+begin_src org
  #+LaTeX_CLASS_OPTIONS: [captions=tableheading]
  ,#+LaTeX_CLASS_OPTIONS: [captions=tableheading]
#+end_src

* Using Custom Classes


@@ 230,8 230,8 @@ example only calls it if it would add a LaTeX class that isn't
already on the =org-latex-classes= list:

#+begin_example
  #+name: setup
  #+begin_src emacs-lisp :results silent :exports none
  ,#+name: setup
  ,#+begin_src emacs-lisp :results silent :exports none
 (unless (find "per-file-class" org-latex-classes :key 'car
           :test 'equal)
   (add-to-list 'org-latex-classes


@@ 244,13 244,13 @@ already on the =org-latex-classes= list:
               ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
               ("\\paragraph{%s}" . "\\paragraph*{%s}")
               ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
  #+end_src
  ,#+end_src
#+end_example

Then, add this line to the Org-mode file:

#+begin_src org :exports code
  #+LaTeX_CLASS: per-file-class
  ,#+LaTeX_CLASS: per-file-class
#+end_src

* Specifying LaTeX Packages


@@ 315,8 315,8 @@ links:

#+name: hyperref-header
#+begin_src org :exports code
  ,  #+LATEX_HEADER: \usepackage[hyperref,x11names]{xcolor}
  ,  #+LATEX_HEADER: \usepackage[colorlinks=true,urlcolor=SteelBlue4,linkcolor=Firebrick4]{hyperref}
  ,#+LATEX_HEADER: \usepackage[hyperref,x11names]{xcolor}
  ,#+LATEX_HEADER: \usepackage[colorlinks=true,urlcolor=SteelBlue4,linkcolor=Firebrick4]{hyperref}
#+end_src

In addition, you can pick up the encoding used in the Org-mode buffer and pass


@@ 325,7 325,7 @@ follows:

#+name: inputenc
#+begin_src org :exports code
  #+LATEX_HEADER: \usepackage[AUTO]{inputenc}
  ,#+LATEX_HEADER: \usepackage[AUTO]{inputenc}
#+end_src

* Creating PDF Output


@@ 652,12 652,12 @@ the title, or create a custom title page, then perhaps the best way to
do this was posted to the Org-mode list by Nick Dokos:

#+begin_example
#+LATEX_HEADER: \input{mytitle}
,#+LATEX_HEADER: \input{mytitle}

 * Foo
,* Foo
 foo

 * Bar
,* Bar
 bar
#+end_example



@@ 757,13 757,13 @@ emacs-style code differs from the specially formatted emacs-lisp
source code.

#+begin_example
, #+LATEX_CLASS: article
, #+LaTeX_HEADER: \usepackage{minted}
, #+LaTeX_HEADER: \usemintedstyle{emacs}
, #+LaTeX_HEADER: \newminted{common-lisp}{fontsize=\footnotesize}
,#+LATEX_CLASS: article
,#+LaTeX_HEADER: \usepackage{minted}
,#+LaTeX_HEADER: \usemintedstyle{emacs}
,#+LaTeX_HEADER: \newminted{common-lisp}{fontsize=\footnotesize}

, #+name: setup-minted
, #+begin_src emacs-lisp :exports both :results silent
,#+name: setup-minted
,#+begin_src emacs-lisp :exports both :results silent
     (setq org-latex-listings 'minted)
     (setq org-latex-custom-lang-environments
           '(


@@ 777,12 777,12 @@ source code.
           '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
             "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
             "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))
, #+end_src
,#+end_src

, #+name: another-listing
, #+begin_src python :exports code
,#+name: another-listing
,#+begin_src python :exports code
   x = str(y)
, #+end_src
,#+end_src
#+end_example

When this example is exported (=C-c C-e d=) the resulting pdf file


@@ 821,15 821,15 @@ the =latex= link type is used to call the new =python= command to
typeset an inline code snippet.

#+begin_example
, #+LATEX_CLASS: article
, #+LaTeX_HEADER: \usepackage{listings}
, #+LaTeX_HEADER: \lstnewenvironment{common-lispcode}
, #+LaTeX_HEADER: {\lstset{language={Lisp},basicstyle={\ttfamily\footnotesize},frame=single,breaklines=true}}
, #+LaTeX_HEADER: {}
, #+LaTeX_HEADER: \newcommand{\python}[1]{\lstset{language={Python},basicstyle={\ttfamily\small}}\lstinline{#1}}

, #+name: setup-listings
, #+begin_src emacs-lisp :exports both :results silent
,#+LATEX_CLASS: article
,#+LaTeX_HEADER: \usepackage{listings}
,#+LaTeX_HEADER: \lstnewenvironment{common-lispcode}
,#+LaTeX_HEADER: {\lstset{language={Lisp},basicstyle={\ttfamily\footnotesize},frame=single,breaklines=true}}
,#+LaTeX_HEADER: {}
,#+LaTeX_HEADER: \newcommand{\python}[1]{\lstset{language={Python},basicstyle={\ttfamily\small}}\lstinline{#1}}

,#+name: setup-listings
,#+begin_src emacs-lisp :exports both :results silent
  (setq org-latex-listings 'listings)
  (setq org-latex-custom-lang-environments
        '((emacs-lisp "common-lispcode")))


@@ 850,14 850,14 @@ typeset an inline code snippet.
       (format "<span class=\"%s\">%s</span>" path desc))
      ((eq format 'latex)
       (format "\\%s{%s}" path desc)))))
, #+end_src
,#+end_src

, #+name: another-listing
, #+begin_src python :exports code
,#+name: another-listing
,#+begin_src python :exports code
  x = str(y)
, #+end_src
,#+end_src

, This is an inline snippet of Python: [[latex:python][x = str(y)]].
This is an inline snippet of Python: [[latex:python][x = str(y)]].
#+end_example

When this example is exported, both source code blocks are typeset

M org-tutorials/org-latex-preview.org => org-tutorials/org-latex-preview.org +1 -1
@@ 103,7 103,7 @@ installed with the command =apt-get install dvipng=.
To test the installation, create a small TeX file:

#+BEGIN_EXAMPLE
#+BEGIN_SRC latex :tangle /tmp/example.tex
,#+BEGIN_SRC latex :tangle /tmp/example.tex
\documentclass{article}

\begin{document}

M org-tutorials/org-plot.org => org-tutorials/org-plot.org +1 -1
@@ 211,7 211,7 @@ different =with:= options =with:points=, =with:lines=, and
The question of the proper syntax for setting axis labels via org-plot
has occurred on the mailing list.[fn:1] The answer is to use this:
#+BEGIN_EXAMPLE
#+PLOT: set:"xlabel 'Name'" set:"ylabel 'Name'"
,#+PLOT: set:"xlabel 'Name'" set:"ylabel 'Name'"
#+END_EXAMPLE

* Reference

M org-tutorials/org-publish-html-tutorial.org => org-tutorials/org-publish-html-tutorial.org +4 -4
@@ 132,11 132,11 @@

   The most important settings here are:

   | =base-directory=       | The components root directory.                                                                                                |
   | =base-extension=       | Filename suffix without the dot.                                                                                              |
   | =publishing-directory= | The base directory where all our files will be published.                                                                     |
   | =base-directory=       | The components root directory.                                                                                            |
   | =base-extension=       | Filename suffix without the dot.                                                                                          |
   | =publishing-directory= | The base directory where all our files will be published.                                                                 |
   | =recursive=            | If =t=, include subdirectories - we want that. Subdirectories in =:publishing-directory= are created if they don't yet exist. |
   | =publishing-function=  | If and how org should process the files in this component. In this case: convert the Org-mode files to HTML.                  |
   | =publishing-function=  | If and how org should process the files in this component. In this case: convert the Org-mode files to HTML.              |

** The /static/ component


M org-tutorials/org4beginners.org => org-tutorials/org4beginners.org +12 -12
@@ 167,18 167,18 @@ get to know Org mode. Start a new document (*C-x b*), call it 2.org, and
copy and paste the following in it:

#+BEGIN_SRC org
 #-*- mode: org -*-
 #+STARTUP: showall

 * Welcome to Org mode

   Welcome, and thanks for trying out Org mode. Making outlines in
   Org is very simple. It is just text! Just start typing.
 * This is a headline, it starts with one or more stars
   A heading has one star, a sub-heading two, etc.
 * Working with lists
 ** Moving around in our outline
 ** Moving around headlines
#-*- mode: org -*-
,#+STARTUP: showall

,* Welcome to Org mode

  Welcome, and thanks for trying out Org mode. Making outlines in
  Org is very simple. It is just text! Just start typing.
,* This is a headline, it starts with one or more stars
  A heading has one star, a sub-heading two, etc.
,* Working with lists
,** Moving around in our outline
,** Moving around headlines
#+END_SRC

Save the file (*C-x C-s*) as 2.org, and you will notice that the colors

M users/rpr.org => users/rpr.org +19 -19
@@ 63,36 63,36 @@ At the end of the day (although more realistically, every couple of days) I go t
I use org-mode primarily to make outlines. I make an outline for pretty much everything I'm working on, now. For example, if I'm working on a research proposal where I have to fill out a template in Word, I'll still make an outline like this:

#+BEGIN_SRC org
* Page 1
* Page 2
* Page 3
,* Page 1
,* Page 2
,* Page 3
#+END_SRC
etc.

I'll then use C-c C-t to turn them into TODOs.

#+BEGIN_SRC org
* TODO Page 1
* TODO Page 2
* TODO Page 3
,* TODO Page 1
,* TODO Page 2
,* TODO Page 3
#+END_SRC

When I finish a page, I'll close it using C-c C-t
#+BEGIN_SRC org
* DONE Page 1
,* DONE Page 1
  CLOSED: [2009-07-28 Tue 17:23]
* TODO Page 2
* TODO Page 3
,* TODO Page 2
,* TODO Page 3
#+END_SRC

Or add an explanation for why I couldn't finish it:

#+BEGIN_SRC org
* DONE Page 1
,* DONE Page 1
  CLOSED: [2009-07-28 Tue 17:23]
* TODO Page 2
** Meet with Alex re: statistical tests.
* TODO Page 3
,* TODO Page 2
,** Meet with Alex re: statistical tests.
,* TODO Page 3
#+END_SRC

...and either turn those into TODOs or add them to todo.org using Remember.


@@ 104,12 104,12 @@ This way, I can complete a document without having to look through it for the in
Of course, org-mode works wonderfully for proper outlines, too. I go from brief notes about what a document should be to the full version using a similar workflow. For example, I'll start a manuscript by entering:

#+BEGIN_SRC org
* TODO Abstract
* TODO Introduction
* TODO Methods
* TODO Results
* TODO Discussion
* TODO Contributions
,* TODO Abstract
,* TODO Introduction
,* TODO Methods
,* TODO Results
,* TODO Discussion
,* TODO Contributions
#+END_SRC
and fill it in, marking sections as done (and folding them away) as I finish. For huge documents, org-mode's folding (using either TAB to expand at point or S-TAB to see the whole file) is particularly useful because I can quickly see the flow and structure of a document at a glance.