* lisp/ob.el:
Fix `org-babel-result-end' command to provide consistent result
removal where result is type `wrap'. Prior to this fix
multiple (org-ctrl-c-ctrl-c) commands will add multiple newlines to
the end of results (one newline per block execution).
This fixes the test `test-ob/org-babel-remove-result--results-wrap'
* testing/lisp/test-ob.el:
Uncomment test since it now passes.
* lisp/ob-exp.el (org-babel-exp-call-line-template): Control export of
additional call line information.
(org-babel-exp-non-block-elements): Fancier call line export.
* testing/examples/babel.org (an): Example data to test new call line
export.
* testing/lisp/test-ob-exp.el (ob-exp/export-call-line-information):
Test new call line export.
* lisp/ob-exp.el (org-babel-exp-results): Alter a copy of info.
* testing/examples/babel.org (an): Example data for test behavior.
* testing/lisp/test-ob-exp.el (ob-exp/noweb-no-export-and-exports-both):
Confirm proper behavior.
* lisp/ob-emacs-lisp.el: A comment on the last line of an emacs-lisp
code block would cause an error when the block is was executed. This
fix cures this behaviour.
* testing/lisp/test-ob-emacs-lisp.el: Regression tests for the above
fix.
* testing/examples/babel.org:
* testing/examples/table.org:
* testing/lisp/test-ob.el:
* testing/lisp/test-org-table.el:
Tests that used to write to a test-example file (ie testing/babel.org)
have been modified to write to temp files instead.
This avoids leaving open and /modified/ tests in Emacs when tests are
run by `org-test-run-all-tests'.
In Emacs 22 the `kill-buffer' argument is NOT optional. This change
reflects this and allows the macro `org-test-with-temp-text-in-file'
to work in Emacs 22 for org compatibility. This fixes the test
`test-ob-lob/do-not-eval-lob-lines-in-example-blocks-on-export'
Thanks to Martyn Jago for the test case
* lisp/ob.el (org-babel-balanced-split): Explicit checking if list
before calling member.
* testing/lisp/test-ob.el (test-ob/org-babel-balanced-split): Testing
the new Emacs22-proof behavior.
Thanks to Martyn Jago for the test case
* lisp/ob.el (org-babel-balanced-split): Explicit checking if list
before calling member.
* testing/lisp/test-ob.el (test-ob/org-babel-balanced-split): Testing
the new Emacs22-proof behavior.
* lisp/ob-ref.el (org-babel-ref-split-args): Now uses
`org-babel-balanced-split'.
* testing/lisp/test-ob.el (test-ob/splitting-variable-lists-in-references):
Test new working behavior.
* lisp/ob.el (org-babel-expand-noweb-references): Fixed regexp.
* testing/lisp/test-ob.el (test-ob/noweb-expansion): Test both named
code block and noweb-ref header argument references.
* doc/org.texi (eval): Documenting the full range of :eval header
argument values.
* lisp/ob.el (org-babel-confirm-evaluate): Adding support for new
range of :eval header arguments.
* testing/lisp/test-ob.el (test-ob/eval-header-argument): Testing the
:eval header argument.
* lisp/ob-ref.el (org-babel-update-intermediate): New custom variable.
(org-babel-ref-resolve): Optionally update the in-buffer results of
code blocks which are evaluated to resolve references.
* lisp/ob.el (org-babel-join-splits-near-ch): Rejoins a list of a
split string when a character appears on either side of the split.
(org-babel-parse-multiple-vars): Rejoin splits around "=" signs.
* lisp/ob-exp.el (org-babel-exp-lob-one-liners): Don't limit
in-verbatim check to inline code blocks, do lob code blocks as well.
* testing/lisp/test-ob-lob.el (test-ob-lob/do-not-eval-lob-lines-in-example-blocks-on-export):
Test ensuring that #+call lines in verbatim blocks are not evaluated
* lisp/ob.el (org-babel-named-src-block-regexp-for-name): Ensure that
partial names are not matched.
(org-babel-named-data-regexp-for-name): Ensure that partial names
are not matched.
* testing/lisp/test-ob.el (test-ob/do-not-resolve-to-partial-names-data):
Test to ensure that partial names are not matched.
* lisp/ob-ref.el (org-babel-ref-resolve): Search for named code blocks
before named data.
* lisp/ob.el (org-babel-named-data-regexp-for-name): New function for
finding named data.
* testing/lisp/test-ob.el (test-ob/resolve-code-blocks-before-data-blocks):
Test to ensure that named references are resolved in the correct
order.
* lisp/ob-ref.el (org-babel-ref-resolve): Don't change location when
looking at the contents.
* testing/lisp/test-ob.el (test-ob/catches-all-references): Test
enforcing the correct behavior.
* lisp/ob.el (org-babel-find-named-result): Downcase "name" before comparison.
* testing/lisp/test-ob.el (test-ob/does-not-replace-a-block-with-the-results):
Test that named code blocks are replaced with their results.
* testing/lisp/test-ob-R.el (featurep): Signal missing dependencies
with an error rather than a throw.
* testing/org-test.el (missing-test-dependency): Define the error
signal for missing dependencies.
(org-test-for-executable): Signal missing dependencies with an error
rather than a throw.
(org-test-load): Define an expected failing test for each file with
missing dependencies.
* testing/lisp/test-ob.el (test-org-babel/nested-code-block):
Evaluation of a nested block.
(test-org-babel/partial-nested-code-block): Evaluation of a
partially nested block.
* lisp/ob-exp.el (org-babel-in-example-or-verbatim): Some valid
execution contexts (e.g., call lines) look like commented lines.
* lisp/ob.el (org-babel-get-src-block-info): Empty match string
doesn't count.
(org-babel-process-params): Always process parameters, even if you
don't to table splitting.
* testing/lisp/test-ob-C.el (ob-C/table): Ignore failures for this C
test.
* testing/lisp/test-ob-fortran.el (ob-fortran/input-var): Ignore
failures for this fortran test.
This results in the following behavior.
#+property: var foo=1
#+property: var+ bar=2
#+begin_src emacs-lisp
(+ foo bar)
#+end_src
#+results:
: 3
#+begin_src emacs-lisp
(org-entry-get (point) "var" t)
#+end_src
#+results:
: foo=1 bar=2
* overwriting a file-wide property
:PROPERTIES:
:var: foo=7
:END:
#+begin_src emacs-lisp
foo
#+end_src
#+results:
: 7
#+begin_src emacs-lisp
(org-entry-get (point) "var" t)
#+end_src
#+results:
: foo=7
* appending to a file-wide property
:PROPERTIES:
:var+: baz=3
:END:
#+begin_src emacs-lisp
(+ foo bar baz)
#+end_src
#+results:
: 6
#+begin_src emacs-lisp
(org-entry-get (point) "var" t)
#+end_src
#+results:
: foo=1 bar=2 baz=3
* lisp/org.el (org-update-property-plist): Updates a given property
list with a property name and a property value.
(org-set-regexps-and-options): Use org-update-property-plist.
(org-entry-get): Use org-update-property-plist.
* testing/examples/property-inheritance.org: Example file for testing
appending property behavior.
* testing/lisp/test-property-inheritance.el: Tests of appending
property behavior.
* lisp/ob.el (org-babel-balanced-split): Allow splitting on single
characters as well as groups of two characters.
(org-babel-parse-multiple-vars): Split variables on single spaces.
Nick Dokos <nicholas.dokos@hp.com> writes:
> Eric Schulte <schulte.eric@gmail.com> wrote:
>
>> The attached updated patch fixes a bug in the original.
>>
>
> Minor problem in applying:
>
> ,----
> | $ git apply ~/Mail/inbox/724
> | /home/nick/Mail/inbox/724:671: trailing whitespace.
> | #+name:
> | /home/nick/Mail/inbox/724:599: new blank line at EOF.
> | +
> | warning: 2 lines add whitespace errors.
> `----
The attached version fixes these issues, Thanks -- Eric
>From 0e43d59ee8d46a63f86780a502de726271bc39de Mon Sep 17 00:00:00 2001
From: Eric Schulte <schulte.eric@gmail.com>
Date: Fri, 28 Oct 2011 10:44:21 -0600
Subject: [PATCH] removing code block, results and call-line synonyms -- BREAKING CHANGE
Following a round of on-list discussion many code block synonyms have
been removed, moving forward the following syntax is valid.
- call lines are specified with #+call:
- code blocks are named with #+name:
- results are named with #+name:, however results generated by a code
block may still be labeled with #+results:, and tables named with
#+tblname: will be considered to be named results
The following function may be used to update an existing Org-mode
buffer to the new syntax.
(defun update-org-buffer ()
"Update an Org-mode buffer to the new data, code block and call line syntax."
(interactive)
(save-excursion
(flet ((to-re (lst) (concat "^[ \t]*#\\+" (regexp-opt lst t)
"\\(\\[\\([[:alnum:]]+\\)\\]\\)?\\:[ \t]*"))
(update (re new)
(goto-char (point-min))
(while (re-search-forward re nil t)
(replace-match new nil nil nil 1))))
(let ((old-re (to-re '("RESULTS" "DATA" "SRCNAME" "SOURCE")))
(lob-re (to-re '("LOB")))
(case-fold-search t))
(update old-re "name")
(update lob-re "call")))))
Note: If an old version of Org-mode (e.g., the one shipped with Emacs)
is installed on your system many of the important variables will
be pre-defined with a defvar and *will not* have their values
automatically updated, these include the following.
- org-babel-data-names
- org-babel-result-regexp
- org-babel-src-block-regexp
- org-babel-src-name-regexp
- org-babel-src-name-w-name-regexp
It may be necessary to either remove the source code of older
versions of Org-mode, or to explicitly evaluate the ob.el file.
* lisp/ob-exp.el (org-exp-res/src-name-cleanup): Updated
Documentation.
* lisp/ob-lob.el (org-babel-block-lob-one-liner-regexp): Updated
regular expression.
(org-babel-inline-lob-one-liner-regexp): Updated regular expression.
* lisp/ob-ref.el (org-babel-ref-resolve): Notice when something that
looks like a data results may actually be a code block.
* lisp/ob-table.el: Updated documentation.
* lisp/ob.el (org-babel-src-name-regexp): Simplified regexp.
(org-babel-get-src-block-info): Updated match strings.
(org-babel-data-names): Simplified acceptable names.
(org-babel-find-named-block): Indentation.
(org-babel-find-named-result): Updated to not return a code block as
a result.
* lisp/org.el (org-fontify-meta-lines-and-blocks-1): Removing
references to old syntactic elements.
(org-additional-option-like-keywords): Removing references to old
syntactic elements.
* contrib/babel/library-of-babel.org: Updated to make use of the new
syntax.
* testing/examples/babel-dangerous.org: Updated to make use of the new
syntax.
* testing/examples/babel.org: Updated to make use of the new syntax.
* testing/examples/ob-awk-test.org: Updated to make use of the new
syntax.
* testing/examples/ob-fortran-test.org: Updated to make use of the new
syntax.
* testing/lisp/test-ob.el: Removed two bad tests which tested the
literal values of old regular expressions rather than their
behavior.
Please consider a patch to construct a table from the output of maxima
code block.
>From a0305117f4e793c93d7d10bc7aab04f96bd62e9c Mon Sep 17 00:00:00 2001
From: Litvinov Sergey <slitvinov@gmail.com>
Date: Sat, 1 Oct 2011 22:29:18 +0200
Subject: [PATCH] [ob-maxima] Construct a table from the output of the code block. Add
ert tests.
The first patch maps cpp language code to c++-mode. The second patch
adds tests for ob-C.
>From fba6eef6944766e675e4abe1d11d347b9a728031 Mon Sep 17 00:00:00 2001
From: Sergey Litvinov <slitvinov@gmail.com>
Date: Wed, 3 Aug 2011 22:03:19 +0200
Subject: [PATCH 2/2] Add tests for ob-C.el
Additionally, replace one
(or (org-mode-p) (derived-mode-p 'org-mode))
with
(derived-mode-p 'org-mode)
cause that is reflexive anyway (returns true, if the current mode is
org-mode).
Delete one check testing for org-mode or org derived mode
* lisp/test-org-html.el (org-test-html/export-link): New
macro. Compose link export test.
(test-org-html/export-link-factory)
(test-org-html/export-link-alist): Remove factory variable and
function, use new macro instead.
* testing/org-test.el (org-exe-not-found): An error type used to
signal a missing executable
(org-test-for-executable): A function used by test files to throw an
error if a required executable is not present.
(org-test-load): Simply skip files for which the required
executables are not present.
* testing/lisp/test-ob-R.el: Conditional loading.
* testing/lisp/test-ob-awk.el: Conditional loading.
* testing/lisp/test-ob-fortran.el: Conditional loading.
* test-org.el (test-org/org-link-unescape-ascii-extended-char):
Explicitely set coding system for unescaped string.
Needed for Emacs22 to pass these tests. The input string is extended
ASCII which is covered by latin-1 coding system.
* testing/examples/babel.org (an): Test the combination of code block
results wrapper and type.
* testing/lisp/test-ob.el (test-org-babel/combining-scalar-and-raw-result-types):
Test the combination of code block results wrapper and type.
* testing/examples/org-exp.org: Example file for export tests.
* testing/lisp/test-org-exp.el (test-org-exp/stripping-commas): List
file for export tests.
* testing/org-test.el (org-test-touch-all-examples): Open all example
files -- seems to help resolution of org ids.
(org-test-run-all-tests): Open all example files before running
tests.
> Hi
>
> I've added functionality to make ob-lilypond act in a consistent
> org-babel way by default (think ob-dot).
>
> The previous modus operandi is now known as arrange-mode and is
> selected by setting ly-arrange-mode to t
>
> More details including examples are at
> http://github.com/mjago/ob-lilypond
* lisp/ob-exp.el (org-babel-in-example-or-verbatim): Also check for in
verbatim emphasis.
(org-babel-exp-lob-one-liners): Cleaner checking for escaped call
lines.
* testing/examples/babel.org: Example data for new test.
* testing/lisp/test-ob-tangle.el
(ob-tangle/no-excessive-id-insertion-on-tangle): Safer to narrow,
and less work.
(ob-tangle/continued-code-blocks-w-noweb-ref): Testing new
:noweb-ref header argument.
* lisp/test-org-html.el (test-org-html/export-link-alist): New
variable. Abstract link export test definition.
(test-org-html/export-link-factory): New function. Create tests for
link export.
* test-org-table.el (test-org-table/org-table-convert-refs-to-rc/3)
(test-org-table/org-table-convert-refs-to-rc/2)
(test-org-table/org-table-convert-refs-to-rc/1)
(test-org-table/org-table-convert-refs-to-an/3)
(test-org-table/org-table-convert-refs-to-an/2)
(test-org-table/org-table-convert-refs-to-an/1): Provide tests for
table formular format conversion.
Thanks to Charles C. Berry for insisting on this issues existence
This change is now secured with a unit test
* lisp/ob.el (org-babel-parse-header-arguments): Stripping trailing
spaces off of header arguments (even the first one).
* test-org.el (test-org/org-link-escape-ascii-character)
(test-org/org-link-escape-ascii-ctrl-character)
(test-org/org-link-escape-multibyte-character)
(test-org/org-link-escape-custom-table)
(test-org/org-link-escape-custom-table-merge)
(test-org/org-link-unescape-ascii-character)
(test-org/org-link-unescape-ascii-ctrl-character)
(test-org/org-link-unescape-multibyte-character)
(test-org/org-link-unescape-ascii-extended-char): New tests for
unicode aware percent escaping
All tests for escaping/unescaping multibyte characters are expected to
fail at the moment, because org-link-escape/unescape is not yet
unicode aware.
* lisp/ob.el (org-babel-sha1-hash): now handles more complex types in
params
* testing/examples/babel.org: whitespace
* testing/lisp/test-ob.el (test-org-babel/sha1-hash): new test for
babel hashing
* lisp/ob-lob.el (org-babel-lob-execute): now expanding variable
references before execution
* lisp/ob.el (org-babel-merge-params): better indentation, and finally
sorted out the proper replacement of conflicting variable
definitions
ob-get-src-block-info wasn't correctly returning the name of the
code block
* lisp/ob-lob.el (org-babel-lob-ingest): now returns the count of
ingested code blocks
* lisp/ob.el (org-babel-get-src-block-info): walks up possible
additional header arg lines before checking for the code block name
(org-babel-merge-params): can now handle empty variables gracefully
includes a simple export test
* lisp/ob-exp.el (org-babel-exp-in-export-file): wrapper for
collecting information from within the original export file
(org-babel-exp-src-blocks): simplified through use of the above
macro
(org-babel-exp-code): simplified through the use of new functions
for parsing header arguments
(org-babel-exp-results): simpler high-level organization, also this
is now where the expansion of variable references takes place during
export
* lisp/ob.el (org-babel-expand-variables): broke variable replacement
in a parameter list into it's own function
(org-babel-get-src-block-info): now using the above function
for example, from the test of this functionality
* multi-line header arguments
:PROPERTIES:
:ID: b77c8857-6c76-4ea9-8a61-ddc2648d96c4
:END:
(map 'list #'list numbers letters)
| 1 | a |
| 2 | b |
| 3 | c |
| 4 | d |
| 5 | e |
| 6 | f |
| 7 | g |
* lisp/ob.el (org-babel-multi-line-header-regexp): new variable for
matching header lines preceding code blocks
(org-babel-src-name-w-name-regexp): now includes possible header
lines between source name and code block
(org-babel-get-src-block-info): now also collecting header arguments
from preceding header lines
(org-babel-src-block-names): updated match-string to reflect new
value of org-babel-src-name-w-name-regexp
(org-babel-merge-params): fixed error in variable string regexp
* org-test-which-func: New function. Find name of defun around point.
* org-test-ensure-buffer-emacs-lisp-p: New function. Ensure a buffer
hold an elisp file based on filename extension.