Commit Graph

681 Commits

Author SHA1 Message Date
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