Commit Graph

268 Commits

Author SHA1 Message Date
Nicolas Goaziou c7203b4142 org-export: Change source code handling API
* contrib/lisp/org-element.el (org-element-example-block-parser,
  org-element-src-block-parser): Add `:number-lines',
  `:preserve-indent, `:retain-labels', `:use-labels'  and
  `:label-fmt' properties.
* contrib/lisp/org-export.el (org-export-resolve-coderef,
  org-export-get-loc): Apply changes to src-block and example-block
  elements' properties.
(org-export-unravel-code, org-export-format-code,
org-export-format-code-default): New functions.
(org-export-handle-code): Removed function.
* EXPERIMENTAL/org-e-latex.el (org-e-latex-example-block): Use new
  function.
(org-e-latex-src-block): Use new API.  Better handling of numbered
lines with special packages.
* EXPERIMENTAL/org-e-ascii.el (org-e-ascii-example-block,
  org-e-ascii-src-block): Use new functions.
* testing/lisp/test-org-element.el: Add tests.
* testing/lisp/test-org-export.el: Add tests.
2012-03-10 13:42:46 +01:00
Nicolas Goaziou 86131a8b50 org-element: New `org-element-down' function
* contrib/lisp/org-element.el (org-element-down): New function.
* testing/lisp/test-org-element.el: Add test.
2012-03-09 19:47:50 +01:00
Nicolas Goaziou dbe69f26aa Merge branch 'maint' 2012-03-04 16:40:43 +01:00
Nicolas Goaziou b549c60065 test-org-footnote: Fix a broken test (part 2)
* testing/lisp/test-org-footnote.el: Fix
  `test-org-footnote/normalize-outside-org'.
2012-03-04 16:39:43 +01:00
Nicolas Goaziou 1b06c10e2c Merge branch 'maint' 2012-03-04 15:55:41 +01:00
Nicolas Goaziou f1a99ceddf test-org-footnote: Fix a broken test
* testing/lisp/test-org-footnote.el: Fix failing
  `test-org-footnote/normalize-outside-org'.
2012-03-04 15:53:55 +01:00
Nicolas Goaziou f18ea108aa test-org-export: Fix broken test
* testing/lisp/test-org-export.el (test-org-export/export-scope): In
  batch mode, `transient-mark-mode' must be turned on.
2012-03-04 14:38:57 +01:00
Nicolas Goaziou bf609d8844 org-export: Avoid duplicates in `org-export-collect-footnote-definitions'
* contrib/lisp/org-element.el (org-element-map): New optional argument
  to avoid recursion into certain recursive types.
