Commit Graph

733 Commits

Author SHA1 Message Date
Achim Gratz e23bd6df8a testing/examples/babel.org: quote :shebang
* testing/examples/babel.org: Quote :shebang header argument.

2a73e06 introduced a new behaviour for org-babel-read and values
starting with "#" must now be quoted.
2013-06-08 22:06:57 +02:00
Rüdiger Sonderfeld cdfcc064d2 ob-C: Add list support.
* lisp/ob-C.el (org-babel-C-var-to-C): Add list support
(org-babel-C-val-to-C-list-type, org-babel-C-val-to-C-type,
org-babel-C-format-val): New functions.
(org-babel-C-ensure-main-wrap, org-babel-execute:C,
org-babel-execute:C++, rg-babel-execute:cpp, org-babel-C++-compiler,
org-babel-C-compiler): Improve docstring.
* testing/examples/ob-C-test.org (string_var): Add required std::
(Array): Add missing ID.
(Matrix): Add tests for list support.
* testing/lisp/test-ob-C.el (ob-C/table): Test succeeds.
(ob-C/list-var, ob-C/vector-var, ob-C/list-list-var): Add tests for
list support.

Signed-off-by: Rüdiger Sonderfeld <ruediger@c-plusplus.de>
2013-06-06 12:06:26 -06:00
Litvinov Sergey d7e884d86c Add a matrix input to ob-fortran.el
* lisp/ob-fortran.el: add a branch which handles nested lists
* testing/examples/ob-fortran-test.org: add a test for matrix input
* testing/lisp/test-ob-fortran.el: add a test for matrix input
2013-06-03 22:56:23 -06:00
Nicolas Goaziou d8b983b85a org-element: Fix failing "plain-list-parser" test
* lisp/org-element.el (org-element--list-struct): Fix failing
  "plain-list-parser" test.
* testing/lisp/test-org-element.el: Update test.
2013-06-01 21:38:15 +02:00
Achim Gratz e63a7ff70c org-test: prepare for more selective batch testing
* testing/org-test.el: Conditionalize interactive setup on
  bound-and-true `org-batch-test'.  (org-id-locations-file): New
  defvar.  (org-test-run-batch-tests): Use `org-id-locations-file'
  defined before and add optional argument `org-test-selector' to
  control which tests to run.

This change introduces ability to select the tests to run for batch
testing and removes several dependencies not needed during batch test
when `org-batch-test' is defined in preparation for a corresponding
change in how the build system invokes batch testing.  Full backward
compatibility is maintained.
2013-06-01 11:31:07 +02:00
Nicolas Goaziou d3eaa6abb6 Merge branch 'maint' 2013-05-25 14:37:01 +02:00
Nicolas Goaziou 87ab99f563 org-element/ox: Fix src-block indentation when it should be preserved
* lisp/org-element.el (org-element--remove-indentation): New function.
(org-element-example-block-parser, org-element-src-block-parser): Use
new function.
(org-element-src-block-interpreter): Update function according to
change.
* lisp/ox.el (org-export-unravel-code): Do not remove any indentation
  since it now happens at the parser level.
* testing/lisp/test-org-element.el: Add tests.
* testing/lisp/test-ox.el: Refactor tests.
2013-05-25 14:35:24 +02:00
Nicolas Goaziou 63531fb2cc Merge branch 'maint' 2013-05-18 18:26:56 +02:00
Nicolas Goaziou 62296ceb88 ox: Improve speed wrt table export
* lisp/ox.el (org-export-resolve-fuzzy-link): Change property name
  holding cache.
(org-export-table-has-header-p, org-export-table-row-group,
org-export-table-cell-width, org-export-table-cell-alignment): Cache
results.
(org-export-table-cell-address): Refactor.
(org-export-get-parent): Inline function.
* testing/lisp/test-ox.el: Update tests.
2013-05-18 18:20:46 +02:00
Nicolas Goaziou 15baadd8af Merge branch 'maint' 2013-05-15 21:20:29 +02:00
Nicolas Goaziou b70e77343a Fix options bug introduced in 16f12e
* lisp/ox.el (org-export-options-alist): Change default value
  for :title property.
(org-export--default-title): New dynamically scoped variable.
(org-export-store-default-title): New function.
(org-export--get-buffer-attributes): Remove title handling.
(org-export--get-global-options): Revert "ox: Fix default
title" (16f12e0aef).  Refactor code.
* testing/lisp/test-ox.el: Update a test.
2013-05-15 21:19:28 +02:00
Bastien Guerry 8b15ff9d07 Merge branch 'maint' 2013-05-15 16:31:54 +02:00
Bastien Guerry 838e421bf5 Fix tests wrt commit 0c31a4fc 2013-05-15 16:31:44 +02:00
Nicolas Goaziou 7dc2babf29 Merge branch 'maint' 2013-05-12 20:45:01 +02:00
Nicolas Goaziou 48e51fe5d9 ox: Ignore whitespace differences when resolving a radio link
* lisp/ox.el (org-export-resolve-radio-link): Ignore whitespace
  differences when resolving a radio link.
* testing/lisp/test-ox.el: Add test.
2013-05-12 20:42:30 +02:00
Nicolas Goaziou d542097aa3 Merge branch 'maint' 2013-05-12 17:56:14 +02:00
Nicolas Goaziou e7cd6f1875 ox: Fix radio target resolution
* lisp/ox.el (org-export-resolve-radio-link): Fix radio target
  resolution.
* testing/lisp/test-ox.el: Add test.
2013-05-12 17:54:56 +02:00
Nicolas Goaziou a09d968d30 Merge branch 'maint' 2013-05-12 17:16:41 +02:00
Nicolas Goaziou 7d37898371 org-element: Be stricter when matching arguments in LaTeX environments
* lisp/org-element.el (org-element--current-element): Be stricter when
  matching arguments in LaTeX environments.  In particular, do not
  allow anything else than options and arguments in the opening line.
* testing/lisp/test-org-element.el: Add tests.
2013-05-12 17:15:06 +02:00
Nicolas Goaziou 77368d13fa Merge branch 'maint' 2013-05-08 16:01:45 +02:00
Nicolas Goaziou 16f12e0aef ox: Fix default title
* lisp/ox.el (org-export--get-global-options): Properly set default
  title, i.e. when to TITLE keyword is provided.
* testing/lisp/test-ox.el: Add tests.
2013-05-08 16:00:18 +02:00
Nicolas Goaziou 5a14001b5e Merge branch 'maint' 2013-05-08 10:11:07 +02:00
Nicolas Goaziou be794a2a30 org-element: Fix visible-only parsing
* lisp/org-element.el (org-element--parse-elements): Also parse
  visible headlines within an otherwise compacted headline.
* testing/lisp/test-org-element.el: Add test.
2013-05-08 10:10:29 +02:00
Michael Brand 9998f2c897 Escape double quotes in URL passed to browse-url
Escape double quotes in URL passed to browse-url

* lisp/org.el (org-link-escape-chars-browser): Add char double quote.
* lisp/org.el (org-open-at-point): Make use of the constant
`org-link-escape-chars-browser'.
* testing/lisp/test-org.el
(test-org/org-link-unescape-ascii-extended-char): Fill paragraph.
(test-org/org-link-escape-url-with-escaped-char): Fill paragraph and
typo.
(test-org/org-link-escape-chars-browser): New test.

This is to make work to open the Org link
[[http://some.host.com/search?q="Org mode"]] in a browser.

From 28726bcc7b7c440d70e2d95ea5a61d0cd5f084ea Mon Sep 17 00:00:00 2001
From: Michael Brand <michael.ch.brand@gmail.com>
Date: Sun, 5 May 2013 17:02:18 +0200
Subject: [PATCH] Escape double quotes in URL passed to browse-url

* lisp/org.el (org-link-escape-chars-browser): Add char double quote.
* lisp/org.el (org-open-at-point): Make use of the constant
`org-link-escape-chars-browser'.
* testing/lisp/test-org.el
(test-org/org-link-unescape-ascii-extended-char): Fill paragraph.
(test-org/org-link-escape-url-with-escaped-char): Fill paragraph and
typo.
(test-org/org-link-escape-chars-browser): New test.

