Commit Graph

921 Commits

Author SHA1 Message Date
Achim Gratz 4ed554196b ox: implement additional #+INCLUDE markup
* lisp/ox.el (org-export-expand-include-keyword): Change parsing so
  that arbitrary blocks around the included content can be used.
  Content is not code-escaped unless it is a literal block, this
  applies to "src" and "example".
* doc/org.texi (Include files): Document the additional markup.
* testing/lisp/test-ox.el (test-org-export/expand-include): Add test
  for an #+INCLUDE with "html" and "center" markup.
* testing/examples/include.html: New file, used for testing
  "#+INCLUDE html".
2014-06-07 18:02:52 +02:00
Eric Schulte c3e497f394 awk code blocks handle tabular input
Protected by a new unit test.

* lisp/ob-awk.el (org-babel-execute:awk): Use the
  `org-babel-awk-var-to-awk' function instead of a simple format
  string.
2014-06-07 11:16:55 -04:00
Eric Schulte 6fb033c791 fix a bug in new ob-awk code
thank you test suite

* lisp/ob-awk.el (org-babel-execute:awk): Don't need to apply the
  append, just need to append.

* testing/lisp/test-ob-awk.el (ob-awk/input-src-block-1): Renamed to
  avoid name duplication and over-definition.
  (ob-awk/input-src-block-2): Renamed to avoid name duplication and
  over-definition.
2014-06-06 13:11:46 -04:00
Bastien Guerry ad567e877b testing/lisp/test-org.el: Update tests
* testing/lisp/test-org.el
(test-org/open-at-point-in-property): Rename from
`test-org/open-at-point'.  Only test whether
`org-open-at-point' does not throw an error.
(test-org/open-at-point-in-comment)
(test-org/open-at-point/info): New tests.
2014-06-02 22:33:28 +02:00
Achim Gratz 8e72c8fcfa testing/lisp/test-org: actually check that org-open-at-point did the right thing
* testing/lisp/test-org.el (test-org/open-at-point): The test should
  leave the cursor one line above "Org Mode Manual" in the "*info*"
  buffer.  Try to switch to that buffer and check that point is where
  it should be, then kill the buffer.
2014-06-02 21:05:46 +02:00
Nicolas Goaziou 7dadf85716 Move test into appropriate file
* testing/lisp/test-org-element.el (test-org-element/org-open-at-point):
Remove test.
* testing/lisp/test-org.el (test-org/open-at-point): Add test.
2014-06-01 13:37:11 +02:00
York Zhao b366525077 test-org-element.el (test-org-element/org-open-at-point): Add test
* test-org-element.el (test-org-element/org-open-at-point):
Add test.

TINYCHANGE
2014-06-01 10:53:19 +02:00
Nicolas Goaziou f58201b1e1 Fix indentation in source blocks
* lisp/org.el (org-indent-line): Indent source block contents
  according to line above when `org-src-tab-acts-natively' is nil.

* testing/lisp/test-org.el (test-org/indent-line): Update test.
2014-05-19 13:33:28 +02:00
Nicolas Goaziou 3702dce1db Fix previous patch
* lisp/org.el (org-update-radio-target-regexp): Fix previous patch.

* testing/lisp/test-org.el (test-org/update-radio-target-regexp): Add test.
2014-05-17 11:14:27 +02:00
Nicolas Goaziou f8b7eb4e20 Fix radio target update
* lisp/org.el (org-update-radio-target-regexp): Properly update cache
  when refreshing regexp.

* testing/lisp/test-org.el (test-org/update-radio-target-regexp): Fix
  test.
2014-05-17 11:03:29 +02:00
Nicolas Goaziou 49ef55bd65 test-org: Fix test name
* testing/lisp/test-org.el (test-org/toggle-fixed-width): Fix test
  name.
2014-05-16 22:14:59 +02:00
Aaron Ecay 08e2596718 ob-core.el: allow the auto-generation of output file names for src blocks.
* lisp/ob-core.el (org-babel-generate-file-param): New function.
(org-babel-get-src-block-info): Use it.
(org-babel-merge-params): Handle :file-ext.
(org-babel-graphical-output-file): error if no :file or :file-ext.
* testing/lisp/test-ob.el (test-org-babel/file-ext-and-output-dir):
New test.
* doc/org.texi (Specific header arguments): Add doc for :file-ext and
:output-dir header args.
* lisp/ob-R.el (org-babel-expand-body:R): Don’t calculate
graphics-file.
(org-babel-execute:R): Only look for a graphics-file if needed.
2014-05-11 16:33:22 -04:00
Nicolas Goaziou fe129fb352 Rewrite `org-indent-region'
* lisp/org.el (org-indent-region): Update function according to recent
  `org-indent-line' change.  Optimize it.

* testing/lisp/test-org.el (test-org/indent-region): New test.
2014-05-07 17:39:52 +02:00
Nicolas Goaziou 51ffcd02dd Rewrite `org-indent-line'
* lisp/org.el (org--get-expected-indentation,
  org--align-node-property): New functions.
(org-indent-line): Use new function.  Also merge functionalities with
`org-src-native-tab-command-maybe'.

* lisp/org-src.el (org-src-native-tab-command-maybe): Remove function.

* testing/lisp/test-org.el (test-org/indent-line): New test.
2014-05-07 17:39:52 +02:00
Nicolas Goaziou 86a129c597 Fix `org-flag-drawer'
* lisp/org.el (org-flag-drawer): Do not flag drawer when point is on
  an empty line after it.  When hiding the drawer away, make sure
  point always stays in a visible part of the buffer.

* testing/lisp/test-org.el (test-org/flag-drawer): Add tests.
2014-04-28 19:41:08 +02:00
Bastien Guerry 69700e1c44 Merge branch 'maint' 2014-04-22 12:09:01 +02:00
Bastien Guerry 099b6f0fb5 test-org.el: Fix test
* test-org.el (test-org/insert-todo-heading-respect-content):
Fix test.
2014-04-22 12:08:15 +02:00
Nicolas Goaziou 55e46fc260 test-org-element: Add tests for links
* testing/lisp/test-org-element.el (test-org-element/link-parser): add
  tests.
2014-04-19 21:34:29 +02:00
Nicolas Goaziou 82cc4f43ec test-org: Tiny clean-up
* testing/lisp/test-org.el (test-org/update-radio-target-regexp): Tiny
  clean-up.
2014-04-19 20:27:21 +02:00
Nicolas Goaziou 6eb940a8dc Fix cache update when radio targets are being refreshed
* lisp/org-element.el (org-element-cache-refresh): New function.
* lisp/org.el (org-update-radio-target-regexp): Make it standalone.
  Also refresh fontification only when necessary.
(org-all-targets, org-make-target-link-regexp): Remove functions.

* testing/lisp/test-org.el (test-org/update-radio-target-regexp): New
  test
(test-org/all-targets): Remove test.

We need to manually reset cache on radio links as re-fontification
doesn't trigger a buffer change, and, as a consequence, a cache reset.
2014-04-19 18:36:58 +02:00
Nicolas Goaziou 2b2b2c5c99 org-element: Fix infloop at the end of an incomplete table row
* lisp/org-element.el (org-element-context): Fix infloop.  Be more
  cautious when point is at the end of buffer.

* testing/lisp/test-org-element.el (test-org-element/context): Add
  test.
2014-04-17 21:37:07 +02:00
Nicolas Goaziou fffd055ac5 Merge branch 'maint'
Conflicts:
	lisp/org-element.el
	lisp/ox-html.el
2014-04-17 11:34:54 +02:00
Nicolas Goaziou 1ca819e398 Revert "Make Org links compatible with URI syntax"
This reverts commit 3589f64e42.
2014-04-17 11:30:15 +02:00
Pascal Fleury 3c7e75ab0b ob-shell.el: export vars as arrays for 'sh' code blocks
* lisp/ob-shell.el: added support to serialize vars as arrays or associative arrays as appropriate if it is using bash.
* testing/examples/ob-shell-test.org: a file containing a few code blocks both illustrating the use of arrays as well as serving as test for the new export functionality.
* testing/lisp/test-ob-shell.el: added a few unit tests that verify that this new logic only triggers for bash and no other shell at this time.

When variables are defined in a 'sh' code block, they are exported as strings. when the variable itself is an array or a table, then we simply get a shell variable that contains the list of all values in a non-structured form.
When calling the code block with bash, however, it will now export the list as an array, the table as an associative array. A scalar is exported the same way as before.

Signed-off-by: Pascal Fleury <fleury@google.com>
2014-04-14 21:24:00 -06:00
Nicolas Goaziou d5484ae3f5 test-ox: Tiny refactoring
* testing/lisp/test-ox.el (test-org-export/expand-include): Tiny
  refactoring.
2014-04-12 16:17:13 +02:00
Nicolas Goaziou b8781c4c85 ox: Make footnotes file specific when including Org files
* lisp/ox.el (org-export-expand-include-keyword,
  org-export--prepare-file-contents): Make footnotes file specific
  when including Org files.

* doc/org.texi (Include files): Add documentation.

* testing/lisp/test-ox.el (test-org-export/expand-include): Add tests.

http://permalink.gmane.org/gmane.emacs.orgmode/83606
2014-04-12 15:07:42 +02:00
Nicolas Goaziou 7c82e6ac19 No alphanumeric characters around radio links
* lisp/org.el (org-make-target-link-regexp): Change regexp so
  alphanumeric characters cannot be found next to a radio link.
(org-activate-target-links): Apply changes to radio link regexp.

* lisp/org-element.el (org-element--object-lex,
  org-element-link-parser): Apply changes to radio link regexp.

* testing/lisp/test-org-element.el (test-org-element/link-parser):
  Update test.

Patch suggested by Daniel Clemente.
http://permalink.gmane.org/gmane.emacs.orgmode/84461
2014-04-11 21:30:15 +02:00
Nicolas Goaziou 37e3c112dd Merge branch 'maint' 2014-04-10 23:01:20 +02:00
Nicolas Goaziou 3589f64e42 Make Org links compatible with URI syntax
* lisp/org.el (org-make-link-regexps): Allow optional double slashes
  after type.  Small refactoring.

* testing/lisp/test-org-element.el (test-org-element/link-parser):
  Update test.

This patch allows to write both [[file:/file.org]] and [[file:///file.org]].
See bug#16751.
2014-04-10 22:57:05 +02:00
Nicolas Goaziou fea23d3da2 Fix COMMENT keyword when stacked with a regular keyword
* lisp/org.el (org-set-font-lock-defaults): Fix headline fontification
  when keywords are stacked.
(org-toggle-comment): Properly toggle COMMENT keyword when a regular
keyword is already present.
(org-todo, org-agenda-prepare-buffers): Correctly match a commented
heading.
* lisp/org-colview.el (org-columns-capture-view): Correctly match
  a commented heading.

* testing/lisp/test-org.el (test-org/toggle-comment): New test.
2014-04-10 22:51:16 +02:00
Nicolas Goaziou af41c071ed Merge branch 'maint' 2014-04-10 11:56:13 +02:00
Nicolas Goaziou 7fe1da1f8c org-test: Small code clean-up
* testing/org-test.el (org-test-with-temp-text): Clean-up code.
2014-04-10 11:53:27 +02:00
York Zhao d01d22b74f org-test: Fix <point> feature
* testing/org-test.el (org-test-with-temp-text): Fix point position.

According to the docstring, if the string "<point>" appears in TEXT
then the string "<point>" is removed and point is placed there. The
problem was that after string "<point>" was removed, the point
was *not* placed at the position of the removed text, rather, it was
placed one character before that position which is wrong. The reason
is that Emacs buffer position is a number started from 1, instead of
0, in other words, the value of `(point-min)' is 1 not 0. The problem
is addressed by adding 1 to the calculated position.