* contrib/lisp/org-export.el (org-export-footnote-first-reference-p,
  org-export-get-footnote-number,
  org-export-collect-footnote-definitions): Use new argument from
  `org-element-map'.
* testing/lisp/test-org-export.el: Add test.

The new argument allows to force entering footnotes definitions at
a certain time (when their first reference is found) but not a second
time when they are encountered in the parse tree.

Thanks to Jambunathan for reporting this.
2012-03-04 11:57:16 +01:00
Eric Schulte 6fd14fe683 adding a test to protect the "results don't replace code block" functionality 2012-03-03 07:45:20 -07:00
Nicolas Goaziou baa7321d17 Merge branch 'maint' 2012-03-02 22:38:26 +01:00
Nicolas Goaziou 6b91eb9e65 org-footnote: Fix normalization of inline footnotes with no footnote section
* lisp/org-footnote.el (org-footnote-normalize): Fix normalization of
  inline footnotes with no footnote section.
* testing/lisp/test-org-footnote.el: New test file.

Thanks to Samuel Wales for reporting this.
2012-03-02 22:37:12 +01:00
Nicolas Goaziou aa5db9dd65 test-org: Fix a broken test
* testing/lisp/test-org.el (test-org-export/fuzzy-links): Fix the "No
  link found" error.
2012-03-02 15:14:23 +01:00
Eric Schulte a3a48f698f ensure that test constants are loaded by org-test.el 2012-03-01 11:37:04 -07:00
Eric Schulte 618eb91e12 fully remove contrib/ from the test infrastucture 2012-03-01 11:28:46 -07:00
Nicolas Goaziou 933c0fa441 Implement numbered cross-references
* lisp/org.el (org-link-search): Search for #+name affiliated keywords
  and invisible targets.
* contrib/lisp/org-element.el (org-element-link-parser): Remove "ref"
  links relative part.
(org-element-target-parser): Move property name from `:raw-value' to
`:value'.
(org-element-recursive-objects): Remove targets from tables.  Cells
are not parsed unless explicitely asked by back-end developer, too
late.  A target wouldn't be noticed in time.  One solution could be to
parse every table, but that's time consumming.
(org-element-object-restrictions): Target are not recursive anymore.
* contrib/lisp/org-export.el (org-export-resolve-fuzzy-link): Find
  elements with a matching "#+name: path" affiliated keyword.
(org-export-get-ordinal): Make special cases for headlines, items,
footnotes definitions and references.
(org-export-resolve-ref-link): Removed function.
* EXPERIMENTAL/org-e-latex.el (org-e-latex-link): Handle
  cross-reference numbers.
(org-e-latex-target): Targets have no contents.
* EXPERIMENTAL/org-e-ascii.el (org-e-ascii--describe-links): Ignore
  fuzzy links in link description at the end of the section.
(org-e-ascii-link): Handle cross-reference numbers.
* testing/contrib/lisp/test-org-export.el: Add tests.
* testing/lisp/test-org.el: Add tests.
2012-03-01 14:49:53 +01:00
Nicolas Goaziou b2fb61cd56 Merge branch 'maint' 2012-02-29 21:04:52 +01:00
Nicolas Goaziou bdb66b4c61 org-list: Fix small bug
* lisp/org-list.el (org-list-struct): Fix small bug introduced by
  commit 8b7a3f2498.
* testing/lisp/test-org-list.el: Add test.
2012-02-29 21:04:15 +01:00
Nicolas Goaziou 73c5044963 org-export: Add `org-export-headline-numbered-p' predicate
* contrib/lisp/org-export.el (org-export-numbered-headline-p): New function.
* EXPERIMENTAL/org-e-ascii.el: Apply new function.
* EXPERIMENTAL/org-e-latex.el: Apply new function.
* testing/lisp/test-org-export.el: Add a test.
2012-02-29 19:05:45 +01:00
Nicolas Goaziou 8740f212d0 Move two test files into common test directory
* testing/lisp/test-org-element.el: Moved location from
  testing/contrib/lisp/ to testing/lisp.
* testing/lisp/test-org-export.el: Moved location from
  testing/contrib/lisp/ to testing/lisp.
2012-02-29 18:39:32 +01:00
Eric Schulte 87fe06b313 removing trailing ")"s 2012-02-29 09:10:08 -07:00
Eric Schulte 3234811c49 cleaning headers of test files -- removing loads and requires 2012-02-29 09:10:08 -07:00
Nicolas Goaziou c166bfbb1a org-export: fix bug with nested footnotes in invisible definitions
* contrib/lisp/org-export.el (org-export-collect-footnote-definitions):
  Also collect footnotes in footnote definitions
(org-export-get-footnote-number): Remove unused check.
* testing/contrib/lisp/test-org-export.el: Add test.
2012-02-26 10:57:42 +01:00
Nicolas Goaziou 12c94310a2 org-export: Allow nested footnotes (part 2)
* EXPERIMENTAL/org-e-latex.el (org-e-latex-footnote-reference):
  Correctly handle numbering with nested footnotes.
* contrib/lisp/org-element.el (org-element-map): Apply function to
  element or object before applying it to its secondary string, if
  any.  Otherwise, linearity is broken.
* contrib/lisp/org-export.el (org-export-footnote-first-reference-p,
  org-export-get-footnote-number): Take care of recursive footnotes.
(org-export-get-genealogy): Correctly get genealogy of an item within
a secondary string.
* testing/contrib/lisp/test-org-export.el: Add tests.
2012-02-26 01:38:26 +01:00
Nicolas Goaziou 81cc6dff19 org-e-latex: Allow nested footnotes
* EXPERIMENTAL/org-e-latex.el (org-e-latex-footnote-reference): Allow
  nested footnotes.
* contrib/lisp/org-element.el (org-element-string-restrictions): Allow
  footnote references within a footnote reference.
* testing/contrib/lisp/test-org-export.el: Add a test for nested
  footnotes.
2012-02-25 14:56:37 +01:00
Nicolas Goaziou 5313dc9d09 org-export: Allow user to explicitely ignore parts of parse tree
* contrib/lisp/org-export.el (org-export-collect-tree-properties):
  Do not overwrite any user's ignore list.