This is to make work to open the Org link
[[http://some.host.com/search?q="Org mode"]] in a browser.
2013-05-05 18:12:53 +02:00
Nicolas Goaziou 15a72f6256 Merge branch 'maint' 2013-05-04 09:05:49 +02:00
Nicolas Goaziou 3e1d83bf6b ox: Fix caching for fuzzy link resolution
* lisp/ox.el (org-export-resolve-fuzzy-link): Fix caching process.
* testing/lisp/test-ox.el: Add test.
2013-05-04 09:03:00 +02:00
Nicolas Goaziou dac3af93cf Merge branch 'maint' 2013-04-28 09:41:10 +02:00
Nicolas Goaziou 41bd891d48 org-element: Recognize LaTeX environments with options
* lisp/org-element.el (org-element--current-element): Allow the
  opening string of a LaTeX environment to contain additional
  arguments.
* testing/lisp/test-org-element.el: Add tests.
2013-04-28 09:38:01 +02:00
Eric Schulte 6161bb2c09 Testing support for explicit colnames
* testing/lisp/test-ob.el (test-ob/specific-colnames): This test now
  passes.
2013-04-27 08:59:19 -06:00
Sebastien Vauban bc8b8fbcf0 Test support of explicitly specified colnames
* test-ob.el (test-ob/specific-colnames): Add test checking that given column
names are well present in the output table.
2013-04-27 08:50:09 -06:00
Michael Brand 92f3729857 Allow also "#+NAME: table" for remote references
* lisp/org-table.el (org-table-get-remote-range): Extend regexp to
match "#+NAME: table" additionally to "#+TBLNAME: table".
* testing/lisp/test-org-table.el: Add test.
* testing/org-test.el (org-test-table-target-expect): Allow several
tables to support testing remote references in the last table.
2013-04-26 23:17:48 +02:00
Nicolas Goaziou 75c8be1d8b Fix error when filling a table from an affiliated keyword
* lisp/org.el (org-fill-paragraph): Move to table beginning before
  aligning the table when M-q is called from an affiliated keyword.
* testing/lisp/test-org.el: Add test.
2013-04-26 14:27:38 +02:00
Nicolas Goaziou 5efd7311e8 org-element: Fix interpretation of empty fixed-width elements
* lisp/org-element.el (org-element-fixed-width-interpreter): Fix
  interpretation of fixed-width elements with a nil or empty string
  value.
* testing/lisp/test-org-element.el: Add tests.
2013-04-26 10:38:05 +02:00
Nicolas Goaziou d408d721c3 ox: Fix `org-export-with-footnotes' behaviour
* lisp/ox.el (org-export--skip-p, org-export--interpret-p): When
  `org-export-with-footnotes' is nil, ignore completely footnotes
  references and definitions instead of exporting them verbatim.
* testing/lisp/test-ox.el: Add tests.
2013-04-21 23:44:18 +02:00
Nicolas Goaziou 60aa1682ce ox: Change scope for `org-export-with-timestamps'
* lisp/ox.el (org-export-with-timestamps): Only applies to isolated
  timestamps, i.e. timestamps in a paragraph containing only
  timestamps and empty strings.
(org-export--skip-p): Skip timestamps according to new behaviour.
* testing/lisp/test-ox.el: Update tests.
2013-04-18 16:58:56 +02:00
Michael Brand 45afcf137c Improve doc of empty fields
* doc/org.texi (Formula syntax for Calc): Improve the documentation of
empty fields in formulas for spreadsheet.
* testing/lisp/test-org-table.el: Rename wrongly named functions.
* testing/lisp/test-org-table.el: Use the more obvious "==" instead of
"=" for Calc conditions.
* testing/lisp/test-org-table.el (test-org-table/empty-field): Improve
the examples for vmean with empty fields.
2013-04-14 12:07:48 +02:00
Nicolas Goaziou 659edb40a5 ox: Allow to use empty strings in attributes
* lisp/ox.el (org-export-read-attribute): Allow to use empty strings
  in attributes.
* testing/lisp/test-ox.el: Add tests.

With this patch,

  #+attr_backend: :a "" becomes (:a "")
  #+attr_backend: :a """" becomes (:a "\"\"")
  ...
2013-04-10 18:50:52 +02:00
Michael Brand 5625a6ed79 org-table.el: Fix range len bugs for empty ranges
(org-table-make-reference): A range with only empty fields should lead
to length 0.
* testing/lisp/test-org-table.el: Adapt expected for several
ert-deftest.

The range len bugs may lead to wrong calculations for range references
with empty fields when the range len is relevant.  Affects typically
Calc vmean on simple range and without format specifier EN.  Also
Lisp with e. g. `length' on simple range or with L.

It is worth a small compatibility change: For a range with only empty
fields it is now possible and necessary to choose different behaviors
of vmean by adding the format specifiers E and/or N.

This is a follow-up of commit
764315b3fc.
2013-04-09 19:05:20 +02:00
Nicolas Goaziou 5f48315568 ox: Add function returning row number in a table
* lisp/ox.el (org-export-table-row-number): New function.
(org-export-table-cell-address): Use new function.
* testing/lisp/test-ox.el: Add test.
2013-04-09 16:52:41 +02:00
Achim Gratz 220b083091 test-ob-fortran: fix typo
* testing/lisp/test-ob-fortran.el (ob-fortran/preprocessor-var): Fix
  typo, write `preprocessor´ instead of `preprosessor´.
2013-04-07 11:49:37 +02:00
Achim Gratz 02137f0d6f test-ob-fortran: re-enable formerly failing test
* testing/lisp/test-ob-fortran.el (ob-fortran/character-var):
  Uncomment test that formerly failed.

This test seems to be working correctly on Linux and Cygwin.
Re-enable to see if it may not work on other systems and then check
why.
2013-04-07 11:47:48 +02:00
Achim Gratz 3aa78cf4bd test-ob-perl: improve test coverage
testing/lisp/test-ob-perl.el (test-ob-perl/table-passthrough-colnames-nil),
  (test-ob-perl/table-passthrough-colnames-no):
  Make some table entries numbers for better test coverage.
2013-04-07 11:28:57 +02:00
Ippei FURUHASHI 67a55acb39 org-table.el: Fix a bug of leaving the inserted TBLFM line
* org-table.el (org-calc-current-TBLFM): Ensure to remove the
currently inserted TBLFM line, when calling `org-table-recalculate'
returns an error and the processing stops.

* testing/lisp/test-org-table.el: Add test.

When you hit =C-c C-c= at the line of "#+TBLFM: $2=$1*2::$2=$1**2" in

    | 1 |   |
    | 2 |   |
    #+TBLFM: $2=$1*1
    #+TBLFM: $2=$1*2::$2=$1**2

you got:

    | 1 |   |
    | 2 |   |
    #+TBLFM: $2=$1*2::$2=$1**2
    #+TBLFM: $2=$1*1
    #+TBLFM: $2=$1*2::$2=$1**2

with the error message of:

    user-error: Double definition `$2=' in TBLFM line, please fix by hand

In this case, you expected:

    | 1 |   |
    | 2 |   |
    #+TBLFM: $2=$1*1
    #+TBLFM: $2=$1*2::$2=$1**2
2013-04-06 15:15:44 +02:00
Bastien Guerry c0589aa63a Merge branch 'master' of orgmode.org:org-mode 2013-04-05 08:38:07 +02:00
Ippei FURUHASHI 6693456dd7 org-table.el (org-calc-current-TBLFM): Add function
* org-table.el (org-calc-current-TBLFM): New function to
re-calculate the table by applying the #+TBLFM in the line
where the point is.

* org.el (org-ctrl-c-ctrl-c): Call `org-calc-current-TBLFM' when
point is in the #+TBLFM line.

* testing/lisp/test-org-table.el: Add test.
2013-04-05 08:37:51 +02:00
Ippei FURUHASHI c8c17460f1 org-table.el (org-TBLFM-begin): Add function
* org-table.el (org-TBLFM-begin): New defun.
(org-TBLFM-begin-regexp): New variable.

* testing/lisp/test-org-table.el: Add test.
2013-04-05 08:37:51 +02:00
Ippei FURUHASHI a268e33ef0 org.el (org-at-TBLFM-p): Add functon
* org.el (org-at-TBLFM-p): New defun.
(org-TBLFM-regexp): New defconst.

* testing/lisp/test-org-table.el: Add test.
2013-04-05 08:37:51 +02:00
Nicolas Goaziou 479c21336f Remove special behaviour for TARGET keyword
* lisp/org.el (org-store-link, org-link-search, org-options-keywords):
  Remove reference to TARGET keyword.
* lisp/ox.el (org-export-resolve-fuzzy-link, org-export-get-ordinal):
  Do not use TARGET as a destination for links anymore.
* testing/lisp/test-ox.el: Update tests.
* testing/lisp/test-org.el: Update tests.

Its specifications were not useful enough to keep maintaining this
feature.
2013-04-04 20:38:27 +02:00
Eric Schulte 86ce0790a1 change this failing test so that it no longer fails
I see no good way to get the code block name, not sure how we used to do
this, but it is definitely not supported by the current code.
2013-04-03 11:30:14 -06:00
Aaron Ecay 252238a60d Fix testing/lisp/test-ob-emacs-lisp.el
* testing/lisp/test-ob-emacs-lisp.el: Move stray test inside ert-deftest
2013-04-03 09:17:17 -06:00
Nicolas Goaziou 0bd6ccd6f9 ox: Add generic function to retrieve the date of a document
* lisp/ox.el (org-export-date-timestamp-format): New variable.
(org-export-get-date): New function.
* testing/lisp/test-ox.el: Add tests.
2013-04-02 23:55:28 +02:00
Nicolas Goaziou a82b06ae4b org-macro: Properly handle macros in setup files
* lisp/org-macro.el (org-macro--collect-macros): Fix a bug where
  reading a macro in a setup file would remove other macros read so
  far from template.  Change function signature.
(org-macro-initialize-templates): Apply signature change from function
above.
* testing/lisp/test-org-macro.el: Add test.
2013-04-01 15:47:39 +02:00
Nicolas Goaziou 55db57dc0a ox: Properly transfer bound variables through export process
* lisp/ox.el (org-export--list-bound-variables): Renamed from
  `org-export--install-letbind-maybe'.  Though, only return list of
  bound variables instead of installing them as buffer-local
  variables.
(org-export-get-environment): Use new function.  Take care of the
installation of bound variables.
(org-export--generate-copy-script): Make sure non-Org variables are
also installed in buffer copy.
* testing/lisp/test-ox.el: Add test.
2013-04-01 15:20:52 +02:00
Nicolas Goaziou 7736c2d7fb ox: Handle BIND keywords in SETUPFILE files
* lisp/ox.el (org-export-get-environment): Update comment.
(org-export--install-letbind-maybe): Go into SETUPFILE files and
handle BIND keywords there.
* testing/examples/setupfile.org: Update test file.
* testing/lisp/test-ox.el: Add tests.
2013-03-29 21:51:57 +01:00
Nicolas Goaziou a6d9fd82ea ox: White spaces after export snippets are never ignored
* lisp/ox.el (org-export-data): White spaces after export snippets are
  never ignored.
* testing/lisp/test-ox.el: Add test.

Back-end developers should pay attention to the fact that white spaces
before and after an ignored export snippet now are accumulated in the
output.
2013-03-25 20:29:31 +01:00
Bastien Guerry 78959943e2 Merge branch 'master-group-tags2' 2013-03-25 06:59:23 +01:00
Nicolas Goaziou 42e1a6351d org-element: Allow to escape escaping character before a comma
* lisp/org-element.el (org-element-macro-parser): Allow to escape
  escaping character before a comma.  Also do not trim spaces at
  argument boundaries.
* doc/org.texi (Macro replacement): Update documentation about
  possible locations and escaping mechanism.
* testing/lisp/test-org-element.el: Add tests.

With this patch, macro's arguments are read as the following:

  "a,b"     -> '("a" "b")
  "a\,b"    -> '("a,b")
  "a\\,b"   -> '("a\" "b")
  "a\\\,b"  -> '("a\,b")
  "a\\\\,b" -> '(a"\\" "b")

Note that with the patch, you only need to escape backslashes before
a comma:

  "a\\b\,c" -> '("a\\b,c")
2013-03-23 20:42:34 +01:00
Bastien Guerry 2922c1365d testing/lisp/: Use non-obsolete variable names (see previous commit)
* test-org-list.el (test-org-list/cycle-bullet)
(test-org-list/move-item-down, test-org-list/move-item-up)
(test-org-list/insert-item): Use non-obsolete variable names.

* test-org-element.el (test-org-element/at-point): Use
`org-list-empty-line-terminates-plain-lists'.
2013-03-23 17:45:26 +01:00
Bastien Guerry ae85aa0d32 test-ox.el (test-org-export/define-derived-backend, test-org-export/derived-backend-p): Uncomment
* test-ox.el (test-org-export/define-derived-backend)
(test-org-export/derived-backend-p): Uncomment.
2013-03-19 19:39:35 +01:00
Achim Gratz 63c5bc4425 fix test fail introduced by change of default in e8742b78e0
* testing/lisp/test-org-list.el (test-org-list/to-html): Bind
  `org-html-indent´ to nil for testing.
2013-03-18 08:07:26 +01:00
Samuel Loury 0c82deb421 Test the org-open-at-point function.
* testing/examples/open-at-point.org: new file.
* testing/lisp/test-org-open-at-point.el: new file.

This tests only the function when inside or before bracket links
and plain links.
2013-03-16 20:27:00 +01:00
Nicolas Goaziou c66641e1ea Add test related to a5a676e609
* testing/lisp/test-org-element.el: Add test.
2013-03-14 23:11:26 +01:00
Bastien Guerry c5490f0ef0 testing/lisp/text-ox.el: Comment two tests out
These tests fail when run in batch mode:

`test-org-export/define-derived-backend'
`test-org-export/derived-backend-p'

They don't fail when run interactively.
Let's comment them out until we understand
what's wrong with these tests.
2013-03-13 12:55:29 +01:00
Bastien Guerry 9f17654913 testing/: Merge org-test-ob-consts.el into org-test.el 2013-03-13 11:23:56 +01:00
Nicolas Goaziou 59cb22d638 ox: Simplify syntax for attributes
* lisp/ox.el (org-export-read-attribute): Do not use `read' to read
  attributes.  Instead, extract keywords and values from it, which
  means each value will be a string when non-nil.
* contrib/lisp/ox-groff.el (org-groff-link--inline-image): Use new
  attribute syntax.  Small refactoring.
* lisp/ox-ascii.el (org-ascii-horizontal-rule): Use new attribute
  syntax.
* lisp/ox-beamer.el (org-beamer-plain-list): Use new attribute syntax.
* lisp/ox-html.el (org-html--textarea-block): Use new attribute
  syntax.
* lisp/ox-latex.el (org-latex--inline-image, org-latex--org-table,
  org-latex--math-table): Use new attribute syntax.
* lisp/ox-man.el (org-man-table--org-table): Use new attribute syntax.
  Small refactoring.
* lisp/ox-odt.el (org-odt-link--inline-image, org-odt-table-cell): Use
  new attribute syntax.
* testing/lisp/test-ox.el: Add tests.

This patch introduces two changes.  To begin with, it removes the need
for quoting and escaping characters.  Also, all non-nil values are
stored as strings.  As an exception "nil" is stored as nil.
2013-03-11 08:33:10 +01:00
Achim Gratz 37d47a33d9 fix test failure introduced by moving library-of-babel.org in 321f806faf
* testing/lisp/test-ob-lob.el: The file library-of-babel.org has been
  moved from contrib/babel to doc, change the code to track that move.
2013-03-06 21:27:13 +01:00
Nicolas Goaziou 40fc9e869f org-list: Use export back-ends to transform radio lists
* lisp/org-list.el (org-list-send-list): Do not rely on
  `org-list-parse-list'.
(org-list-to-latex, org-list-to-html, org-list-to-texinfo): Use
appropriate export back-end instead of using `org-list-to-generic'.
* testing/lisp/test-org-list.el: Add tests.
2013-03-04 12:33:04 +01:00
Nicolas Goaziou 8f40d7f7a1 ox: Fix export of empty src blocks
* lisp/ox.el (org-export-format-code-default): Handle empty source
  blocks more gracefully.
* lisp/ox-ascii.el (org-ascii-src-block): Handle empty blocks more
  gracefully.
* testing/lisp/test-ox.el: Add tests.
2013-03-03 19:13:43 +01:00
Achim Gratz 2d3addeccf test-ob-perl: add a few perl babel tests
* testing/lisp/test-ob-perl.el: New file with a few tests of the perl
  babel integration.
2013-03-02 22:49:46 +01:00
Achim Gratz 6bc6a361b0 Ensure that new exporter gets tested in batch mode
* testing/org-test.el: Require ox so that these tests will be run
  during batch test.
2013-03-02 18:28:18 +01:00
Nicolas Goaziou 5a0239b9fc ox: Ignore inlinetasks with a :noexport: tag
* lisp/ox.el (org-export--selected-trees): Also mark inlinetasks with
  a select tag.
(org-export--skip-p): Skip inlinetasks with a :noexport: tag.
* testing/lisp/test-ox.el: Add tests.
2013-03-02 15:03:28 +01:00
Nicolas Goaziou 86563e0119 org-element: OPTIONAL_TITLE becomes ALT_TITLE property
* lisp/org-element.el (org-element-headline-parser):
  Rename :optional-title into :alt-title.
* lisp/ox.el (org-export-get-alt-title): Renamed from
  `org-export-get-optional-title'.
* lisp/ox-ascii.el (org-ascii--build-title): Apply name change.
* lisp/ox-html.el (org-html--format-toc-headline): Apply name change.
* lisp/ox-latex.el (org-latex-headline): Apply name change.
* lisp/ox-texinfo.el (org-texinfo--get-node,
  org-texinfo--generate-menu-items): Apply name change.
* testing/lisp/test-ox.el: Update tests.
* doc/org.texi (Table of contents): Update documentation.
2013-02-27 00:03:59 +01:00
Nicolas Goaziou 677433d9b4 ox: Fix bug where properties read from setupfile overwrite previous properties
* lisp/ox.el (org-export--get-inbuffer-options): Remove an optional
  argument.  Rewrite function.  Properties read from a setupfile do
  not overwrite anymore previously computed properties.
(org-export-get-environment): Apply changes to previous function.
* lisp/org.el (org-create-formula--latex-header): Apply arity change
  from `org-export--get-inbuffer-options'.
* testing/lisp/test-ox.el: Add test.
* testing/examples/setupfile.org: New file.
2013-02-26 23:35:36 +01:00
Nicolas Goaziou 367e680582 ox: Change order of retured elements in `org-export-get-previous-element'
* lisp/ox.el (org-export-get-previous-element): Change order of
  retured elements in `org-export-get-previous-element'.
* testing/lisp/test-ox.el: Update test.
2013-02-25 23:17:42 +01:00
Nicolas Goaziou 7cd6fdcd34 org-element: Only allow plain links in links
* lisp/org-element.el (org-element-all-successors): Add `plain-link'
  successor.
(org-element-object-restrictions): Remove `link' within `link'.  Allow
`plain-link' instead.
(org-element-plain-link-successor): New function.
* testing/lisp/test-org-element.el: Add test.

Plain links within links are needed for the following kind of syntax:

  [[http://orgmode.org][file:unicorn.png]]

No other link type is allowed within links.
2013-02-25 22:16:01 +01:00
Nicolas Goaziou 11033a97dc sub/superscript character has to follow a non-blank character
* lisp/org.el (org-match-substring-regexp,
  org-match-substring-with-braces-regexp): Update regexp.
  A sub/superscript cannot start anymore at the beginning of the line
  or after a space.
2013-02-25 21:53:14 +01:00
Nicolas Goaziou 8838585a42 Do not move point when filling a table
* lisp/org.el (org-fill-paragraph): Do not move point when filling
  a table.
* testing/lisp/test-org.el: Add test.
2013-02-25 10:06:58 +01:00
Nicolas Goaziou ca060f7be7 Require 2 blank lines to separate footnote definition
* lisp/org-element.el (org-element-footnote-definition-parser):
  Require 2 blank lines to separate footnote definition.
* lisp/org-footnote.el (org-footnote-at-definition-p): Require 2 blank
  lines to separate footnote definition.
* doc/org.texi: Update documentation for footnotes.
* testing/lisp/test-org-element.el: Update tests.
* testing/lisp/test-org-footnote.el: Add tests.

Footnote definitions can still be separated with other footnote
definitions and headlines. This change allows to have multiple
paragraphs in a footnote definition without resorting to the "\par"
trick.
2013-02-24 14:44:07 +01:00
Nicolas Goaziou a15a657bfb ox: Better return value for `org-export-get-optional-title'
* lisp/ox.el (org-export-get-optional-title): Return regular title
  when no optional title is found.
* lisp/ox-ascii.el (org-ascii--build-title): Apply change to
  `org-export-get-optional-title'.
* lisp/ox-html.el (org-html--format-toc-headline): Apply change to
  `org-export-get-optional-title'.
* lisp/ox-latex.el (org-latex-headline): Apply change to
  `org-export-get-optional-title'.
* testing/lisp/test-ox.el: Add tests.
2013-02-24 09:20:35 +01:00
Nicolas Goaziou e0e740b289 ox: Add test for :minlevel parameter in INCLUDE keywords
* testing/lisp/test-ox.el (test-org-export/expand-include): Add test.
2013-02-18 20:49:43 +01:00
Nicolas Goaziou a385c6e0e4 org-element: Fix docstring, add tests
* lisp/org-element.el (org-element-headline-parser,
  org-element-inlinetask-parser): Fix docstring.
* testing/lisp/test-org-element.el: Add tests.

This follows ae5932282d.
2013-02-18 08:58:59 +01:00
Nicolas Goaziou 324a2cb3f9 export-back-ends: Apply changes from b692064e621acbc93876670585f8a4b0fd6a7ffa
* lisp/ox-beamer.el (org-beamer--get-label, org-beamer--frame-level,
  org-beamer--format-section, org-beamer--format-frame,
  org-beamer--format-block, org-beamer-headline): Apply changes to
  properties.
* lisp/ox-html.el (org-html-headline, org-html-link,
  org-html-section): Apply changes to properties.
* lisp/ox-icalendar.el (org-icalendar-create-uid,
  org-icalendar-blocked-headline-p, org-icalendar-entry,
  org-icalendar--valarm): Apply changes to properties.
* lisp/ox-odt.el (org-odt-headline): Apply changes
* lisp/ox-publish.el (org-publish-collect-index): Apply changes to
  properties.
* lisp/ox-texinfo.el (org-texinfo--generate-menu-list,
  org-texinfo--generate-menu-items, org-texinfo-template,
  org-texinfo-headline, org-texinfo-link): Apply changes to
  properties.
* lisp/ox.el (org-export-resolve-id-link, org-export-get-category):
  Apply changes to properties.
  (org-export-get-node-property): Update docstring.
* testing/lisp/test-ox.el: Update tests.
2013-02-18 00:12:57 +01:00
Nicolas Goaziou 48da6a46e0 Move macro expansion code into its own library
* lisp/org-macro.el: New file.
* lisp/org.el: Remove macro code.
* lisp/ox.el: Require new library
* testing/lisp/test-org-macro.el: New file.
* testing/lisp/test-org.el: Remove macro test.
2013-02-16 15:55:30 +01:00
Nicolas Goaziou f33d90fb28 ox: Fuzzy link matching ignores statistics cookies
* lisp/ox.el (org-export-resolve-fuzzy-link): Ignore statistics
  cookies when matching an headline.
* testing/lisp/test-ox.el: Add test.
2013-02-16 15:05:45 +01:00
Nicolas Goaziou 2df6ded853 ox: Fix radio link resolution
* lisp/ox.el (org-export-resolve-radio-link): Radio targets are
  case-insensitive.
* testing/lisp/test-ox.el: Add test.
2013-02-15 23:03:29 +01:00
Nicolas Goaziou 78a652716e ox: Whitespaces are not significant when matching a fuzzy link
* lisp/ox.el (org-export-resolve-fuzzy-link): Whitespaces are not
  significant when matching a fuzzy link.
* lisp/org-element.el (org-element-link-parser): Do not remove
  newlines characters in paths anymore, since this is not required.
* testing/lisp/test-org-element.el: Update tests.
* testing/lisp/test-ox.el: Add test.
2013-02-15 18:08:03 +01:00
Nicolas Goaziou a8e48bd3a8 Prevent export to file from overwriting current file
* lisp/ox.el (org-export-output-file-name): Add a protection when
  output file name is the same as the original org.
* testing/lisp/test-ox.el: Add tests.
2013-02-15 15:06:01 +01:00
Nicolas Goaziou 39ed70495c ox: Correctly handle footnote section
* lisp/ox.el (org-export--collect-headline-numbering): Remove footnote
  section from TOC.
(org-export-collect-headlines): Do not count footnote section when
numbering a headline.
* testing/lisp/test-ox.el: Add tests.
2013-02-13 16:00:27 +01:00
Nicolas Goaziou 9f8f32c360 org-element: Fix parsing of links with filled path
* lisp/org-element.el (org-element-link-parser): Remove all newline
  characters in path property.
* testing/lisp/test-org-element.el: Add test.
2013-02-13 08:41:43 +01:00
Nicolas Goaziou 1f8c8dc6d6 ox: Implement `inner-template' transcoder
* lisp/ox.el (org-export-as): Call `inner-template' function, if
  available.
* lisp/ox-html.el (org-html-inner-template): New function.
(org-html-template): Move all parts that should be inserted even in
a body-only export into `org-html-inner-template'.
* testing/lisp/test-ox.el: Add tests.
2013-02-11 22:26:52 +01:00
Nicolas Goaziou 94bcc7e282 org-element: Fix parsing of orphaned keyword at the end of an element
* lisp/org-element.el (org-element--current-element): Add a limit
  argument.
(org-element--collect-affiliated-keywords): Fix parsing of orphaned
keyword at the end of an element.
* testing/lisp/test-org-element.el: Add test.
2013-02-11 21:12:43 +01:00
Bastien Guerry 4b0ceee39a test-org.el (test-org/forward-element, test-org/backward-element): Use `regexp-quote'
* test-org.el (test-org/forward-element)
(test-org/backward-element): Use `regexp-quote'.
2013-02-11 17:09:53 +01:00
Nicolas Goaziou 1cac3127c2 Fix tests related to export
* lisp/ob-exp.el (org-babel-exp-process-buffer): Renamed from
  `org-export-blocks-preprocess'.
* lisp/ox.el (org-export-execute-babel-code): Apply previous renaming.
* testing/org-test.el (org-test-at-id): Make sure the function returns
  the value of the last form in its body.
* testing/lisp/test-ob-exp.el: Fix tests.
* testing/lisp/test-ob-lob.el: Fix tests.
2013-02-06 23:06:31 +01:00
Nicolas Goaziou 03a9191dd3 Move previous export framework into contrib
* contrib/lisp/org-ascii.el: New file.
* contrib/lisp/org-beamer.el: New file.
* contrib/lisp/org-docbook.el: New file.
* contrib/lisp/org-exp-blocks.el: New file.
* contrib/lisp/org-exp.el: New file.
* contrib/lisp/org-freemind.el: New file.
* contrib/lisp/org-html.el: New file.
* contrib/lisp/org-icalendar.el: New file.
* contrib/lisp/org-jsinfo.el: New file.
* contrib/lisp/org-latex.el: New file.
* contrib/lisp/org-lparse.el: New file.
* contrib/lisp/org-odt.el: New file.
* contrib/lisp/org-publish.el: New file.
* contrib/lisp/org-special-blocks.el: New file.
* contrib/lisp/org-taskjuggler.el: New file.
* contrib/lisp/org-xoxo.el: New file.
* lisp/org-ascii.el: Removed file.
* lisp/org-beamer.el: Removed file.
* lisp/org-docbook.el: Removed file.
* lisp/org-exp-blocks.el: Removed file.
* lisp/org-exp.el: Removed file.
* lisp/org-freemind.el: Removed file.
* lisp/org-html.el: Removed file.
* lisp/org-icalendar.el: Removed file.
* lisp/org-jsinfo.el: Removed file.
* lisp/org-latex.el: Removed file.
* lisp/org-lparse.el: Removed file.
* lisp/org-odt.el: Removed file.
* lisp/org-publish.el: Removed file.
* lisp/org-special-blocks.el: Removed file.
* lisp/org-taskjuggler.el: Removed file.
* lisp/org-xoxo.el: Removed file.
* testing/lisp/test-org-exp.el: Removed file.
* testing/lisp/test-org-html.el: Removed file.
2013-02-06 23:06:30 +01:00
Nicolas Goaziou 8dd2bfc291 Move new export framework files into core
* contrib/README: Remove references to new export framework.
* contrib/lisp/org-e-ascii.el: Removed file.
* contrib/lisp/org-e-beamer.el: Removed file.
* contrib/lisp/org-e-confluence.el: Removed file.
* contrib/lisp/org-e-groff.el: Removed file.
* contrib/lisp/org-e-html.el: Removed file.
* contrib/lisp/org-e-icalendar.el: Removed file.
* contrib/lisp/org-e-latex.el: Removed file.
* contrib/lisp/org-e-man.el: Removed file.
* contrib/lisp/org-e-odt.el: Removed file.
* contrib/lisp/org-e-publish.el: Removed file.
* contrib/lisp/org-e-texinfo.el: Removed file.
* contrib/lisp/org-export.el: Removed file.
* contrib/lisp/org-koma-letter.el: Removed file.
* contrib/lisp/org-md.el: Removed file.
* contrib/lisp/ox-confluence.el: New file.
* contrib/lisp/ox-groff.el: New file.
* contrib/lisp/ox-koma-letter.el: New file.
* lisp/ox-ascii.el: New file.
* lisp/ox-beamer.el: New file.
* lisp/ox-html.el: New file.
* lisp/ox-icalendar.el: New file.
* lisp/ox-jsinfo.el: New file.
* lisp/ox-latex.el: New file.
* lisp/ox-man.el: New file.
* lisp/ox-md.el: New file.
* lisp/ox-odt.el: New file.
* lisp/ox-publish.el: New file.
* lisp/ox-texinfo.el: New file.
* lisp/ox.el: New file.
* mk/org-fixup.el (org-make-org-loaddefs): Install new export
  framework and back-end files.
* testing/lisp/test-org-export.el: Removed file.
* testing/lisp/test-ox.el: New file.
2013-02-06 23:06:30 +01:00
Nicolas Goaziou 787a07421c Merge branch 'maint' 2013-01-31 22:16:23 +01:00
Nicolas Goaziou 592dc2ee7e org-element: Fix macro parsing with protected commas
* lisp/org-element.el (org-element-macro-parser): Fix error when last
  argument ends with a protected comma.
* testing/lisp/test-org-element.el (test-org-element/macro-parser):
  Add tests.
2013-01-31 22:15:39 +01:00
Nicolas Goaziou ed516e65dc org-export: Fix failing test
* testing/lisp/test-org-export.el: Fix failing test.
2013-01-30 21:32:50 +01:00
Yasushi SHOJI 8e8f40ce2f testing/README: Fix instructions
TINYCHANGE
2013-01-30 17:35:09 +01:00
Nicolas Goaziou 423756dd11 org-export: Generalize fallback footnote definition to all exporters
* contrib/lisp/org-export.el (org-export-get-footnote-definition):
  Provide a fallback definition when none can be found.
* contrib/lisp/org-e-latex.el (org-e-latex-footnote-reference): Revert
  change made in 30ef385ee0 since it is
  now handled at the export framework level.
* testing/lisp/test-org-export.el: Add test.
2013-01-30 14:22:35 +01:00
Nicolas Goaziou bb40d29b45 org-export: Fix subtree export when parent section is empty
* contrib/lisp/org-export.el (org-export--get-subtree-options): When
  point is at an headline and subtree export is called, make sure
  export properties are extracted from parent headline.
* testing/lisp/test-org-export.el: Add test.
2013-01-26 18:05:56 +01:00
Nicolas Goaziou 0cf7179430 Revert "org-element: Change return value for element at point in some corner cases"
This reverts commit 13e49a6385.

Conflicts:
	lisp/org-element.el
2013-01-21 21:51:39 +01:00
Nicolas Goaziou 13e49a6385 org-element: Change return value for element at point in some corner cases
* lisp/org-element.el (org-element-at-point): When point is before any
  element, in the first blank lines of the buffer, return nil.  When
  point is within blank lines just after a headline, return that
  headline.
(org-element-context): Return nil when point is within the blank at
the beginning of the buffer.
* testing/lisp/test-org-element.el: Add tests.
2013-01-19 23:34:59 +01:00
Nicolas Goaziou 9d26797448 Move functions operating on timestamp objects into org.el
* contrib/lisp/org-export.el (org-export-timestamp-has-time-p,
  org-export-format-timestamp, org-export-split-timestamp-range,
  org-export-translate-timestamp): Removed functions.
* lisp/org.el (org-timestamp-has-time-p, org-timestamp-format,
  org-timestamp-split-range, org-timestamp-translate): New functions.
* contrib/lisp/org-e-ascii.el (org-e-ascii-timestamp): Apply move.
* contrib/lisp/org-e-groff.el (org-e-groff-timestamp): Apply move.
* contrib/lisp/org-e-html.el (org-e-html-timestamp): Apply move.
* contrib/lisp/org-e-latex.el (org-e-latex-timestamp): Apply move.
* contrib/lisp/org-e-odt.el (org-e-odt--format-timestamp,
  org-e-odt-timestamp): Apply move.
* contrib/lisp/org-e-texinfo.el (org-e-texinfo-timestamp): Apply move.
* testing/lisp/test-org-export.el: Remove tests.
* testing/lisp/test-org.el: Add tests.
2013-01-13 10:01:05 +01:00
Nicolas Goaziou b68103a344 org-element: Correctly interpret timestamps ranges with repeaters
* lisp/org-element.el (org-element-timestamp-interpreter): Interpret
  timestamps ranges with repeaters.
* testing/lisp/test-org-element.el: Add test.
2013-01-10 14:02:19 +01:00
Nicolas Goaziou 2fd88bfd56 org-element: Small optimization to `org-element-context'
* lisp/org-element.el (org-element-context): Add an optional argument
  so (org-element-context)
  and (org-element-context (org-element-at-point)) are equivalent.
* testing/lisp/test-org-element.el: Add test.
2013-01-09 15:33:29 +01:00
Bastien Guerry b54d6f5965 Merge branch 'maint'
Conflicts:
	lisp/org-agenda.el
	lisp/org.el
	testing/lisp/test-org-element.el
2013-01-07 16:19:37 +01:00
Bastien Guerry b27a020a83 `org-float' is now obsolete
* org-agenda.el (org-float): Don't alias `org-float'.

* org.texi (Timestamps, Deadlines and scheduling): Use
`diary-float' instead of the now obsolete alias `org-float'.

* test-org-element.el
(test-org-element/timestamp-interpreter): Ditto.
2013-01-07 13:01:36 +01:00
Bastien Guerry 60b23bdeac Merge branch 'maint'
Conflicts:
	contrib/lisp/htmlize.el
	etc/schema/od-manifest-schema-v1.2-os.rnc
	etc/schema/od-schema-v1.2-os.rnc
	lisp/org-exp-blocks.el
2013-01-01 16:06:17 +01:00
Bastien Guerry 98cd4687a2 Update copyright years.
Happy new year!
2013-01-01 16:04:24 +01:00
Bastien Guerry e1c491e72d org.el (org-parse-time-string): Parse <+1w> and friends
* org.el (org-parse-time-string): Allow strings supported by
tags/properties matcher (eg <now>, <yesterday>, <-7d>).

* test-org.el (test-org/org-parse-time-string): New test.

This is based on Ilya's commit 001bcb9.  This commit was
wrong because active timestamps were not parsed correctly
anymore.  This commit handles them correctly.

Thanks to Ivan Vilata i Balaguer for pushing this forward.
2012-12-30 10:27:02 +01:00
Michael Brand a77442b37b Use nan for empty fields in Calc formulas
* doc/org.texi (Formula syntax for Calc): Add explanation and example
for empty field.
* lisp/org-table.el (org-table-eval-formula): Use `keep-empty' in more
places.
(org-table-make-reference): Use nan (not a number) for empty fields in
Calc formulas.
* testing/lisp/test-org-table.el: Adapt expected for several
ert-deftest.
(test-org-table/empty-field): New examples dealing with empty fields.
(test-org-table/copy-field): New ert-deftest with examples dealing with
empty fields.

This makes it possible to write spreadsheet Calc formulas that check
for empty fields:  To sum the first two columns unless one or both
empty:
$3 = if("$1" = "nan" || "$2" = "nan", string(""), $1 + $2); E
2012-12-29 14:33:52 +01:00
Michael Brand 764315b3fc org-table.el: Fix range len bugs and inconsistencies
* lisp/org-table.el (org-table-eval-formula): Keep empty fields during
preprocessing.
(org-table-make-reference): A range with only empty fields should not
always return 0 but also empty string, consistent with field reference
of an empty field.  Use future design for nan but replicate current
behavior.
* testing/lisp/test-org-table.el: Adapt expected for several
ert-deftest.

The range len bugs may lead to wrong calculations for range references
with empty fields when the range len is relevant.  Affects typically
Calc vmean on simple range and without format specifier EN.  Also
Lisp with e. g. `length' on simple range or with L.
2012-12-29 14:33:52 +01:00
Michael Brand f5dd9a8a7a Add ERTs for basic spreadsheet functionality
* doc/org.texi (Formula syntax for Calc): Extend explanations of
format specifiers.
* testing/lisp/test-org-table.el: Various new ert-deftest, mark with
TODO what needs to be fixed.
2012-12-29 14:33:52 +01:00
Michael Brand 0ce406151f Extend org-table-number-regexp
* lisp/org-table.el (org-table-number-regexp): Extend 0x hex to
fixed-point number, add <radix>#<number>, add Calc infinite numbers
uinf, -inf and inf.
* testing/lisp/test-org-table.el (test-org-table/align): Adapt
alignment.
2012-12-29 14:33:52 +01:00
Michael Brand ce1a8465b5 Add ERT for table alignment within Org buffer
* testing/lisp/test-org-table.el (test-org-table/align): New
ert-deftest for table alignment within Org buffer.
* testing/org-test.el (org-test-table-target-expect): New defun.

The new function org-test-table-target-expect is to simplify writing
spreadsheet ERT by providing just a target table to apply the formula
to, the expected result table and the table formula with optionally
additional variants.  The variants typically are to check the same
result with a Lisp formula and a Calc formula.  test-org-table.el is
also a howto example collection as a user documentation.
2012-12-29 14:33:52 +01:00
Michael Brand 710f445768 testing/README: add howto run ERT partially
* testing/README (Interactive testing from within Emacs): Add a
description how to run a single ERT or all tests of a single test
file.
2012-12-29 14:33:52 +01:00
Bastien Guerry 3b9c1a0008 test-org-src.el (test-org-src/blank-line-block): Fix test
* test-org-src.el (test-org-src/blank-line-block): Fix test.
2012-12-21 09:36:20 +01:00
Bastien Guerry 72c2dc07a8 test-ob-exp.el (ob-exp/exports-inline): Fix test
* test-ob-exp.el (ob-exp/exports-inline): Fix test.
2012-12-21 08:55:14 +01:00
Bastien Guerry 24dea073bc Merge branch 'maint'
Conflicts:
	testing/lisp/test-ob-exp.el
2012-12-20 18:56:27 +01:00
Bastien Guerry 2824e1fd1d Update the tests wrt previous commit.
* test-org-exp.el (test-org-exp/stripping-commas): Update the
list of args for org-export-as-* functions.

* test-ob-lob.el (test-ob-lob/export-lob-lines): Ditto.

* test-ob-exp.el (ob-exp/noweb-on-export)
(ob-exp/noweb-on-export-with-exports-results)
(ob-exp/exports-both, ob-exp/mixed-blocks-with-exports-both)
(ob-exp/export-with-name)
(ob-exp/export-with-header-argument)
(ob-exp/evaluate-all-executables-in-order)
(ob-exp/noweb-strip-export-ensure-strips)
(ob-exp/export-from-a-temp-buffer): Ditto.
2012-12-20 18:54:57 +01:00
Bastien Guerry fcd269baa8 test-ob-exp.el (ob-exp/mixed-blocks-with-exports-both): Fix test
* test-ob-exp.el (ob-exp/mixed-blocks-with-exports-both): Fix test.

Thanks to Nick Dokos for reporting this.
2012-12-20 01:33:04 +01:00
Nicolas Goaziou 27f06c104e org-export: Implement function to locally override translation table
* contrib/lisp/org-export.el (org-export-data-with-translations,
  org-export-data-with-backend): New functions.
* testing/lisp/test-org-export.el: Add tests.
2012-12-19 17:48:51 +01:00
Nicolas Goaziou f1bb17549b org-element: Add tests
* testing/lisp/test-org-element.el: Add tests.
2012-12-18 22:16:01 +01:00
Nicolas Goaziou 442b2ad15d Merge branch 'maint'
Conflicts:
	lisp/org-element.el
2012-12-16 00:49:22 +01:00
Nicolas Goaziou 20839ced71 org-element: Fix parsing of a list in a block in a list
* lisp/org-element.el (org-element--parse-elements,
  org-element-at-point): Fix parsing of a list in a block in a list.
* testing/lisp/test-org-element.el: Add test.
2012-12-16 00:45:17 +01:00
Bastien Guerry fa0e8feea8 org-test.el (org-test-with-temp-text-in-file): Wrap ,@body into (progn ...).
* org-test.el (org-test-with-temp-text-in-file): Wrap ,@body
into (progn ...) so that tests don't have to wrap it themselves.

Fix the testing suite to use this.
Also fix formatting and trailing whitespaces.
Fix test-org-src/blank-line-block so that it
checks editing of a code block with a whitespace
with point on the #+begin_src line.

Thanks to Michael Brand for spotting the (progn ...) problem.
2012-12-15 08:49:23 +01:00
Bastien Guerry c8452bfca0 Merge branch 'maint' 2012-12-15 08:05:02 +01:00
Bastien Guerry c0675b478e test-org-src.el: Fix a test.
* lisp/test-org-src.el (test-org-src/blank-line-block): Use
`org-test-with-temp-text-in-file' because `org-in-src-block-p'
checks against an Org mode text property.  Don't check for the
word at point.

Thanks to Nick Dokos for reporting this failed test.
2012-12-15 08:04:43 +01:00
Bastien Guerry 8f3b8ee44c testing/org-test.el: Fix `org-test-with-temp-text'.
* org-test.el (org-test-with-temp-text): No need to kill a
temporary buffer.  Don't use (prog1 ,@body ...), only expand
,@body.

Thanks to Nick Dokos for pointing this.
2012-12-15 08:00:30 +01:00
Bastien Guerry ac1b11753f Merge branch 'maint' 2012-12-13 17:24:31 +01:00
Bastien Guerry 70b0f422b4 Fix copyright notices for test files. 2012-12-13 17:24:19 +01:00
Le Wang a0cb4a3edc add tests for org-src-edit 2012-12-13 17:18:50 +01:00
Nicolas Goaziou b1f36921d7 org-export: Allow to retrieve all previous/next exportable objects
* contrib/lisp/org-export.el (org-export-get-previous-element,
  org-export-get-next-element): Allow to retrieve all previous/next
  exportable objects by specifying a non-nil, non positive integer
  argument.
* testing/lisp/test-org-export.el: Add tests.
2012-12-10 08:54:52 +01:00
Nicolas Goaziou cbb96d69d3 org-export: Add an optional argument to previous an next elements getters
* contrib/lisp/org-export.el (org-export-get-previous-element,
  org-export-get-next-element): Change signature.
* testing/lisp/test-org-export.el: Add tests.
2012-12-08 18:57:10 +01:00
Achim Gratz 29117be8b2 Fix new test for clocktables
* testing/lisp/test-org-clock.el (test-org-clock/clocktable): The last test
  for clocktables introduced in commit 6642177 did not work if the test was
  run before 15:00 due to the end time being specified as "<now>" (which
  includes the current time of day and not just the date).  The obvious
  "<today>" does also not work since it means 0:00 of the current day.  The
  correct specification to use is "<tomorrow>", which is 0:00 the following
  day or equivalently the end of today, 24:00.
2012-12-07 19:50:01 +01:00
Nicolas Goaziou 31052f1c91 Fix radio targets detection
* lisp/org.el (org-all-targets): Fix radio targets detection when
  object is directly followed by a non-whitespace character.

* testing/lisp/test-org.el: Add test.
2012-12-04 23:50:26 +01:00
Nicolas Goaziou 6642177dee org-clock: Add tests for clocktable relative times
* testing/lisp/test-org-clock.el: New file.
2012-11-30 16:28:00 +01:00
Nicolas Goaziou 09cfdb8260 Merge branch 'maint' 2012-11-28 16:52:27 +01:00
Nicolas Goaziou f3a2515205 test-org: Disambiguate tests for `org-end-of-line'. 2012-11-28 16:51:47 +01:00
Nicolas Goaziou 6859b352a4 Merge branch 'maint' 2012-11-28 14:05:39 +01:00
Nicolas Goaziou 97508e72dd test-org: Attempt to fix failing test on 24.3 pre-release 2012-11-28 14:04:21 +01:00
Nicolas Goaziou a51b8fa308 org-element: Fix timestamp interpreter
* lisp/org-element.el (org-element-timestamp-interpreter): Fix
  timestamp interpreter when raw value isn't available.
* testing/lisp/test-org-element.el: Update test.
2012-11-25 01:16:39 +01:00
Nicolas Goaziou ce8819f18d Merge branch 'maint' 2012-11-23 23:49:19 +01:00
Nicolas Goaziou 89b8a8ca6d org-element: Fix `org-element-context'
* lisp/org-element.el (org-element-context): When point is between two
  objects, be sure to return the second one.
* testing/lisp/test-org-element.el: Add test.
2012-11-23 23:46:52 +01:00
Nicolas Goaziou 0a142efdde org-export: Add tools for timestamps objects
* contrib/lisp/org-export.el (org-export-split-timestamp-range,
  org-export-translate-timestamp): New functions.
* testing/lisp/test-org-export.el: Add tests.
2012-11-23 18:41:58 +01:00
Nicolas Goaziou cb32494e24 org-element: Timestamp with time range has active/inactive-range type
* lisp/org-element.el (org-element-timestamp-parser): Timestamp with
  time range has active/inactive-range type.
* testing/lisp/test-org-element.el: Add test.

In order to know if starting date/time is really the same as ending
date/time, this patch permits to use the following:

  (memq (org-element-property :type timestamp) '(active inactive))
2012-11-22 22:32:48 +01:00
Nicolas Goaziou 1a0f8b5c8b org-export: Add tools for timestamps
* contrib/lisp/org-export.el (org-export-timestamp-has-time-p,
  org-export-format-timestamp): New functions.
* testing/lisp/test-org-export.el: Add tests.
2012-11-19 21:52:32 +01:00
Nicolas Goaziou 5107ca3c9b org-export: Fix subtree option with `split' behaviour
* contrib/lisp/org-export.el (org-export--get-subtree-options): Store
  value of options with `split' behaviour as a list of strings, not
  simply as a string.  Small refactoring.
* testing/lisp/test-org-export.el: Add tests.
2012-11-18 14:44:20 +01:00
Nicolas Goaziou 74faf5bd26 org-export: New `org-export-derived-backend-p' predicate
* contrib/lisp/org-export.el (org-export-define-derived-backend): Add
  `:parent' property to derived backend.
(org-export-derived-backend-p): New function.
* testing/lisp/test-org-export.el: Add tests.

This function can be useful in filters implemation. I.e.

  (defun my-filter (contents backend info)
    (when (memq backend '(e-latex e-beamer some-derived-backend-from-latex))
      ...))

can be replaced with:

  (defun my filter (contents backend info)
    (when (org-export-derived-backend-p backend 'e-latex)
      ...))
2012-11-17 13:33:38 +01:00
Nicolas Goaziou b46b5d1c44 org-element: Return nil for unspecified time values
* lisp/org-element.el (org-element-timestamp-parser): Return nil for
  unspecified :hour-end and :minute-end properties.
* testing/lisp/test-org-element.el: Add tests.
2012-11-15 21:02:26 +01:00
Nicolas Goaziou 3d56f56399 org-export: Internal changes to back-end definition
* contrib/lisp/org-export.el (org-export-registered-backends): New
  variable.
(org-export-define-backend, org-export-define-derived-backend): Use
new variable. Also redefine how sub-menus are defined.
(org-export-backend-filters, org-export-backend-menu,
org-export-backend-options, org-export-backend-translate-table): New
functions.
(org-export-get-environment, org-export--parse-option-keyword,
org-export--get-subtree-options, org-export--get-inbuffer-options,
org-export--get-global-options, org-export-install-filters,
org-export-with-backend): Access to data stored in new variable.
(org-export-dispatch-ui): Display sub-menus according to new
definition.
(org-export-dispatch-menu-entries): Removed variable.
* contrib/lisp/org-e-beamer.el: Use new sub-menu definition.
(org-e-beamer--format-section, org-e-beamer-item,
org-e-beamer-keyword): Use `org-export-with-backend' instead of
relying on removed variables.
* testing/lisp/test-org-export.el: Update tests.

This patch gets rid of "invisible" variables, that is variables
defvar'ed within a macro.
2012-11-13 23:25:08 +01:00
Nicolas Goaziou 0421be2cee Merge branch 'maint' 2012-11-13 15:46:33 +01:00
Nicolas Goaziou 5dbccdb432 org-list: Fix infloop when inserting an item
* lisp/org-list.el (org-list-separating-blank-lines-number): When
  computing number of blank lines separating items, also count those
  in unparsed blocks, like example blocks.
* testing/lisp/test-org-list.el: Add tests.

In the following situation, with `org-blank-before-new-entry' set to
`auto' for `plain-list-item, a blank line should be inserted when
inserting the following item:

- item1
  #+BEGIN_EXAMPLE

  contents

  #+END_EXAMPLE
2012-11-13 15:45:09 +01:00
Nicolas Goaziou 94605246e5 Merge branch 'maint' 2012-11-09 02:47:23 +01:00
Toby S. Cubitt 2aeb28d2af Bug fix in org-beginning-of-line visual line motion
* lisp/org.el (org-beginning-of-line): check `visual-line-mode'
instead of `line-visual-mode' to determine whether to move by visual
lines.

* lisp/org.el (org-kill-line): use of org-bound-and-true-p macro.

* testing/lisp/test-org.el: Add test
2012-11-09 02:46:21 +01:00
Nicolas Goaziou 5acffad561 Merge branch 'maint' 2012-11-05 00:58:34 +01:00
Nicolas Goaziou f48a8b7bf8 Fix end of line function called on an hidden block
* lisp/org.el (org-end-of-line): On a hidden block make sure to
  delegate motion to `end-of-line' instead of `move-end-of-line' in
  order to stay on the current line.
* testing/lisp/test-org.el: Update test.
2012-11-05 00:57:56 +01:00
Nicolas Goaziou 5d4243bccc org-export: Run a hook just before expanding include keywords and macros
* contrib/lisp/org-export.el (org-export-before-processing-hook): New
  variable.
(org-export-as): Run a hook just before expanding include keywords and
macros, and evaluating Babel blocks.
* testing/lisp/test-org-export.el: Add test.
2012-11-02 14:06:50 +01:00
Nicolas Goaziou 22ac03bee5 org-export: Add a function to retrieve category of an element or object
* contrib/lisp/org-export.el (org-export-get-category): New function.
* testing/lisp/test-org-export.el: Add tests.
2012-11-02 13:44:46 +01:00
Nicolas Goaziou 32c3456020 org-export: Fix previous/next element finding in secondary strings
* contrib/lisp/org-export.el (org-export-get-previous-element,
  org-export-get-next-element): Correctly retrieve previous and next
  object, if any, in secondary strings.
* testing/lisp/test-org-export.el: Add tests.
2012-10-31 13:21:16 +01:00
Nicolas Goaziou 1a7610ed98 org-export: Add FILETAGS when retreiving tags with inheritance
* contrib/lisp/org-export.el (org-export-special-keywords): New
  "FILETAGS" keyword.
(org-export--get-inbuffer-options): Handle "FILETAGS" keywords.
(org-export-get-tags): Add FILETAGS when retreiving tags with
inheritance.
* testing/lisp/test-org-export.el: Add test.
2012-10-30 16:03:59 +01:00
Nicolas Goaziou 6290da183c Signal an error when a circular macro expansion happens
* lisp/org.el (org-macro-replace-all): Signal an error when a circular
  macro expansion happens.
(org-macro-initialize-templates): Fix docstring.
* testing/lisp/test-org.el: Add test.
2012-10-30 09:24:55 +01:00
Nicolas Goaziou 8fb5987e56 org-export: Fix smart quotes with isolated quotes
* contrib/lisp/org-export.el (org-export-activate-smart-quotes): Fix
  smart quotes in some corner-cases.  Refactor code.
* testing/lisp/test-org-export.el: Add test.
2012-10-29 20:36:03 +01:00
Nicolas Goaziou 2e8591783f org-element: Fix org-element-context on parsed keywords
* lisp/org-element.el (org-element-context): Fix org-element-context
  on parsed keywords.
* testing/lisp/test-org-element.el: Update test.
2012-10-29 14:01:49 +01:00
Nicolas Goaziou a2120a9d73 org-export: Expand correctly {{{title}}} and such
* contrib/lisp/org-export.el (org-export-as): Expand correctly
  {{{title}}} and such when they already contain a regular macro.
  This is done by expanding macros in two steps: at first regular
  macros,  then document specific macros.
(org-export-expand-macro): Remove function.
* testing/lisp/test-org-export.el: Add test.
2012-10-29 14:01:20 +01:00
Nicolas Goaziou a8c026cb26 org-export: Explicit error when using invalid syntax for INCLUDE keywords
* contrib/lisp/org-export.el (org-export-expand-include-keyword):
  Error out when file isn't specified within double quotes.
* testing/lisp/test-org-export.el: Add test.
2012-10-29 11:31:19 +01:00
Nicolas Goaziou 99110c60a6 org-element: Find objects in document and parsed affiliated keywords
* lisp/org-element.el (org-element-context): Find objects in document
  and parsable affiliated keywords.
* testing/lisp/test-org-element.el: Add tests.
2012-10-29 11:09:41 +01:00
Nicolas Goaziou 98d5666bac org-element: Allow duals keywords with only secondary value
* lisp/org-element.el (org-element--collect-affiliated-keywords):
  Allow duals keywords with only secondary value.
* testing/lisp/test-org-element.el: Add test.

This patch allows to parse correctly the following:

    #+CAPTION[short caption]:
    #+CAPTION: Very long caption
    Some paragraph.
2012-10-28 22:45:34 +01:00
Nicolas Goaziou c1e3aaece3 org-element: Improve timestamps parsing
* lisp/org-element.el (org-element-timestamp-parser): Modify timestamp
  objects properties.
(org-element-headline-parser, org-element-inlinetask-parser): Remove
`:timestamp' and `:clock' property.  Add `:clockedp' property.  Also,
set `:closed', `:deadline' and `:scheduled' values to timestamp
objects, not strings.  Small refactoring.
(org-element-clock-parser): Rename `:time' property into `:duration'.
Also, set `:value' value as a timestamp object, not a string.
(org-element-planning-parser): Set `:closed', `:deadline' and
`:scheduled' values to timestamp objects, not strings.
(org-element-clock-interpreter, org-element-planning-interpreter)
(org-element-timestamp-interpreter): Update interpreters.
(org-element--current-element): Tiny refactoring.
* testing/lisp/test-org-element.el: Add tests.
2012-10-28 16:29:55 +01:00
Nicolas Goaziou 2f2a80fe06 ob: Fix block evaluation in a narrowed buffer
* lisp/ob.el (org-babel-where-is-src-block-result): Insert new results
  keyword in current narrowed part of buffer, if necessary. Small
  refactoring.
(org-babel-insert-result): Do not widen buffer when new results have
to be inserted.  Therefore, results inserted after the last block of
a narrowed buffer still belong to the narrowed part of the buffer.
* testing/lisp/test-ob.el: Add tests.
* testing/lisp/test-ob-exp.el: Move test to test-ob.el
2012-10-28 16:21:30 +01:00
Nicolas Goaziou ccc98ebc2d org-export: Fix expansion of babel calls in included files
* contrib/lisp/org-export.el (org-export-as):
  `org-current-export-file' should refer to current, temporary, buffer
  containing included contents, not to original buffer with include
  keywords.
(org-export-with-current-buffer-copy): Buffer copy must contain the
whole buffer, possibly narrowed to a proper part, not only the
narrowed part.
* testing/lisp/test-org-export.el: Tweak tests.
2012-10-28 16:21:30 +01:00
Nicolas Goaziou d81982ae9d org-element: Parse diary-sexp elements
* lisp/org-element.el (org-element-paragraph-separate): Diary-sexp
  elements can separate paragraphs.
(org-element-all-elements): Install new `diary-sexp' type.
(org-element--current-element): Recognize new `diary-sexp' elements.
(org-element-diary-sexp-parser, org-element-diary-sexp-interpreter):
New functions.
* testing/lisp/test-org-element.el: Add tests.
2012-10-27 14:43:30 +02:00
Nicolas Goaziou b2047a2565 org-export: Implement a generic smart quote module
* contrib/lisp/org-export.el (org-export-options-alist): Add an option
  item to toggle smart quotes during export.
(org-export-with-smart-quotes, org-export-smart-quotes-alist,
org-export-smart-quotes-regexps): New variables.
(org-export-activate-smart-quotes): New function.
(org-export-data): Remove residual text properties.
* testing/lisp/test-org-export.el: Add tests.
2012-10-27 11:42:31 +02:00
Nicolas Goaziou 95c305490e org-element: Add :parent text property to strings in parse tree
* lisp/org-element.el (org-element-property): Access to text
  properties when argument is a string.
(org-element-put-property): Correctly set property when target is
a string.
(org-element-adopt-elements): Also put :parent properties on strings.
* testing/lisp/test-org-element.el: Add test.
2012-10-27 11:42:30 +02:00
Nicolas Goaziou bef53d7f67 Merge branch 'maint' 2012-10-20 11:59:07 +02:00
Nicolas Goaziou 93040f4671 Fix auto filling in a paragraph directly following a comment
* lisp/org.el (org-auto-fill-function): Make sure `adaptive-fill-mode'
  mode is nil when pre-computed `fill-prefix' is the empty string.
  Otherwise filling functions from fill.el think it has to be computed
  again and overwrite it.
2012-10-20 11:58:16 +02:00
Nicolas Goaziou 94232ab5c6 Merge branch 'maint' 2012-10-16 21:12:21 +02:00
Nicolas Goaziou 8f96754932 Do not call `end-of-visual-line' when moving to the end of line
* lisp/org.el (org-end-of-line): Do not call `end-of-visual-line' when
  moving to the end of line.  Also improve behaviour on elements that
  can be hidden.
* testing/lisp/test-org.el: Add tests.
2012-10-16 21:11:06 +02:00
Nicolas Goaziou 0920e60c01 ob-exp: Fix removal of block results when exporting
* lisp/ob-exp.el (org-export-blocks-preprocess): Results of an
  evaluated code block can be inserted within the blank lines after
  the block.  Hence, if the block has to be removed, delete everything
  down to the first non-blank line after the end of block closing
  string, instead of removing everything down to the very end of the
  block.
* testing/lisp/test-ob-exp.el: Add test.
2012-10-15 22:29:30 +02:00
Nicolas Goaziou 23aa910259 Merge branch 'maint' 2012-10-14 21:51:59 +02:00
Nicolas Goaziou b7c5cf5d44 org-element: Fix parsing of objects of the same type in a single paragraph
* lisp/org-element.el (org-element--get-next-object-candidates): Fix
  parsing of objects of the same type in a single paragraph.
* testing/lisp/test-org-element.el: Add tests.
2012-10-14 21:49:41 +02:00
Nicolas Goaziou c65abd8577 org-element: Fix parsing of syntax at beginning of item
* lisp/org-element.el (org-element-sub/superscript-successor): Fix
  parsing of sub/superscript at beginning of item.
(org-element-latex-or-entity-successor): Fix parsing of latex
  fragments at beginning of item.
* testing/lisp/test-org-element.el: Add test.
2012-10-14 21:38:42 +02:00
Nicolas Goaziou c1c0c70c89 org-export: Add tag inheritance to `org-export-get-tags'
* contrib/lisp/org-export.el (org-export-get-tags): Add optional tag
  inheritance.
* testing/lisp/test-org-export.el: Add test.
2012-10-14 13:19:12 +02:00
Nicolas Goaziou 56470de26d Merge branch 'maint'
Conflicts:
	testing/lisp/test-org.el
2012-10-12 18:22:04 +02:00
Nicolas Goaziou 5212d4fa6b Fix analyzing european dates with time but without year
* lisp/org.el (org-read-date-analyze): Fix analyzing for dates like
  "29.03 16:40".
* testing/lisp/test-org.el: Add test.
2012-10-12 18:17:25 +02:00
Nicolas Goaziou 346c978939 Remove useless data in test file
* testing/examples/macro-templates.org: Remove time-stamp.
2012-10-10 22:46:50 +02:00
Nicolas Goaziou 89d6a26f8d org-export: Expand include keywords before macros
* contrib/lisp/org-export.el (org-export-as): Expand include keywords
  before macros.  This allows to specify macro templates in the
  included file.
* testing/examples/macro-templates.org: New file for testing purposes.
* testing/lisp/test-org-export.el: Add test.
2012-10-10 13:52:54 +02:00
Nicolas Goaziou bbdd81ad37 Be stricter when updating radio targets
* lisp/org.el (org-all-targets): Make sure the regexp really matched
  a radio target.
* testing/lisp/test-org.el: Add test.
2012-10-10 13:41:14 +02:00
Nicolas Goaziou 58b42debb1 org-export: Include title, author, date and email macros
* contrib/lisp/org-export.el (org-export-expand-macro): New function.
(org-export-as): Use new function.
* lisp/org.el (org-macro-expand, org-macro-replace-all): Change
  signature.  The function now accepts an alist of templates so it
  doesn't have to rely only on `org-macro-templates'.
(org-macro-initialize-templates): {{{date}}} is not anymore an alias
for {{{time}}}.  During export, it will provide the value stored in
DATE keyword instead.
* testing/lisp/test-org-export.el: Add tests.
* testing/lisp/test-org.el: Update tests.
2012-10-06 10:29:37 +02:00
Nicolas Goaziou 2c78ca4a56 Merge branch 'maint'
Conflicts:
	lisp/org-element.el
2012-10-06 01:21:27 +02:00
Nicolas Goaziou ad99ea9147 org-element: Fix parsing with trailing spaces at eob
* lisp/org-element.el (org-element-center-block-parser,
  org-element-drawer-parser, , org-element-footnote-definition-parser,
  org-element-inlinetask-parser, org-element-plain-list-parser,
  org-element-quote-block-parser, org-element-special-block-parser,
  org-element-babel-call-parser, org-element-clock-parser,
  org-element-comment-parser, org-element-comment-block-parser,
  org-element-example-block-parser, org-element-export-block-parser,
  org-element-fixed-width-parser, org-element-horizontal-rule-parser,
  org-element-keyword-parser, org-element-latex-environment-parser,
  org-element-paragraph-parser, org-element-planning-parser,
  org-element-property-drawer-parser, org-element-src-block-parser,
  org-element-table-parser,
  org-element-verse-block-parserorg-element-dynamic-block-parser):
  Make sure element never ends at the end of a blank non-empty line.
* testing/lisp/test-org-element.el: Add test.
2012-10-06 01:02:03 +02:00
Nicolas Goaziou 78d2bd7edc Merge branch 'maint' 2012-10-05 15:08:58 +02:00
Nicolas Goaziou daf8cf030c org-element: Fix `org-element-context' when in recursive objects
* lisp/org-element.el (org-element-context,
  org-element--get-next-object-candidates): Fix `org-element-context'.
  In particular, the restrictions for an object may be different from
  those of its container (i.e. table rows and table cells).
* testing/lisp/test-org-element.el: Add tests.
2012-10-05 15:02:55 +02:00
Nicolas Goaziou 2a95a47c5f Merge branch 'maint' 2012-10-01 21:37:48 +02:00
Nicolas Goaziou 3bd22fb045 org-element: Store value of example-blocks and src-blocks unescaped
* lisp/org-element.el (org-element-example-block-parser,
  org-element-src-block-parser): Store value of example-blocks and
  src-blocks unescaped.
(org-element-example-block-interpreter,
org-element-src-block-interpreter): Escape value again when storing
it.
* contrib/lisp/org-export.el (org-export-unravel-code): Don't clean
  commas from code since org-element already took care of it.
* testing/lisp/test-org-export.el: Update test.
* testing/lisp/test-org-element.el: Add tests.
2012-10-01 21:35:50 +02:00
Nicolas Goaziou fac86b03fe Normalize comma-escaping of src-blocks and example-blocks
* lisp/org-src.el (org-escape-code-in-string,
  org-unescape-code-in-string, org-escape-code-in-region,
  org-unescape-code-in-region): New functions.
(org-edit-src-code, org-edit-src-exit): Use new functions.
* lisp/org.el (org-strip-protective-commas): Removed function.
* lisp/org-exp.el (org-export-select-backend-specific-text): Use new
  function.
* lisp/ob.el (org-babel-parse-src-block-match,
  org-babel-parse-inline-src-block-match, org-babel-insert-result):
  Always escape produced blocks, independently on the language of the
  block, if any.  Use new functions.
* doc/org.texi: Update documentation.
* testing/lisp/test-ob.el: Update test.
2012-10-01 21:24:00 +02:00
Bastien Guerry 180fd62245 Merge branch 'maint' 2012-10-01 19:00:18 +02:00
Bastien Guerry 857a3921af testing/lisp/test-ob-lilypond.el: Use "w32" or "windows-nt" instead of "win32" 2012-10-01 19:00:14 +02:00
Nicolas Goaziou 3245619445 org-element: Allow to map over affiliated keywords
* lisp/org-element.el (org-element-map): Change signature.
* testing/lisp/test-org-element.el: Add test.
2012-09-30 23:57:45 +02:00