TINYCHANGE
2014-04-10 11:52:44 +02:00
Nicolas Goaziou dfcfca8219 Merge branch 'maint'
Conflicts:
	lisp/org-element.el
2014-04-08 18:59:06 +02:00
Nicolas Goaziou 728661309e org-element: Fix table parsing with missing final bar
* lisp/org-element.el (org-element-table-cell-parser,
  org-element-table-cell-successor): Recognize cell even when last
  vertical bar is missing.

* testing/lisp/test-org-element.el (test-org-element/table-cell-parser):
  Add test.

Thanks to Thorsten Jolitz for reporting it.
http://permalink.gmane.org/gmane.emacs.orgmode/84713
2014-04-08 18:56:51 +02:00
Nicolas Goaziou 23e62f7527 Radio targets cannot beging or end with whitespace
* lisp/org.el (org-radio-target-regexp): Radio targets cannot begin or
  end with whitespace.
(org-target-regexp): Update syntax according to previous rule.
(org-any-target-regexp): Fix fontification bug.

* testing/lisp/test-org-element.el (test-org-element/radio-target-parser):
  Add test.

Variables are turned into defconst to emphasize the fact that they are
not subject to change.

Thanks to Daniel Clemente for reporting it.
http://permalink.gmane.org/gmane.emacs.orgmode/84461
2014-04-02 14:54:37 +02:00
Nicolas Goaziou a7e12d2af5 ox: Fix multiple deactivated subscripts export
* lisp/ox.el (org-export--remove-uninterpreted-data-1): Fix multiple
  deactivated subscripts export.

* testing/lisp/test-ox.el (test-org-export/uninterpreted): Add test.

Thanks to Xavier Garrido for reporting it.
http://permalink.gmane.org/gmane.emacs.orgmode/84403
2014-03-29 22:47:01 +01:00
Achim Gratz c6e0157095 org-test: fix macro definitions so that eager macro expansion doesn't fail
* testing/org-test.el (org-test-with-temp-text,
  org-test-with-temp-text-in-file): Correct quoting of macro
  expansion.

Macro arguments must not be used during macro expansion since they are
not available at that time; conversely, bindings established during
macro expansion generally can not be used at macro execution
time (unless un-quoted during expansion).
2014-03-25 19:11:01 +01:00
Nicolas Goaziou 1c1936fbb1 Allow radio links after an apostrophe and mid-word
* lisp/org.el (org-make-target-link-regexp): Allow radio links after
  an apostrophe and mid-word.  Small refactoring.

* testing/lisp/test-ox.el (test-org-export/resolve-radio-link): Add
  test.

See http://permalink.gmane.org/gmane.emacs.orgmode/84108.
2014-03-25 10:21:26 +01:00
Nicolas Goaziou 6d1d61f667 Rename `org-babel-under-commented-heading-p'
* lisp/org.el (org-in-commented-heading-p): New function.
* lisp/ob-tangle.el (org-babel-under-commented-heading-p): Remove
  function.
(org-babel-tangle-collect-blocks): Use new function.
* lisp/ob-exp.el (org-babel-exp-process-buffer): Use new function.

* testing/lisp/test-org.el (test-org/in-commented-heading-p): New
  test.
2014-03-24 13:29:42 -04:00
Nicolas Goaziou 230d09aeb0 Merge branch 'maint' 2014-03-24 14:20:23 +01:00
Nicolas Goaziou 8212776cfc Fix radio target parsing
* lisp/org-element.el (org-element-all-successors,
  org-element-object-restrictions): Prioritize `link' over other
  successors in order to find radio links starting with another syntax
  object (e.g., an entity).  Also allow text markup within radio
  targets.
(org-element-link-parser): Add contents to radio targets.

* lisp/org.el (org-make-target-link-regexp): Fix regexp so it can
  match targets starting with an Org object (e.g., an entity).
(org-ctrl-c-ctrl-c): Fix function when applied on an object contained
within a radio target.

* testing/lisp/test-org-element.el (test-org-element/radio-target-parser): Add test.
* testing/lisp/test-ox.el (test-org-export/resolve-radio-link): Add test.
2014-03-24 14:13:24 +01:00
Nicolas Goaziou d6d1f25429 Fix `org-open-at-point'
* lisp/org.el (org-open-at-point): Correctly open fuzzy links when
  path is hexified.
* testing/lisp/test-org.el (test-org/coderef): New test.
(test-org/fuzzy-links): Add test.
2014-03-21 14:51:34 +01:00
Nicolas Goaziou df10309489 ob-ref: Properly resolve references in ":post" arguments
* lisp/ob-core.el (org-babel-exp-reference-buffer): New variable, as
  a replacement for `org-current-export-file'.
(org-babel-check-confirm-evaluate): Use new variable.
* lisp/ob-exp.el (org-babel-exp-in-export-file): Use new variable.
(org-babel-exp-get-export-buffer): Remove function.
(org-babel-exp-process-buffer): Change signature.
* lisp/ob-ref.el (org-babel-ref-resolve): Use new variable during
  export in order to properly resolve references.
* lisp/ox.el (org-export-execute-babel-code): Use new variable.