* testing/contrib/lisp/test-org-export.el: Add test.

A good way to populate `:ignore-list' is through the use of
`org-export-filter-parse-tree-functions', with the help of
`org-element-map' and `org-export-ignore-element'.  As an example, the
following code will skip every headline containing the word "note"
in its title during a LaTeX export:

(defun user-skip-note-headlines (data backend info)
  ;; For now LaTeX back-end is called `e-latex'.
  (when (eq backend 'test)
    ;; Traverse the parse tree, adding to ignore list any headline
    ;; matching criteria.
    (org-element-map
     data 'headline
     (lambda (headline)
       (when (string-match "\\<note\\>"
                           (org-element-property :raw-value headline))
         (org-export-ignore-element headline info)))
     info))
  ;; Return original DATA.
  data)

Then install it in parse-tree filters:

(add-to-list 'user-skip-note-headlines org-export-filter-parse-tree-functions)

Back-end delevopers will install it via `org-BACKEND-filters-alist'
where BACKEND stands for the name of the back-end considered.  Se
`org-export-filters-alist' for more information.
2012-02-25 14:55:21 +01:00
Nicolas Goaziou 752a531eb5 org-element: Refactor code 2012-02-24 22:33:16 +01:00
Nicolas Goaziou 404ede23fc org-element: Change algorithm for `org-element-at-point'
* contrib/lisp/org-element.el (org-element-at-point): Change
  algorithm.
(org-element-guess-type): Removed function.
(org-element--element-block-types): Removed variable.
(org-element-forward, org-element-backward, org-element-up): Rewrite
functions.
* testing/contrib/lisp/test-org-element.el: Add tests.
2012-02-24 17:52:43 +01:00
Nicolas Goaziou 94185eac92 org-export: Fix bug with recursive file inclusion and relative paths
* contrib/lisp/org-export.el (org-export-expand-include-keyword): Use
  another optional argument to specify the current working directory.
(org-export-as): Apply changes.
* testing/contrib/lisp/test-org-export.el: Add tests.
* testing/examples/include.org: New test file.
* testing/examples/include2.org: New test file.
2012-02-23 21:28:15 +01:00
Nicolas Goaziou 0fa24209cf org-export: Export snippets are not skipped automatically: back-ends decide
* contrib/lisp/org-export.el (org-export-snippet-backend): New
  function.
(org-export--skip-p): Remove automatic skip of export snippets.
* EXPERIMENTAL/org-e-ascii.el (org-e-ascii-export-snippet): Use new
  function.
* EXPERIMENTAL/org-e-html.el (org-e-html-export-snippet): Use new
  function.
* EXPERIMENTAL/org-e-latex.el (org-e-latex-export-snippet): Use new
  function.
* EXPERIMENTAL/org-e-odt.el (org-e-odt-export-snippet): Use new
  function.
* testing/contrib/lisp/test-org-export.el: Add test.

The idea behind this change is that a given back-end may decide to
keep an export snippet not directly targetted at it (i.e. a beamer
back-end that would want to keep latex snippets).  Hence, filtering
snippets is on back-ends side, and a new function is added to help
them in that task.
2012-02-23 18:21:29 +01:00
Nicolas Goaziou 8714fba308 org-element: COMMENT and QUOTE keywords, ARCHIVE tags are case sensitive
* contrib/lisp/org-element.el (org-element-headline-parser): COMMENT
  and QUOTE keywords, ARCHIVE tags are case sensitive.
* testing/contrib/lisp/test-org-element.el: New file.
2012-02-23 16:30:06 +01:00
Nicolas Goaziou 675713c539 org-export: Fix select-tag handling
* contrib/lisp/org-export.el (org-export-collect-tree-properties):
  Remove `:use-select-tags' property.
(org-export-populate-ignore-list): Renamed from
`org-export-get-ignore-list'.
(org-export--selected-trees): Renamed from
`org-export-use-select-tag-p'.
(org-export--skip-p): Use an additional argument to specify list of
trees containing a select tag.
(org-export-select-tags, org-export-exclude-tags,
org-export-with-priority): Change doc-string.
* testing/contrib/lisp/test-org-export.el: Tests modified
  accordingly.
2012-02-23 14:57:16 +01:00
Nicolas Goaziou a87c463818 org-element: Move archived tree handling out of org-element-map
* contrib/lisp/org-element.el: Move archived tree handling out of
  org-element-map.
* contrib/lisp/org-export.el (org-export-get-ignore-list): Properly
  ignore archived with `org-export-with-archived-trees' set to
  `headline'.
* testing/contrib/lisp/test-org-export.el (test-org-export/handle-options):
  Add a test for that.
2012-02-23 11:24:58 +01:00
Nicolas Goaziou a940e3d22c org-export: Fix some small bugs, include tests
* contrib/lisp/org-export.el (org-export-get-inbuffer-options): Fix
  but with incomplete macros returning an error.  Also with behaviour
  `nil', only insert new value if none was defined before.
(org-export-use-select-tags-p): Fix bug preventing it from properly
detecting select-tags.
(org-export--skip-p): Small refactoring
* testing/contrib/lisp/test-org-export.el: New test file.
2012-02-23 00:58:55 +01:00
Eric Schulte deb6e7a61e fixed test case broken by merge 2012-02-19 09:42:29 -07:00
Eric Schulte 3de3c470d8 Merge branch 'origin-maint'
Conflicts:
	contrib/lisp/org-mac-link-grabber.el
	doc/org.texi
	lisp/org-odt.el
	testing/lisp/test-ob.el
2012-02-19 09:36:13 -07:00
Martyn Jago 2189b9ac47 Regression tests regarding code block results and result removal/replacement.
* testing/lisp/test-ob.el:

Regression tests regarding code block results and result removal/replacement

Conflicts:

	testing/lisp/test-ob.el
2012-02-19 09:07:03 -07:00
Martyn Jago 50a35c42db Fix `org-babel-result-end' command to provide consistent result removal where result is type `wrap'.
* 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.

Conflicts:

	testing/lisp/test-ob.el
2012-02-19 08:27:56 -07:00
Martyn Jago 059bb972d1 Modify macro `org-test-with-temp-text-in-file' to work on emacs 22. * testing/org-test.el:
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'
2012-02-19 08:19:14 -07:00
Eric Schulte 2b2e853b1b fixed bug in org-babel-balanced-split when run on Emacs22
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.
2012-02-19 08:01:26 -07:00
Eric Schulte 47eb35bb89 tests of fixed subtree property accumulated behavior 2012-02-15 08:12:35 -07:00
Eric Schulte 571d26e5ca marking test as expected to fail given that it relies on the new export engine
* testing/lisp/test-ob-exp.el (ob-exp/export-from-a-temp-buffer):
  Marking test as expected to fail given that it relies on the new
  export engine
2012-02-03 09:43:43 -07:00
Eric Schulte 72fe32f17b test org-current-export-file->buffer behavior
Conflicts:

	testing/lisp/test-ob-exp.el: Resolving conflicts.
2012-02-03 09:38:28 -07:00
Eric Schulte a3e5f97ee7 New strip-export noweb header argument value
* lisp/ob-exp.el (org-babel-exp-src-block): Strip noweb references on
  export when "strip-export".
* lisp/ob.el (org-babel-common-header-args-w-values): New noweb
  header value.
  (org-babel-merge-params): New noweb header value.
  (org-babel-noweb-p): New noweb header value.
* testing/examples/babel.org (an): Testing new noweb header value.
* testing/lisp/test-ob-exp.el (ob-exp/noweb-strip-export-ensure-strips):
  Testing new noweb header value.
* doc/org.texi (noweb): Document new noweb header value.
2012-02-01 08:19:29 -07:00
Eric Schulte d03b013e2c Merge branch 'origin-maint'
Conflicts:
	testing/lisp/test-ob.el
2012-01-30 09:02:51 -07:00
Eric Schulte eb02808f97 splitting large tests up into smaller units
This make it easier to track down the cause of failing tests.
2012-01-30 08:54:25 -07:00
Eric Schulte 660e30b39c inline src block tests by Martyn Jago
* testing/lisp/test-ob.el (test-org-babel/inline-src_blk-preceded-punct):
  Inline src block tests by Martyn Jago.
2012-01-30 08:51:17 -07:00
Eric Schulte 9fb3e136d8 adding a "troubleshooting" section to the testing README 2012-01-28 15:51:57 -07:00
Eric Schulte 106e1b6477 renamed the testing README 2012-01-28 15:38:19 -07:00
Eric Schulte e1d0311dd4 greatly simplified the testing README 2012-01-28 15:38:03 -07:00
Eric Schulte 85974ce727 killing all of the test buffers 2012-01-24 09:41:21 -07:00
Martyn Jago c82ca2f19a Fix `org-babel-result-end' command to provide consistent result removal where result is type `wrap'.
* 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.
2012-01-24 09:36:40 -07:00
Eric Schulte b0eebd1ae1 be a little nicer about burying buffers used in running tests 2012-01-24 09:35:40 -07:00
Eric Schulte 2395c3eff1 Merge branch 'origin-maint' 2012-01-24 00:02:52 -07:00
Eric Schulte a706f42403 update tests 2012-01-24 00:02:33 -07:00
Eric Schulte 527e6844cc optionally export additional information with call lines
* 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.
2012-01-23 12:53:15 -07:00
Eric Schulte d3538624e7 Merge branch 'origin-maint'
Conflicts:
	lisp/ob-exp.el
	testing/examples/babel.org
2012-01-23 10:46:03 -07:00
Eric Schulte 43abeaa488 evaluate all executables in buffer order on export
* lisp/ob-exp.el (org-babel-exp-non-block-elements): Map over both
  inline src blocks and call lines on export.
2012-01-23 10:39:38 -07:00
Eric Schulte 10f26fb805 Merge branch 'origin-maint' 2012-01-20 12:00:31 -07:00
Litvinov Sergey f92facd890 Map "screen" to shell-script-mode 2012-01-20 11:47:13 -07:00
Eric Schulte 94f10ddfd7 don't always replace <<noweb>> references when :exports both
* 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.
2012-01-16 20:39:12 -07:00
Eric Schulte 4ce9b8044c test for customizable code block export 2012-01-14 12:41:40 -07:00
Eric Schulte 7423c15d3e added edbug specs for testing macro
* testing/lisp/test-property-inheritance.el (test-org-in-property-buffer):
  Added edbug spec.
* testing/org-test.el (org-test-at-id): Added edbug spec.
  (org-test-in-example-file): Added edbug spec.
2012-01-11 10:15:20 -07:00
Martyn Jago bd2794f5c1 Regression tests regarding code block results and result removal/replacement.
* testing/lisp/test-ob.el:

Regression tests regarding code block results and result removal/replacement
2012-01-06 13:11:21 -07:00
Martyn Jago 238673a8ae Changes to latest block export tests to suit Emacs 22. * testing/lisp/test-ob-exp.el:
Changes to latest block export tests to suit Emacs 22.
2012-01-06 09:35:03 +01:00
Eric Schulte 4db4fe84a8 Merge branch 'origin-maint' 2012-01-06 00:32:30 -07:00
Martyn Jago d270cfcf74 Fix to test-org-babel/org-babel-get-inline-src-block-matches. * testing/lisp/test-ob.el: Character position offset -=2 to account for removal of trailing spaces 2012-01-06 00:31:33 -07:00
Martyn Jago 3096cc3b61 Bug fix in ob-emacs-lisp.el.
* 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.
2012-01-06 00:31:00 -07:00
Bastien Guerry 6e10d36d92 Fix trailing whitespaces. 2012-01-05 18:17:29 +01:00
Martyn Jago b37be0237a Fixed and suplemented pending tests in `test-ob-exp.el'. * testing/examples/babel.org: examples altered and added to * testing/lisp/test-ob-exp.el: tests fixed and added to 2012-01-05 18:16:57 +01:00
Bastien Guerry 07e31dfa0d Delete trailing whitespaces. 2012-01-04 20:02:10 +01:00
Martyn Jago 2ef6100af5 Modify tests to avoid writing to non-temp test-example files.
* 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'.
2012-01-04 20:00:08 +01:00
Martyn Jago 49de19ba02 Modify macro `org-test-with-temp-text-in-file' to work on emacs 22. * testing/org-test.el:
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'
2012-01-04 17:30:13 +01:00
Eric Schulte 2c2e1a5448 fixed bug in org-babel-balanced-split when run on Emacs22
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.
2012-01-03 11:45:27 -07:00
Eric Schulte 8cffe3aabf fixed bug in org-babel-balanced-split when run on Emacs22
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.
2012-01-03 11:44:46 -07:00
Bastien Guerry e44d2975ff Fix copyright (to 2012) year and Org version (to 7.8.03). 2012-01-03 18:47:01 +01:00
Litvinov Sergey 0b7ae6ffb9 ob-octave.el: Add graphical output
* lisp/ob-octave.el: add graphical output to png file

    * testing/examples/ob-octave-test.org: add a test for graphical
      output, and a test for session
2011-12-17 09:04:20 -07:00
Eric Schulte b21da5f5d6 fixed bug in parsing of arguments to code block references
* 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.
2011-12-12 17:19:40 -07:00
Eric Schulte 3bf8d8fd86 fixed regexp when resolving noweb references
* 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.
2011-12-11 12:02:02 -07:00
Litvinov Sergey e6377a8295 Add string input variables to ob-octave.el. Add tests for ob-octave.el 2011-12-10 06:12:29 -07:00
Eric Schulte e0748cdebd tests for the colnames header argument 2011-11-28 11:23:42 -07:00
Eric Schulte a998cae722 the :eval header argument now takes 4(6) possible values
* 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.
2011-11-22 07:32:39 -07:00
Eric Schulte 3693952e3b New option to update intermediate in-buffer results
* 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.
2011-11-21 10:02:39 -07:00
Eric Schulte 82c0f9bf69 Allow spaces around "=" in code block variable specifications
* 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.
2011-11-20 09:40:08 -07:00
Eric Schulte 41387f4675 marked test as expected to pass, because it is now passing 2011-11-20 09:39:09 -07:00
Eric Schulte f55810593e don't try to evaluate #+call lines in verbatim blocks
* 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
2011-11-18 11:30:59 -07:00
Eric Schulte 1f206ed477 new testing macro for in-file execution with temp text
* testing/org-test.el (org-test-with-temp-text-in-file): A new testing
  macros for temp-text tests which require a file name (e.g., for
  export).
2011-11-18 11:30:59 -07:00
Eric Schulte 7c21098323 Don't match partial names when resolving code or data references
* 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.
2011-11-16 06:15:31 -07:00
Eric Schulte 19884ab280 resolve named code blocks before named data
* 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.
2011-11-15 20:13:41 -07:00
Eric Schulte 1b6de8fad5 ignore org-id file generated during testing 2011-11-15 11:19:39 -07:00
Eric Schulte c21692506d fix bug missing references to example blocks
* 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.
2011-11-15 11:18:26 -07:00
Eric Schulte 9702f5520e revert changes to interactive function `org-test-run-all-tests' 2011-11-15 08:56:25 -07:00
Martyn Jago 0440b83ac5 Changes to fix sandboxed tests to suit the standard code block syntax, and some changes to reduce ID testing scope and improve result gathering. * testing/org-test.el: Add org as an executable language for sand-boxed testing to suit the standard code block syntax. Use .org-test-id-locations as ID file temporarily whilst testing. Add `org-test-update-id-locations' to do just that. Clear *Messages* buffer and temporarily set `message-log-max to t to ensure capturing entire test backtrace.
* testing/.gitignore: ignore testing/.org-test-id-locations
2011-11-15 08:56:25 -07:00
Eric Schulte 83dfaa5c8f named code blocks are replaced with their results
* 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.
2011-11-15 08:56:25 -07:00
Eric Schulte 630b9c80ca Indicate tests with missing dependencies by adding a expected failing test
* 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.
2011-11-15 08:56:25 -07:00
Martyn Jago 49d6951caa Fix don't load symlinks (Emacs interlocking files) * testing/org-test.el: During test development various interlocking files may be present in testing/lisp directory (since they are being edited by emacs). Currently org-test-load will attempt to load these 2011-11-15 08:56:25 -07:00
Martyn Jago 0cc18ed120 Avoid loading (and failing) symbolic links (interlocking files) * testing/org-test.el: During test development various interlocking files may be present in testing/lisp directory (since they are being edited by emacs). Currently org-test-load will attempt to load these and fail. 2011-11-15 08:56:25 -07:00
Eric Schulte f98ee77b38 tests protecting nested code blocks
* 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.
2011-11-15 08:56:25 -07:00
Eric Schulte 1ed12cac1a passing all tests after code block syntax changes
* 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.
2011-11-15 08:56:24 -07:00
Eric Schulte 3af89e696a property names ending in plus accumulate
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.
2011-11-15 08:56:24 -07:00
Eric Schulte 7e93b90f88 Standardized code block keywords
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.
2011-11-15 08:56:24 -07:00