* contrib/lisp/org-wikinodes.el (org-wikinodes-process-links-for-export):
  Remove a cond branch as it is always
  false (`org-current-export-file' couldn't be a string).

* testing/lisp/test-ob-lob.el (test-ob-lob/export-lob-lines): Update
  test.
* testing/lisp/test-ob.el (test-ob/eval-header-argument): Update test.
* testing/lisp/test-ob-exp.el (ob-export/reference-in-post-header):
  New test.

During export, Babel executes sequentially all blocks in the buffer
being exported.  This can lead to modifications preventing some
references from being resolved.  As a workaround, Babel stores
a pristine copy of the buffer in a variable so it can always find
needed references.

Before this patch, the variable storing this copy was
`org-current-export-file' and was dynamically bound in "ox.el".  It
was used to resolve noweb references (`org-babel-expand-noweb-references')
but not regular references (`org-babel-ref-resolve').

Now, the variable is `org-babel-exp-reference-buffer' and it is bound
from `org-babel-exp-process-buffer'.  It is used to resolve all
references.  In particular, this allows to use references in :post
header.

Thanks to Jarmo Hurri for reporting it.
2014-03-19 21:34:56 +01:00
Nicolas Goaziou 05f69e5bf8 ob-exp: During export ignore Babel code under commented headlines
* lisp/ob-exp.el (org-babel-exp-process-buffer): Skip code under
  a commented headline.
* testing/lisp/test-ob-exp.el (ob-export/export-under-commented-headline):
  New test.
2014-03-15 19:40:13 -06:00
Nicolas Goaziou 2f60dfc1b3 Merge branch 'maint' 2014-03-12 09:08:37 +01:00
Nicolas Goaziou cb22a0355f org-element: Fix parsing of bold objects at the beginning of a headline
* lisp/org-element.el (org-element-context): Fix parsing of bold
  objects at the beginning of a headline.
* testing/lisp/test-org-element.el (test-org-element/context): Add
  test.
2014-03-12 09:05:50 +01:00
Nicolas Goaziou d75fa9febc `org-open-at-point' right after an object still open it
* lisp/org.el (org-open-at-point): White spaces after an object are
  usually ignored by the function.  Though, when point is right after
  the object, still activate it.
* testing/lisp/test-org.el (test-org/custom-id): Fix test.
2014-03-02 10:32:51 +01:00
Nicolas Goaziou 8b2d3645ac Ignore `org-open-at-point' when point is on white spaces
* lisp/org.el (org-open-at-point): Do not do anything when point is on
  white spaces after an object.
* testing/lisp/test-org.el (test-org/custom-id): Modify test.
2014-02-27 18:38:39 +01:00
Nicolas Goaziou 3960ed07e6 Merge branch 'maint'
Conflicts:
	lisp/org-element.el
2014-02-25 20:54:48 +01:00
Nicolas Goaziou 7f8c1226e8 org-element: Fix timestamps parsing in planning lines
* lisp/org-element.el (org-element-context): Fix timestamps parsing.
* testing/lisp/test-org-element.el (test-org-element/context): Add
  test.
2014-02-25 20:51:32 +01:00
Nicolas Goaziou fc9ce86cfc Rewrite `org-open-at-point' using Elements
* lisp/org.el (org-open-at-point): Rewrite function using Element
  parser.
(org-link-types): Add "help" type.
* testing/lisp/test-org-open-at-point.el: Remove file.  Two tests are
  not supported anymore (namely bracket-link-before and
  plain-link-before) and the other tests are wrong (mixing id and
  custom-id links).
* testing/examples/open-at-point.org: Remove file.
* testing/lisp/test-org.el (test-org/custom-id): Add test.

Unlike to the previous implementation, this one will only open links
under point or just before point, not links on the same line but
before point.
2014-02-23 14:26:18 +01:00
Nicolas Goaziou 13691bde32 org-element: Fix `org-element-context' at eob
* lisp/org-element.el (org-element-context): If function is called at
  the end of buffer, return any object that ends there.
* testing/lisp/test-org-element.el (test-org-element/context): Add
  test.
2014-02-23 13:49:41 +01:00
Michael Brand 89c1668945 Add ERT with org-lookup-all for GROUP BY and ranking
* testing/lisp/test-org-table.el (test-org-table/org-lookup-all): Add
new test.
2014-02-22 21:18:28 +01:00
Nicolas Goaziou eed0500913 org-element: Implement lazy cache synchronization
* lisp/org-element.el (org-element-cache-sync-idle-time): Change
  default value.
(org-element-cache-sync-duration, org-element-cache-sync-break,
org-element--cache-sync-requests, org-element--cache-sync-timer,
org-element--cache-sync-keys, org-element--cache-default-key,
org-element--cache-change-warning): New variables.
(org-element-cache-merge-changes-threshold,
org-element--cache-status): Removed variables.
(org-element--cache-key, org-element--cache-generate-key,
org-element--cache-key-less-p, org-element--cache-find,
org-element--cache-set-timer, org-element--cache-process-request,
org-element--cache-submit-request, org-element--parse-to,
org-element--cache-interrupt-p, org-element--cache-put,
org-element--cache-active-p): New functions.
(org-element--cache-compare): Adapt to new keys in AVL tree.
(org-element--cache-pending-changes-p,
org-element--cache-cancel-changes, org-element--cache-mapc,
org-element-cache-get, org-element-cache-put): Removed functions.
(org-element--cache-before-change): Use new variables.
(org-element--cache-after-change): Renamed from
`org-element--cache-record-change'.
(org-element-cache-get): Change signature.
(org-element-cache-put): Rewrite function.  Use new tools.
(org-element-cache-reset): Adapt to new variables.
(org-element--cache-sync): Rewrite function.

* lisp/ox.el (org-export--generate-copy-script): Do not copy through
  new cache-related variables.
(org-export-ignored-local-variables): New variable.

* testing/lisp/test-org-element.el (test-org-element/cache): New test.

Now only the part of the cache that needs to be accessed is updated
synchronously.  Otherwise, it happens on idle time.
2014-02-20 22:18:17 +01:00
Michael Brand fb3ecad851 Simplify ERT for TBLFM with sub-total
* testing/lisp/test-org-table.el (test-org-table/sub-total): Simplify
condition in "if".
2014-02-20 08:51:19 +01:00
Michael Brand 54e3009d73 Fix escaping of more links in HTML export
* lisp/org.el (org-link-escape-chars): Extend docstring.
(org-link-escape-chars-browser): Mention in docstring that it will
become a candidate for removal.
(org-link-escape-browser): Mention in docstring that it will become a
candidate for removal.
(org-open-at-point): Move `url-encode-url' and comments into
`org-link-escape-browser'.

* lisp/ox-html.el (org-html-link): Make use of
`org-link-escape-browser' like `org-open-at-point'.

* testing/lisp/test-org.el (test-org/org-link-escape-chars-browser):
Mention in docstring that it will become a candidate for removal.
2014-02-19 20:49:21 +01:00
Nicolas Goaziou 03514a6a78 Merge branch 'maint' 2014-02-17 23:01:40 +01:00
Nicolas Goaziou c5d88fb606 org-element: Fix inlinetask parsing
* lisp/org-element.el (org-element-inlinetask-parser): Fix parsing
  when regular and degenerate inlinetasks are mixed in the section.
* testing/lisp/test-org-element.el (test-org-element/inlinetask-parser):
  Add tests.

Thanks to Anders Johansson for reporting it.
2014-02-17 22:59:25 +01:00
Michael Brand ea4eb4f10f Add ERT for TBLFM with sub-total
* testing/lisp/test-org-table.el (test-org-table/sub-total): Add a use
case of grouped rows with sub-total.
2014-02-16 10:04:46 +01:00
Nicolas Goaziou def5cd8ca5 Merge branch 'maint' 2014-02-07 20:08:29 +01:00
Nicolas Goaziou 7f287d1b62 org-element: Fix indentation normalization
* lisp/org-element.el (org-element-normalize-contents): Do not ignore
  empty lines when an object follows.
* testing/lisp/test-org-element.el (test-org-element/normalize-contents):
  Add test.
2014-02-07 20:06:00 +01:00
Nicolas Goaziou b8665a0190 New function to toggle fixe-width areas
* lisp/org.el (org-toggle-fixed-width): New function.
* testing/lisp/test-org.el (test-org/toggle-fixed-with): New test.

This replaces the old implementation removed in commit
6a00c96541.
2014-02-06 18:55:14 +01:00
Nicolas Richard 5f0ca0ee92 Renaming of ob-sh to ob-shell: various fixes
* lisp/org.el (org-babel-load-languages):
* testing/org-test.el:
* testing/README: change 'sh' to 'shell'

* testing/lisp/test-ob-sh.el: re-rename test file (fixes 80754a8)
2014-02-02 00:08:56 -07:00
Nicolas Goaziou 8f91f657e1 Merge branch 'maint' 2014-02-01 21:54:03 +01:00
Nicolas Goaziou ac2f516edf ob-exp: Do not ignore `org-src-preserve-indentation'
* lisp/ob-exp.el (org-babel-exp-process-buffer): Also check
  `org-src-preserve-indentation' to know when to preserve indentation.
* testing/lisp/test-ob-exp.el (ob-export/export-and-indentation): New
  test.

Thanks to John Hendy for reporting it.
2014-02-01 21:52:43 +01:00
Nicolas Goaziou 98eed5baf9 Merge branch 'maint' 2014-01-29 09:05:44 +01:00
Nicolas Goaziou 63a2a403a9 ob-exp: Fix switches handling upon exporting
* lisp/ob-exp.el (org-babel-exp-code-template): Include switches in
  template.
(org-babel-exp-code): Provide %switches placeholder.
* testing/lisp/test-ob-exp.el (ob-export/export-src-block-with-switches):
  New test.
(ob-export/export-src-block-with-flags): Fix indentation.

This fixes dde6af3a62.  The confusion
came from the fact that "flags" placeholder had two meanings:
the :flags value and the block's switches (e.g., "-n").  This patch
separates these two meanings.
2014-01-29 09:01:43 +01:00
Nicolas Goaziou 6a00c96541 Remove left over references to QUOTE blocks
* lisp/org.el (org-quote-string): Remove variable.
(org-enable-fixed-width-editor, org-context): Update docstring.
(org-toggle-fixed-width-section): Remove function and binding.
(org-set-font-lock-defaults): Remove reference to `org-quote-string'.

* lisp/org-element.el (org-element-headline-parser,
  org-element-headline-interpreter): Remove references to
  `org-quote-string'.

* testing/lisp/test-org-element.el (test-org-element/headline-quote-keyword):
  Remove test.
(test-org-element/headline-interpreter): Remove a test.
2014-01-28 21:36:54 +01:00
Nicolas Goaziou 8a265e2915 org-element: Remove quote sections
* lisp/org-element.el (org-element-quote-section-parser,
  org-element-quote-section-interpreter): Remove functions.
  (org-element--current-element, org-element--parse-elements): Do not
  handle quote sections at all.
* testing/lisp/test-org-element.el (test-org-element/quote-section-parser):
  Remove test.
2014-01-27 21:14:20 +01:00
Nicolas Goaziou 363fd7e8f3 Merge branch 'maint' 2014-01-20 17:26:12 +01:00
Nicolas Goaziou b79462ba98 ob-exp: Fix a failing test
* testing/lisp/test-ob-exp.el (ob-export/export-with-results-before-block):
  Fix a test
2014-01-20 17:25:34 +01:00
Nicolas Goaziou e5617b88cb Merge branch 'maint' 2014-01-20 17:16:32 +01:00
Nicolas Goaziou dde6af3a62 ob-exp: Fix export of src blocks with flags
* lisp/ob-exp.el (org-babel-exp-code): Fix export of src blocks with
  flags.
* testing/lisp/test-ob-exp.el (ob-export/export-src-block-with-flags):
  New test.

Thanks to Giuseppe Lipari for reporting it.
2014-01-20 14:20:06 +01:00
Eric Schulte cd3bc12a29 named and caching call lines working
* lisp/ob-core.el (org-babel-current-result-hash): Additional info
  argument so that named call line results may be found.
  (org-babel-set-current-result-hash): Additional info argument so
  that named call line results may be found.
* lisp/ob-lob.el (org-babel-lob-execute): Passing info to hash finding
  functions so that named results may be found.
2014-01-18 13:40:57 -07:00
Eric Schulte 93d272b449 failing test of named caching call line 2014-01-18 13:40:57 -07:00
Eric Schulte 48c952f23c test of caching call line behavior 2014-01-18 13:40:57 -07:00
Eric Schulte 80754a8591 updated names in test-ob-shell 2014-01-18 13:40:57 -07:00
Eric Schulte 2ebae7bed9 renamed test file for shell code blocks 2014-01-18 13:40:57 -07:00
Nicolas Goaziou c25c80e3f3 Merge branch 'maint' 2014-01-18 15:40:43 +01:00
Nicolas Goaziou 3f9a6916aa ob-exp: Fix code execution in some corner cases
* lisp/ob-exp.el (org-babel-exp-process-buffer): Make processing more
  robust when results are inserted before source block or when source
  block is followed by multiple blank lines.
* testing/lisp/test-ob-exp.el (ob-export/export-with-results-before-block):
  Add test.
2014-01-18 15:32:41 +01:00
Michael Brand bc1d54b84b TBLFM remote ref: Add indirection of name or ID
* doc/org.texi (References): Add description for indirection of
NAME-OR-ID.

* lisp/org-table.el (org-table-eval-formula): Make use of
`org-table-remote-reference-indirection'.
(org-table-remote-reference-indirection): New function.

* testing/lisp/test-org-table.el
(test-org-table/remote-reference-indirect): Change to use remote
reference indirection.
2014-01-12 10:53:06 +01:00
Michael Brand 3ab9b6b37d TBLFM remote ref: Add ERT for summary table
* testing/lisp/test-org-table.el
(test-org-table/remote-reference-indirect): Add a use case of
summarizing two tables with a sum into one table for the total; as a
preparation for remote reference indirection.
2014-01-12 10:51:34 +01:00
Bastien Guerry f8e1745440 Merge branch 'maint'
Conflicts:
	contrib/lisp/org-favtable.el
2014-01-07 14:19:03 +01:00
Bastien Guerry 7d9a883b50 Update copyright years again.
Hint: copyright years are all updated in Emacs.
2014-01-07 14:18:17 +01:00
Nicolas Goaziou d361f465e9 ox: Change meaning of `org-export-with-\(table\|fixed-width\)
* lisp/ox.el (org-export-with-fixed-width, org-export-with-tables):
  Change docstring to reflect new meaning.
(org-export--skip-p): Completely ignore tables and fixed-width areas
if appropriate option is nil.
* testing/lisp/test-ox.el (test-org-export/handle-options): Add tests.
2014-01-05 23:07:13 +01:00
Bastien Guerry c41f5075ac Merge branch 'maint'
Conflicts:
	contrib/lisp/org-favtable.el
2014-01-05 06:36:11 +01:00
Bastien Guerry 0beda99171 Revert "Update copyright years."
This reverts commit 21105594fc.
2014-01-05 06:28:07 +01:00
Bastien Guerry 096ff7e078 Merge branch 'maint'
Conflicts:
	contrib/lisp/org-favtable.el
2014-01-04 18:58:12 +01:00
Bastien Guerry 21105594fc Update copyright years. 2014-01-04 18:56:11 +01:00
Nicolas Goaziou c0aa83bf41 ox: Fix uninterpreted objects in TITLE property
* lisp/ox.el (org-export-remove-uninterpreted-data): Renamed from
  `org-export--remove-uninterpreted'.
(org-export--remove-uninterpreted-data-1): New function.
(org-export-as): Use new function.
* testing/lisp/test-ox.el (test-org-export/uninterpreted): Add test.
2013-12-26 12:26:11 +01:00
Nicolas Goaziou 5b778a6940 ox: Fix ^:{} handling
* lisp/ox.el (org-export--remove-uninterpreted): Fix ^:{} handling.
* testing/lisp/test-ox.el (test-org-export/uninterpreted): Add test.
2013-12-20 21:51:17 +01:00
Eric Schulte 583e7ab175 rename ob-sh to ob-shell 2013-12-13 09:54:28 -07:00
Eric Schulte 20852aa958 need to turn on noweb expansion in test 2013-12-11 07:17:26 -07:00
Eric Schulte 5edf6e103b exercise inclusion of noweb expansions in caches 2013-12-10 00:33:43 -07:00
Eric Schulte ea9d55d8d7 this test should pass with the current code 2013-12-06 12:04:06 -07:00
Nicolas Goaziou 5d359d864f Merge branch 'maint'
Conflicts:
	lisp/ob-exp.el
2013-12-06 16:42:43 +01:00
Nicolas Goaziou ba20e937ae ob-exp: Fix duplicate evaluation with :wrap src
* lisp/ob-exp.el (org-babel-exp-process-buffer): Fix duplicate
  evaluation with :wrap src.
(org-babel-exp-non-block-elements): Removed function.
* testing/lisp/test-ob-lob.el (test-ob-lob/export-lob-lines): Fix test.
2013-12-06 16:40:23 +01:00
Nicolas Goaziou cd439bc513 org-element: Extend `org-element-set-element' to strings
* lisp/org-element.el (org-element-set-element): Allow to replace
  a string with an element, an element with a string, or a string with
  a string.
2013-12-01 17:05:34 +01:00
Nicolas Goaziou 798ad3a27e org-element: Implement `org-element-insert-before'
* lisp/org-element.el (org-element-insert-before): New function.
* testing/lisp/test-org-element.el (test-org-element/insert-before):
  New test.
2013-12-01 17:05:34 +01:00
Nicolas Goaziou b0216248e3 org-element: Implement `org-element-extract-element'
* lisp/org-element.el (org-element-extract-element): New function.
* testing/lisp/test-org-element.el (test-org-element/extract-element):
  New test.
2013-12-01 17:05:34 +01:00
Nicolas Goaziou 0fd4245a43 org-element: Implement `org-element-secondary-p'
* lisp/org-element.el (org-element-secondary-p): New function.
* lisp/ox.el (org-export-get-previous-element,
  org-export-get-next-element): Use new function.
* testing/lisp/test-org-element.el (test-org-element/secondary-p): New
  test.
2013-12-01 17:05:34 +01:00
Achim Gratz 61e8f03364 mk/default.mk, testing/org-test.el: set org-startup-folded to nil
* mk/default.mk (BATCH), testing/org-test.el: Set `org-startup-folded´
  to nil to avoid lots of "OVERVIEW" messages cluttering the output.
2013-11-30 17:02:46 +01:00
Nicolas Goaziou 2b22886005 org-element: Prepare signature change
* lisp/ob-exp.el: Declare signature change.
* lisp/org-macro.el: Declare signature change.
* lisp/org.el (org-backward-element, org-drag-element-backward): Avoid
  using optional argument from `org-element-at-point'.
* testing/lisp/test-org-element.el: Update test.
2013-11-26 18:08:19 +01:00
Achim Gratz 1b0fb1a484 testing: allow to select tests
* mk/default.mk: Add default for new variable BTEST_RE to select all
  tests.  (BTEST_OB_LANGUAGES): Remove sh (always needed, as
  emacs-lisp) and add comment for ruby.  (BTEST): Use BTEST_RE to
  select tests from the test suite.  Reorganize pre-loading of Org,
  Babel, Ox and babel languages into a known clean environment.

* mk/targets.mk (CONF_TEST): Add BTEST_RE to the output of
  config-test.

* testing/org-batch-test-init.el: New file.  Remove all traces of any
  Org built into Emacs or otherwise present in the environment so it
  can not be picked up spuriously during testing or conceal errors in
  the Org version under test.

* testing/org-test.el (org-test-run-batch-tests): Showtest selection
  in messages.  (org-test-run-all-tests): Update ID locations.
2013-11-23 19:29:34 +01:00
Achim Gratz 818c821684 org-test: fix macro definitions so that eager macro expansion doesn't fail
* testing/org-test.el (org-test-with-temp-text,
  org-test-with-temp-text-in-file): Correct quoting of macro
  expansion.

Macro arguments must not be used during macro expansion since they are
not available at that time; conversely, bindings established during
macro expansion generally can not be used at macro execution
time (unless un-quoted during expansion).
2013-11-17 21:31:03 +01:00
Nicolas Goaziou 19d7481665 Change some defcustoms into defconsts
* lisp/org.el (org-clock-string, org-closed-string)
  (org-deadline-string, org-scheduled-string)
  (org-archive-tag, org-comment-string, org-quote-string)
  (org-effort-property, org-latex-regexps): Turn variables into
  constants.
* testing/lisp/test-org-element.el: Update tests.
* testing/lisp/test-ox.el: Update tests.

Also collect all syntax related constants in the same part of the
file.
2013-11-16 21:22:21 +01:00
Nicolas Goaziou fc95ee2768 org-element: Change to timestamp interpreter
* lisp/org-element.el (org-element-timestamp-interpreter):
  Ignore :raw-value and build timestamp from numeric properties
  instead.
* testing/lisp/test-org-element.el: Update tests.
* testing/lisp/test-ox.el: Update tests.

This change allow to modify and update a timestamp easily without
requiring to reset :raw-value first, which was not intuitive.
2013-11-16 10:18:19 +01:00
Michael Brand 77710ec262 Babel: add comments to ERT for reading properties
* testing/examples/babel.org (use case of reading entry properties):
Add comments to function definitions.
2013-11-15 19:20:25 +01:00
Achim Gratz 1c57866a6c test-ob: correct expected default header arguments
* testing/lisp/test-ob.el: The default header arguments have added
  '(hlines . yes)´ in commit c67e3cda15, also add them to the test so
  that the two are consistent again.
2013-11-14 21:21:27 +01:00
Michael Brand 396b2172e4 Improve manual and ERT for table formulas
* doc/org.texi (Field coordinates in formulas): Rephrase and add an
example with a Lisp formula to copy from remote table.
* testing/lisp/test-org-table.el (Comments): Adapt comment.
(test-org-table/copy-field): Add reference to
`test-org-table/remote-reference-access'.
(test-org-table/remote-reference-access): Add reference to
`test-org-table/copy-field'.  Differentiate between Lisp formula to
copy and Calc (or Lisp) formula to calculate.
2013-11-13 20:10:56 +01:00
Nicolas Goaziou f101663489 org-element: Interpret pseudo elements and objects
* lisp/org-element.el (org-element-interpret-data): Change signature.
  One can now define pseudo elements and objects types.
(org-element--interpret-data-1): New function.
* testing/lisp/test-org-element.el: Add tests.
* testing/lisp/test-ox.el: Update tests.

A pseudo element or object is a new element or object type that is
created and treated locally within an export back-end.  The back-end
provides a translator for it and it is ignored when interpreted back
into Org syntax.
2013-11-11 13:16:43 +01:00
Nicolas Goaziou a59ef0e499 Merge branch 'maint' 2013-11-11 01:56:15 +01:00
Nicolas Goaziou 6cc028bf74 ox: Fix next/previous element getters
* lisp/ox.el (org-export-get-previous-element,
  org-export-get-next-element): Fix return value for non plain text
  objects in a secondary string.
* testing/lisp/test-ox.el: Add tests.
2013-11-11 01:54:01 +01:00
Nicolas Goaziou c57372d5fa Merge branch 'maint'
Conflicts:
	testing/lisp/test-org-element.el
2013-11-10 11:47:06 +01:00
Nicolas Goaziou ede82ccf93 org-element: Fix infloops
* lisp/org-element.el (org-element-center-block-parser)
  (org-element-drawer-parser, org-element-dynamic-block-parser)
  (org-element-footnote-definition-parser)
  (org-element-inlinetask-parser, org-element-property-drawer-parser)
  (org-element-quote-block-parser, org-element-comment-block-parser)
  (org-element-diary-sexp-parser, org-element-example-block-parser)
  (org-element-keyword-parser, org-element-latex-environment-parser)
  (org-element-paragraph-parser, org-element-src-block-parser)
  (org-element-table-parser, org-element-verse-block-parser): Fix
  infloop when buffer ends with a non-empty blank line after the
  element.
* testing/lisp/test-org-element.el: Add tests.
2013-11-10 11:28:14 +01:00
Nicolas Goaziou ca100eaa01 Merge branch 'maint' 2013-11-10 10:25:17 +01:00
Nicolas Goaziou 84818415e8 org-element: Fix infloop
* lisp/org-element.el (org-element-comment-parser): Fix infloop when
  a non-empty blank line follows a comment at the end of the buffer.
* testing/lisp/test-org-element.el: Add test.
2013-11-10 10:23:18 +01:00
Achim Gratz 2b25b5d978 test-org-table: Replace hline lhs expression in table formula
* testing/lisp/test-org-table.el: Replace hline lhs expression in table
  formula with relative row expression.

This fixes a test fail introduced by a2c71a6e35.  The failing test
does not check relative hline references, so it should not rely on
undocumented behaviour.
2013-11-07 20:29:02 +01:00
Nicolas Goaziou 28f4b89830 Small refactoring in comment functions
* lisp/org.el (org-insert-comment, org-comment-or-uncomment-region):
  Use `org-element-at-point' instead of `org-in-src-block-p' to check
  if we're within a source block.
* testing/lisp/test-org.el: Add test.
2013-11-04 18:13:55 +01:00
Nicolas Goaziou b96986b81c Merge branch 'maint' 2013-11-03 17:53:11 +01:00
Nicolas Goaziou 757f00811d org-element: Fix error when parsing lowercase keywords
* lisp/org-element.el (org-element-context): Fix error when parsing
  affiliated keywords, e.g. "caption".
* testing/lisp/test-org-element.el: Add test.
2013-11-03 17:51:12 +01:00
Nicolas Goaziou 0cecf32a0a org-element: Implement caching for dynamic parser
* lisp/org-element.el (org-element-use-cache, org-element--cache,
org-element--cache-sync-idle-time,
org-element--cache-merge-changes-threshold, org-element--cache-status,
org-element--cache-opening-line, org-element--cache-closing-line): New
variables.
(org-element-cache-reset, org-element--cache-pending-changes-p,
org-element--cache-push-change, org-element--cache-cancel-changes,
org-element--cache-get-key, org-element-cache-get,
org-element-cache-put, org-element--shift-positions,
org-element--cache-before-change, org-element--cache-record-change,
org-element--cache-sync): New functions.
(org-element-at-point, org-element-context): Use cache when possible.
* lisp/org.el (org-mode, org-set-modules): Reset cache.
* lisp/org-footnote.el (org-footnote-section): Reset cache.
* testing/lisp/test-org-element.el: Update tests.

This patch gives a boost to `org-element-at-point' and, to a lesser
extent, to `org-element-context'.
2013-11-03 13:09:54 +01:00
Nicolas Goaziou b392750108 Prevent flagging drawers in example blocks
* lisp/org.el (org-flag-drawer): Rewrite function using Elements.
  Also prevents flagging drawers within example blocks.
* testing/lisp/test-org.el (test-org/flag-drawer): Add test.
2013-11-02 15:50:29 +01:00
Nicolas Goaziou 6202ec7b3b Remove need to declare drawers before using them
* lisp/org-agenda.el (org-agenda-prepare): Remove reference to
  `org-drawers-for-agenda'.
(org-agenda-show-1): Remove reference to `org-drawers'.
* lisp/org-clock.el (org-clock-remove-empty-clock-drawer,
  org-clock-cancel): Apply signature change to
  `org-remove-empty-drawer-at'.
* lisp/org-element.el (org-element--list-struct): Use
  `org-drawer-regexp' instead of `org-drawers'.
* lisp/org-feed.el (org-feed-drawer): Update docstring according to
  change.
* lisp/org-list.el (org-in-item-p, org-list-context): Use
  `org-drawer-regexp' instead of `org-drawers'.
* lisp/org-mobile.el (org-mobile-create-index-file): Remove reference
  to `org-drawers-for-agenda'.
* lisp/org-pcomplete.el (pcomplete/org-mode/drawer): Remove function.
* lisp/org.el (org-drawer-regexp): Make variable global.
(org-drawers): Remove variable.
(org-set-regexps-and-options): Ignore DRAWER keyword.
(org-cycle): Use `org-drawer-regexp' instead of `org-drawers'.
(org-cycle-hide-drawers): Add an optional argument to ignore some
drawers.
(org-remove-empty-drawer-at): Remove second argument.  Rewrite
function.
(org-clone-subtree-with-time-shift): Apply signature change to
`org-remove-empty-drawer-at'.
(org-toggle-ordered-property): Apply `org-delete-property' signature
change.
(org-map-entries): Remove reference to `org-drawers-for-agenda'.
(org-entry-delete): Remove optional argument.  Small refactoring.
(org-insert-drawer): Remove reference to `org-drawers'.
(org-delete-property): Apply `org-entry-delete' signature change.
(org-in-drawer-p): Rewrite function.
* testing/lisp/test-org-element.el: Update tests.
* testing/lisp/test-org.el: Update tests.
* testing/lisp/test-ox.el: Update tests.
2013-10-31 21:19:40 +01:00
Aaron Ecay cba8718eac Mark some org-babel variables as safe locals under proper conditions
* lisp/ob-core.el (org-babel-inline-result-wrap,
org-babel-default-header-args,
org-babel-default-inline-header-args): mark as safe local variables
2013-10-30 11:23:34 -06:00
Nicolas Goaziou 0be044736c Merge branch 'maint' 2013-10-29 09:57:48 +01:00
Nicolas Goaziou a7e5a74e2c Fix `org-insert-heading' at buffer boundaries
* lisp/org.el (org-insert-heading): Do not error out when inserting is
  to be done at one of the buffer's boundaries.
* testing/lisp/test-org.el: Add tests.
2013-10-29 09:55:01 +01:00
Nicolas Goaziou 73f2ef866d org-element: Small change to src block indentation
* lisp/org-element.el (org-element-remove-indentation): Renamed from
  `org-element--remove-indentation'.
(org-element-example-block-interpreter, org-element-src-block-parser):
Do not depend on `org-src-preserve-indentation'.
(org-element-src-block-interpreter, org-element-example-block-parser):
Check `org-src-preserve-indentation'.
* lisp/ox.el (org-export-unravel-code): Handle
  `org-src-preserve-indentation'.
* testing/lisp/test-org-element.el: Update tests.
2013-10-27 11:06:28 +01:00
Nicolas Goaziou 2668d9e9ce Merge branch 'maint' 2013-10-24 17:22:26 +02:00
Nicolas Goaziou ff172be293 org-element: Use `org-latex-regexps', not `org-format-latex-options'
* lisp/org-element.el (org-element-latex-or-entity-successor,
  org-element-latex-fragment-parser): Use `org-latex-regexps' instead
  of `org-format-latex-options'.
* testing/lisp/test-org-element.el: Fix tests.

`org-latex-regexps' defines the correct syntax for LaTeX code within
an Org buffer.  On the other hand, `org-format-latex-options'
determines which syntax can be previewed within the buffer.
2013-10-24 17:15:23 +02:00
Oleh Krehel a24775dc79 ob-ruby.el: fix result of :results output :session combination.
* lisp/ob-ruby.el (org-babel-ruby-evaluate):
  set conf.echo=false for the duration of evaluation.

* testing/lisp/test-ob-ruby.el (test-ob-ruby/session-output): new test.
2013-10-21 13:09:28 -06:00
Nicolas Goaziou fe27ca9906 org-element: Remove folding status in parsed data
* lisp/org-element.el (org-element-center-block-parser,
  org-element-drawer-parser, org-element-dynamic-block-parser,
  org-element-item-parser, org-element-quote-block-parser,
  org-element-comment-block-parser, org-element-export-block-parser,
  org-element-verse-block-parser, org-element-special-block-parser,
  org-element-example-block-parser, org-element-headline-parser,
  org-element-inlinetask-parser): Remove :hiddenp property.
* lisp/org.el (org-end-of-line, org-down-element): Use an equivalent
  of :hiddenp property.
* testing/lisp/test-org-element.el: Remove tests.

The property is removed because it is buggy (e.g., when there's a link
just after a block opening line) and not really useful.
2013-10-17 22:45:00 +02:00
Michael Brand e04a22ed2d Small improvement of maintainability of link escaping
* lisp/org.el (org-link-escape-chars): Add comment with escape numbers
alphabetically ordered.
(org-link-escape-chars-browser): Add comment with escape numbers.
(org-link-escape): Use better readable char constant instead of number
constant for percent char.
(org-link-escape-browser): New function to substitute duplicate source
code.
(org-open-at-point): Substitute duplicate source code.
* testing/README: Make comment in source code example clearer.
* testing/lisp/test-org.el (test-org/org-link-escape-chars-browser):
Change URL to real use case and use the new function
`org-link-escape-browser'.
2013-10-17 06:59:00 +02:00
Nicolas Goaziou 61e4f1b2c8 Merge branch 'maint' 2013-10-16 13:24:37 +02:00
Nicolas Goaziou b1e7b86fda org-element: Fix block parsing in lists
* lisp/org-element.el (org-element--list-struct): Fix block parsing in
  lists.
* testing/lisp/test-org-element.el: Add test.

Reported-by: Omid <omidlink@gmail.com>
2013-10-16 13:21:42 +02:00
Nicolas Goaziou f37f3596a2 Merge branch 'maint' 2013-10-13 18:21:14 +02:00
Nicolas Goaziou 92c2ccb1fb org-element: Fix interpreter for timestamp with delay
* lisp/org-element.el (org-element-timestamp-interpreter): Correctly
  interpret timestamps with delays.
* testing/lisp/test-org-element.el: Add test.
2013-10-13 18:13:35 +02:00
Nicolas Goaziou fd5a4f7d36 Merge branch 'maint' 2013-10-13 10:20:58 +02:00
Nicolas Goaziou 11514badc1 org-element: Parse warning delays in timestamps
* lisp/org-element.el (org-element-timestamp-parser,
  org-element-timestamp-interpreter): Parse warning delays.
* testing/lisp/test-org-element.el (test-org-element/timestamp): Add
  tests.
2013-10-13 10:17:16 +02:00
Nicolas Goaziou 379e2b1bea Merge branch 'maint' 2013-10-07 19:10:46 +02:00
Nicolas Goaziou 2280ad5eca ox: Fix a test
* testing/lisp/test-ox.el (test-org-export/with-backend): Fix test.
2013-10-07 19:09:55 +02:00
Nicolas Goaziou 21b11071d3 Merge branch 'maint' 2013-10-07 17:06:10 +02:00
Nicolas Goaziou 58b157956c ox: Fix `org-export-with-backend'
* lisp/ox.el (org-export-with-backend): Ensure function will use
  provided back-end.
* testing/lisp/test-ox.el: Add test.
2013-10-07 16:58:20 +02:00
Nicolas Goaziou e09ffe2a67 ox: Add a defcustom to export properties drawers
* lisp/ox.el (org-export-with-drawers): Improve docstring.
(org-export-with-properties): New variable
(org-export--skip-p): Handle new variable.
(org-export-options-alist): Install new variable.
* lisp/ox-ascii.el (org-ascii-node-property,
  org-ascii-property-drawer): New functions.
* lisp/ox-html.el (org-html-node-property): New function.
(org-html-property-drawer): Export property drawers as "pre" blocks.
* lisp/ox-latex.el (org-latex-property-drawer,
  org-latex-node-property): New functions.
* lisp/ox-man.el (org-man-node-property, org-man-property-drawer): New
  functions.
* lisp/ox-md.el (org-md-node-property, org-md-property-drawer): New
  functions.
* lisp/ox-odt.el (org-odt-node-property): New function.
(org-odt-property-drawer): Export property drawers as fixed width
blocks.
* lisp/ox-texinfo.el (org-texinfo-node-property): New function.
(org-texinfo-property-drawer): Export property drawers as verbatim
blocks.
* doc/org.texi: Update manual.
* testing/lisp/test-ox.el: Add tests.
2013-09-26 13:46:31 +02:00
Nicolas Goaziou 7cf4406088 ox: Ignore text before first headline with an :export: tag
* lisp/ox.el (org-export--populate-ignore-list): Ignore text before
  first headline if an :export: tag (or a select tag) is found within
  the buffer.
* testing/lisp/test-ox.el: Add tests.
2013-09-25 18:49:39 +02:00
Nicolas Goaziou 41cf6f2a36 org-element: Fix `org-element-at-point' at end of buffer
* lisp/org-element.el (org-element-at-point): If point is at the end
  of the buffer, and that buffer ends with a list, and there's no
  final newline, return last element in last item instead of plain
  list.
* testing/lisp/test-org-element.el: Add test.

This fix allows to fill correctly the following construct:

 - Item with a very long line ending at the end of buffer.
2013-09-18 21:15:04 +02:00
Nicolas Goaziou 43733e33b1 New functions for paragraph-like navigation
* lisp/org.el (org-forward-paragraph, org-backward-paragraph): New
  functions.
* testing/lisp/test-org.el: Add tests.
2013-09-14 00:23:54 +02:00
Michael Brand 8e07014036 Add ERTs for org-meta-return
* testing/lisp/test-org.el (test-org/meta-return): New `ert-deftest'
to test `org-meta-return'.
2013-09-12 22:57:07 +02:00
Nicolas Goaziou 7b4d8bb614 org-element: Fix footnote definition parsing
* lisp/org-element.el (org-element-footnote-definition-parser): Fix
  value for :contents-begin when first line of footnote definition is
  empty besides the label.
* testing/lisp/test-org-element.el (test-org-element/footnote-definition-parser):
  Add test.
2013-09-11 17:12:26 +02:00
Nicolas Goaziou af9c0fbf91 org-element: Fix bug in `org-element-at-point'
* lisp/org-element.el (org-element-at-point): Return correct element
  when point is on a blank line just below a headline.
* testing/lisp/test-org-element.el: Add test.
2013-09-11 12:22:05 +02:00
Nicolas Goaziou 2e3f5558d7 Do not handle `adaptive-fill-regexp' in comments
* lisp/org.el (org-adaptive-fill-function): Do not handle
  `adaptive-fill-regexp' in comments as the behaviour is not
  satisfying.
* testing/lisp/test-org.el: Remove test.
2013-09-06 12:32:13 +02:00
Nicolas Goaziou 5fdb93eb39 Merge branch 'maint' 2013-09-04 15:26:11 +02:00
Nicolas Goaziou 29c2827469 org-list: Fix list repairing
* lisp/org-list.el (org-list-struct-apply-struct): Do not move item's
  contents within a child above when repairing indentation.
* testing/lisp/test-org-list.el: Add tests.
2013-09-04 15:21:33 +02:00
Nicolas Goaziou 580b7fce95 Merge branch 'maint' 2013-08-31 14:34:37 +02:00
Nicolas Goaziou 22b4473fcc ox: Do not build TOC for headlines below H value
* lisp/ox.el (org-export-collect-headlines): Do not build TOC for
  headlines below H value.
* testing/lisp/test-ox.el: Add test.

Reported-by: Jambunathan K <kjambunathan@gmail.com>
2013-08-31 14:30:25 +02:00
Nicolas Goaziou c33e04dcf2 Merge branch 'maint' 2013-08-30 14:22:07 +02:00
Nicolas Goaziou 026b99ecb8 org-element: Fix parsing error in `org-element-context'
* lisp/org-element.el (org-element-text-markup-successor,
  org-element-latex-or-entity-successor,
  org-element-export-snippet-successor,
  org-element-footnote-reference-successor,
  org-element-inline-babel-call-successor,
  org-element-inline-src-block-successor,
  org-element-line-break-successor, org-element-link-successor,
  org-element-plain-link-successor, org-element-macro-successor,
  org-element-radio-target-successor,
  org-element-statistics-cookie-successor,
  org-element-sub/superscript-successor,
  org-element-table-cell-successor, org-element-target-successor,
  org-element-timestamp-successor): Remove LIMIT argument.
(org-element--parse-objects, org-element--get-next-object-candidates):
Apply signature change to successors.
(org-element-context): Narrow buffer around object containers so
parsing of objects when using this function is done under the same
restrictions as in buffer parsing.
* testing/lisp/test-org-element.el: Add test.
2013-08-30 14:19:30 +02:00
Nicolas Goaziou 54431e2a5b Merge branch 'maint' 2013-08-22 21:55:51 +02:00
Nicolas Goaziou 9e51049b22 Fix filling with `adaptive-fill-regexp'
* lisp/org.el (org-adaptive-fill-function): Look for a fill prefix at
  the beginning of the paragraph and subsquently on its second line
  instead of the current line.
* testing/lisp/test-org.el: Add test
2013-08-22 21:54:52 +02:00
Nicolas Goaziou 6fdc2361c9 ob-core: Fix wrong indentation of results
* lisp/ob-core.el (org-babel-get-src-block-info): Look for indentation
  value at the correct location.
* testing/lisp/test-ob.el: Add test.
2013-08-21 14:16:28 +02:00
Nicolas Goaziou cf8cc35ec5 ox: Fix test errors
* lisp/ox.el (org-export-data-with-backend): Set temporary back-end as
  the new back-end in local communication channel.
(org-export-filter-apply-functions): Handle corner case where back-end
is nil.
* testing/lisp/test-ox.el: Small refactoring.
2013-08-12 10:42:05 +02:00
Nicolas Goaziou 9154c70a04 Export back-ends: Apply changes to export functions
* contrib/lisp/ox-confluence.el (org-confluence-export-as-confluence):
* contrib/lisp/ox-deck.el (org-deck-export-as-html,
  org-deck-export-to-html):
* contrib/lisp/ox-freemind.el (org-freemind-export-to-freemind):
* contrib/lisp/ox-groff.el (org-groff-export-to-groff,
  org-groff-export-to-pdf):
* contrib/lisp/ox-koma-letter.el (org-koma-letter-export-as-latex,
  org-koma-letter-export-to-latex, org-koma-letter-export-to-pdf):
* contrib/lisp/ox-rss.el (org-rss-export-as-rss,
  org-rss-export-to-rss):
* contrib/lisp/ox-s5.el (org-s5-export-as-html,
  org-s5-export-to-html):
* contrib/lisp/ox-taskjuggler.el (org-taskjuggler-export):
* lisp/ob-haskell.el:
* lisp/ox-ascii.el (org-ascii-export-as-ascii,
  org-ascii-export-to-ascii):
* lisp/ox-beamer.el (org-beamer-export-as-latex,
  org-beamer-export-to-latex, org-beamer-export-to-pdf):
* lisp/ox-html.el (org-html-export-as-html, org-html-export-to-html):
* lisp/ox-icalendar.el (org-icalendar-export-to-ics):
* lisp/ox-latex.el (org-latex-export-as-latex,
  org-latex-export-to-pdf):
* lisp/ox-man.el (org-man-export-to-man, org-man-export-to-pdf):
* lisp/ox-md.el (org-md-export-as-markdown,
  org-md-export-to-markdown):
* lisp/ox-odt.el (org-odt-export-to-odt):
* lisp/ox-org.el (org-org-export-as-org, org-org-export-to-org):
* lisp/ox-publish.el (org-publish-org-to):
* lisp/ox-texinfo.el (org-texinfo-export-to-texinfo,
  org-texinfo-export-to-info):
* testing/lisp/test-ob-exp.el (test-ob-exp/org-babel-exp-src-blocks/w-no-file):
2013-08-07 16:11:42 +02:00
Nicolas Goaziou aef1b17773 Merge branch 'maint' 2013-07-28 10:17:17 +02:00
Nicolas Goaziou 36161345d1 Reintroduce support for `adaptive-fill-regexp' in paragraphs and comments
* lisp/org.el (org-adaptive-fill-function, org-fill-paragraph): Add
  support for `adaptive-fill-regexp' in paragraphs and comments.
* testing/lisp/test-org.el: Add tests.
2013-07-28 10:16:03 +02:00
Nicolas Goaziou 908d42c9b6 ox: Multiple options can be set through the same keyword
* lisp/ox.el (org-export--get-inbuffer-options): Multiple options can
  now be set through the same buffer keyword.
* testing/lisp/test-ox.el: Add test.
2013-07-22 15:15:01 +02:00
Nicolas Goaziou 95dd398f6a Merge branch 'maint'
Conflicts:
	testing/lisp/test-org-element.el
2013-07-21 15:54:08 +02:00
Nicolas Goaziou b4a8ec9321 org-element: Fix infloop when parsing a list at the end of buffer
* lisp/org-element.el (org-element-plain-list-parser): Fix infloop
  when parsing a list at the end of buffer, if buffer doesn't end at
  a line beginning.
* testing/lisp/test-org-element.el: Add test.
2013-07-21 15:51:14 +02:00
Nicolas Goaziou 5074999605 Merge branch 'maint' 2013-07-10 14:14:18 +02:00
Nicolas Goaziou 136081a0d4 Use empty commented lines as separators when filling comments
* lisp/org.el (org-fill-paragraph): Use empty commented lines as
  separators when filling comments.  This mimics default behaviour
  from "newcomment.el", which is not used in Org.
* testing/lisp/test-org.el: Add tests.
2013-07-10 14:13:39 +02:00
Nicolas Goaziou d5c11e6b5a Merge branch 'maint' 2013-07-09 13:53:36 +02:00
Nicolas Goaziou c78fa35252 Fix error when filling consecutive comments
* lisp/org.el (org-fill-paragraph): Do not mix consecutive comments
  when filling any of them.
* testing/lisp/test-org.el: Add test.

Thanks to Samuel Wales for reporting it.
2013-07-09 13:52:00 +02:00
Nicolas Goaziou 0bab94dedf Merge branch 'maint' 2013-07-06 00:41:04 +02:00
Nicolas Goaziou 0aa0fdd971 org-element: Fix interpretation of empty items
* lisp/org-element.el (org-element-item-interpreter): This patch fixes
  "(wrong-type-argument arrayp nil)" error when trying to interpret
  empty items.
* testing/lisp/test-org-element.el: Add test.
2013-07-06 00:39:28 +02:00
Nicolas Goaziou acb351444e Merge branch 'maint' 2013-07-05 21:14:43 +02:00
Nicolas Goaziou e5630add27 org-element: Fix "*" itemized plain lists interpretation
* lisp/org-element.el (org-element-item-interpreter): Correctly
  interpret back plain lists with "*" items.  This fixes "This is not
  a list" error returned in this case.
* testing/lisp/test-org-element.el: Add test.
2013-07-05 21:12:47 +02:00
Nicolas Goaziou cea0434c4f ox: Change back-ends internal representation to structures
* lisp/ox.el (org-export--registered-backends): Renamed from
  `org-export-registered-backends'.
(org-export-invisible-backends): Removed variable.
(org-export-get-backend, org-export-get-all-transcoders
org-export-get-all-options, org-export-get-all-filters): New
functions.  It replaces `org-export-backend-translate-table'.
(org-export-barf-if-invalid-backend, org-export-derived-backend-p,
org-export-define-backend, org-export-define-derived-backend):
Rewrite functions using new representation.
(org-export-backend-translate-table): Remove function.
(org-export-get-environment): Use new function.
(org-export--get-subtree-options, org-export--parse-option-keyword,
org-export--get-inbuffer-options, org-export--get-global-options,
org-export-to-buffer org-export-to-file, org-export-string-as
org-export-replace-region-by): Update docstring.
(org-export-data-with-translations): Remove function.  Use
`org-export-data-with-backend' with a temporary back-end instead.
(org-export-data-with-backend, org-export-as): Reflect new definition
for back-ends.
(org-export--dispatch-action, org-export--dispatch-ui): Reflect new
definition for back-ends and variable removal.  Refactoring.
(org-export-filter-apply-functions): Call functions with
current back-end's name, not full back-end.
* lisp/org.el (org-export-backends, org-create-formula--latex-header):
Use new structure and variables.
* testing/lisp/test-ox.el: Update tests.

This patch separates back-end definition from its registration.  Thus,
it allows to use anonymous or unregistered back-ends.
2013-07-04 14:17:49 +02:00
Michael Brand f7e6f1589d Babel: use NAME for src block calls in ERT
* testing/examples/babel.org(use case of reading entry properties):
Adapt to use the new introduced #+NAME for src block calls.
* testing/lisp/test-ob-exp.el(ob-exp/use-case-of-reading-entry-properties):
Adapt to use the new introduced #+NAME for src block calls.
2013-07-01 08:10:11 -06:00
Eric Schulte 22b27789a9 mark a test as expected to fail 2013-06-30 17:53:57 -06:00
Michael Brand b01871f23e Babel: use case of reading entry properties as an ERT
* testing/examples/babel.org: Add test entry for ERT.
* testing/lisp/test-ob-exp.el(ob-exp/use-case-of-reading-entry-properties):
Add expected source block results for ERT.
2013-06-26 11:09:21 -06:00
Eric Schulte 685b296724 evaluate elisp header args at original call site
* lisp/ob-core.el (org-babel-execute-src-block): Ensure that the
  location is set before anything else is done.
* lisp/ob-ref.el (org-babel-ref-parse): Evaluate Emacs Lisp values in
  header arguments at the location of the original code block.
* testing/lisp/test-ob.el (test-ob/location-of-header-arg-eval): Test
  defending the new header argument evaluation behavior.
2013-06-25 09:59:56 -06:00
Nicolas Goaziou acb00702d5 Merge branch 'maint' 2013-06-25 17:38:43 +02:00
Nicolas Goaziou 838e849bf7 org-element: Fix org-meta-return error at the end of buffer
* lisp/org-element.el (org-element--current-element): Fix
  org-meta-return error at the end of buffer.
* testing/lisp/test-org-element.el: Add test.

Thanks to Nicolas Richard for reporting this.
2013-06-25 17:37:48 +02:00
Achim Gratz 36d9a7a4e3 testing: provide tests for header-args[:lang] properties 2013-06-23 19:35:15 +02:00
Nicolas Goaziou 4788a58e71 Merge branch 'maint' 2013-06-18 22:48:08 +02:00
Nicolas Goaziou 60899b1a2f ox: Fix fuzzy link resolution before first headline
* lisp/ox.el (org-export-resolve-fuzzy-link): Fix link resolution when
  link lives before the first headline.
* testing/lisp/test-ox.el: Add test.
2013-06-18 22:29:49 +02:00
Nicolas Goaziou 5e3c3f93bf Merge branch 'maint' 2013-06-17 17:17:24 +02:00
Nicolas Goaziou dffdc499ea org-element: Fix special block parsing
* lisp/org-element.el (org-element-special-block-parser): Fix typo in
  regexp matching block type.  Also quote the type so it can contain
  special characters.
* testing/lisp/test-org-element.el: Add test.
2013-06-17 17:15:55 +02:00
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