Commit Graph

299 Commits

Author SHA1 Message Date
Nicolas Goaziou 88c18e07db org-element: Fix a code comment
* lisp/org-element.el (org-element-headline-parser): Fix code comment.
2014-01-28 22:14:40 +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 34edfd846f org-element: Preserve Emacs 23 compatibility
* lisp/org-element.el (org-element--cache-mapc): New function.
(org-element--cache-sync): Use new function.

`avl-tree-mapc' exists in Emacs 24's "avl-tree" but not in Emacs
23's. The new function implements it.
2014-01-21 18:17:33 +01:00
Nicolas Goaziou 5f38f7b7b0 org-element: Comply to Emacs 23 signature requirements
* lisp/org-element.el (org-element--cache-sync): Call
  `avl-tree-delete' with 2 arguments only as a 4-arguments call is
  only compatible with Emacs 24.1 and later.
2014-01-20 19:03:50 +01:00
Nicolas Goaziou fd877a7380 org-element: Small optimization
* lisp/org-element.el (org-element-at-point): Do not call
  `outline-next-heading' when an element at top level contains point.
  This is particularly important when the current section ends way
  after the point.
2014-01-19 15:06:09 +01:00
Nicolas Goaziou cad81696b8 Change no brace sub/superscript syntax
* lisp/org.el (org-match-substring-regexp): Simplify syntax when not
using braces.  Also make the variable a defconst.
(org-match-substring-with-braces-regexp): Make the variable a defconst
and remove a useless group in regexp.
* lisp/org-element.el (org-element-subscript-parser,
  org-element-superscript-parser): Adapt to group changes.
2014-01-11 23:54:22 +01:00
Nicolas Goaziou fd5edd35ae org-element: Fix cache bug
* lisp/org-element.el (org-element-cache-get): Return correct cached
  element when point is at the beginning of an item.
2014-01-11 22:31:53 +01:00
Nicolas Goaziou a4b1fa7ca1 org-element: New accessor for cache root
* lisp/org-element.el (org-element--cache-root): New function.
(org-element--cache-sync, org-element-cache-get): Use new function.

This is a workaround for `avl-tree--root' bug before Emacs 24.  Thanks
to Daniel Clemente for reporting it.
2014-01-11 10:12:45 +01:00
Nicolas Goaziou f75f3dd1c1 org-element: Fix `org-element-at-point' at eob
* lisp/org-element.el (org-element-at-point): Return appropriate value
  when point is at end of buffer and a cached element was found above.
2014-01-09 11:55:49 +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 e32ebb6c1a org-element: Change data structure for cache
* lisp/org-element.el (org-element-at-point, org-element-cache-get,
  org-element-cache-put, org-element--cache-sync): Complete rewrite to
  use new data structure.
(org-element-context, org-element-cache-reset): Slight change in order
to use new tools to access cached data.
(org-element-cache-merge-changes-threshold): Renamed from
`org-element--cache-merge-changes-threshold'.
(org-element-cache-sync-idle-time): Renamed from
`org-element--cache-sync-idle-time'.
(org-element--cache-objects): New variable.

Now elements are stored in AVL tree and objects in a hash table.  Also
moved functions relative to cache into a specific section of the file.
2014-01-05 23:08:18 +01:00
Nicolas Goaziou 594b7808a1 org-element: Fix parsing orphaned affiliated keywords
* lisp/org-element.el (org-element-keyword-parser): Fix parsing
  orphaned affiliated keywords.
2014-01-05 23:08:18 +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 ae1cf04833 org-element: Fix `org-element-at-point'
* lisp/org-element.el (org-element-at-point): Fix function when buffer
  starts with a headline.
2013-12-30 17:26:13 +01:00
Nicolas Goaziou 4dbbbe5b01 org-element: Small refactoring
* lisp/org-element.el (org-element-at-point): Refactor code.  Fixing
  structure in cached plain lists is no longer required since
  4423d750a4.
2013-12-30 14:15:11 +01:00
Nicolas Goaziou fde42c5303 org-element: Fix cache when point is at eob
* lisp/org-element.el (org-element-at-point): Fix cache when point is
  at eob and shortcut found something above.
2013-12-30 14:15:11 +01:00
Nicolas Goaziou 405b505c73 org-element: Fix cache update
* lisp/org-element.el (org-element--cache-sync): Fix cache update when
  a only contents of an element are modified.
(org-element--cache-shift-positions): Add optional argument allowing
partial shifting.
2013-12-30 14:15:11 +01:00
Nicolas Goaziou 398dbd91ed org-element: Fix `org-element-at-point' shortcut
* lisp/org-element.el (org-element-at-point): Correctly move from
  blank line to blank line in order to find a known element above.
2013-12-27 15:41:41 +01:00
Nicolas Goaziou 4cb98ed1cd org-element: Fix org-element-insert-before
* lisp/org-element.el (org-element-insert-before): Handle insertion at
  the beginning of a :title property.
2013-12-26 12:26:11 +01:00
Nicolas Goaziou b44fbb920c Merge branch 'maint' 2013-12-16 21:04:57 +01:00
Nicolas Goaziou b22714a88d org-element: Keep compatibility with Babel's regexps
* lisp/org-element.el (org-element-inline-babel-call-successor): Use
  original regexp to stay up-to-date with Babel changes.
2013-12-16 21:00:57 +01:00
Nicolas Goaziou d55f0632b5 Merge branch 'maint' 2013-12-15 16:18:31 +01:00
Nicolas Goaziou f1b9339aa5 org-element: Fix affiliated keyword regexp
* lisp/org-element.el (org-element--affiliated-re): Fix affiliated
  keyword regexp.
2013-12-15 16:16:20 +01:00
Nicolas Goaziou 149eafb487 org-element: Small change to cache optimization
* lisp/org-element.el (org-element-at-point): Simplify opportunistic
  shortcut by looking only for blank lines and headlines or
  inlinetasks.  Since regexp is simpler, we can afford to make more
  searches.
2013-12-12 23:49:49 +01:00
Nicolas Goaziou 4423d750a4 org-element: Fix holes in cache
* lisp/org-element.el (org-element--cache-stable-types): New variable.
(org-element--cache-sync): Do not store elements with missing parents
in cache.

The bug was introduced in 71c8474ae9.
Parsing doesn't always start from beginning of section, which means
that missing parents aren't always repaired while moving to the
current element.  Therefore, we need to remove any element from cache
with an invalid parent property.
2013-12-12 23:04:29 +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
Nicolas Goaziou 5a2dabc21b org-element: Optimize parser only when cache is active
* lisp/org-element.el (org-element-at-point): Try opportunistic
  shortcut only when cache is active.
2013-11-26 23:51:26 +01:00
Nicolas Goaziou 71c8474ae9 org-element: Speed-up for `org-element-at-point'
* lisp/org-element.el (org-element-at-point): Rewrite function. Remove
  optional argument.

Include an opportunistic search at the beginning of the function.  It
drastically improves speed on large sections for a small overhead on
small ones.
2013-11-26 18:18:33 +01:00
Nicolas Goaziou a9eec72ecf Merge branch 'maint' 2013-11-25 23:36:38 +01:00
Nicolas Goaziou 7bee47120b org-element: Update paragraph separate regexp
* lisp/org-element.el (org-element-paragraph-separate): More accurate
  regexp.
2013-11-25 23:19:48 +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
Nicolas Goaziou 926bc85861 org-element: Rename a function
* lisp/org-element.el (org-element--cache-shift-positions): Renamed
  from `org-element--shift-positions'.
(org-element--cache-sync): Apply renaming.
2013-11-16 09:53:10 +01:00
Nicolas Goaziou 4466af5c11 org-element: Fix commit 73d60606bd
* lisp/org-element.el (org-element--cache-sync): Fix commit
  73d60606bd.
2013-11-16 00:33:30 +01:00
Nicolas Goaziou 73d60606bd org-element: Fix cache bug
* lisp/org-element.el (org-element--cache-sync): Properly remove from
  cache last element in a plain list when blank lines at the end of
  that list are modified.
2013-11-15 23:46:45 +01:00
Nicolas Goaziou 91c1718519 org-element: Fix cache corruption when moving list
* lisp/org-element.el (org-element--shift-positions): Fix cache
  corruption when moving list.
2013-11-15 23:10:41 +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 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
Nicolas Goaziou 0656278de4 Merge branch 'maint' 2013-11-06 19:17:39 +01:00
Nicolas Goaziou 92f89eedba ox-org: Fix headline level during subtree export
* lisp/org-element.el (org-element-headline-interpreter): Take into
  consideration `org-odd-levels-only' when building a headline.
* lisp/ox-org.el (org-org-headline): Correctly set transcoded headline
  level during subtree export.
2013-11-06 19:14:14 +01:00
Nicolas Goaziou 8403332dbc org-element: Fix bug in cache
* lisp/org-element.el (org-element--cache-sync): Modifying blank lines
  at the end of a list or a footnote definition no longer corrupt
  cache.
2013-11-04 19:28:07 +01:00
Nicolas Goaziou 8255286e22 org-element: Small refactoring
* lisp/org-element.el (org-element-item-parser,
  org-element-plain-list-parser): Remove dependencies on org-list
  library.
2013-11-04 18:16:28 +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 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
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
Nicolas Goaziou e9647da101 org-element: Do not retrieve Babel related info
* lisp/org-element.el (org-element-babel-call-parser,
  org-element-inline-babel-call-parser): Do not call
  `org-babel-lob-get-info' since it is out of parser's scope.
(org-element-babel-call-interpreter,
org-element-inline-babel-call-interpreter): Apply changes to parsers.
2013-10-20 13:38:30 +02: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
Nicolas Goaziou 5394f15e51 org-element: Use `org-match-string-no-properties'.
* lisp/org-element.el (org-element--list-struct): Use
  `org-match-string-no-properties'.
2013-10-16 21:26:19 +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 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 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 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 072f2abe4c org-element: Fix infloop in `org-element-at-point'
* lisp/org-element.el (org-element-at-point): Fix infloop when called
  on a blank line at the end of the buffer after a headline.
2013-09-17 22:36:09 +02:00
Nicolas Goaziou 29c33591a2 org-element: Fix af9c0fbf91
* lisp/org-element.el (org-element-at-point): Fix commit
  af9c0fbf91.
2013-09-11 18:23:16 +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 a031a4b75b org-element: Fix d003d56eaf
* lisp/org-element.el (org-element-paragraph-parser): Use
  `org-match-string-no-properties'.
2013-09-08 23:50:53 +02:00
Nicolas Goaziou d003d56eaf org-element: Fix paragraph parsing
* lisp/org-element.el (org-element-paragraph-parser): Small fixes to
  paragraph parsing.
2013-09-08 23:24:42 +02:00
Nicolas Goaziou 81626dcc15 Merge branch 'maint' 2013-08-30 14:38:03 +02:00
Nicolas Goaziou cb35032641 org-element: Modify misleading comment
* lisp/org-element.el (org-element-context): Modify misleading
  comment.
2013-08-30 14:37:16 +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 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 17b584df89 Merge branch 'maint' 2013-07-20 13:53:35 +02:00
Nicolas Goaziou 21dd83661b org-element: Do not url-decode parsed links
* lisp/org-element.el (org-element-link-parser): Do not url-decode
  parsed links.

The function now assumes link at point is correctly encoded if needed.
`org-insert-link' already automatically url-encode generated links,
and link types not handled by this function (e.g., custom-id links) do
not need such encoding.
2013-07-20 13:51:18 +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 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
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 3c933adaf6 org.el: improve org-property-re and use it throughout
* lisp/org.el (org-property-re): Improve definition so that this regex
  can be used in all situations.  Extend docstring with explanation of
  matching groups.
  (org-at-property-p): Implement using `org-element-at-point'.
  (org-entry-properties, org-buffer-property-keys, org-indent-line):
  Use `org-property-re' and adjust match group numbers accordingly.

* lisp/org-element.el (org-element-node-property-parser): Use
  `org-property-re' and adjust match group numbers accordingly.  Move
  `looking-at' out of the let clause to not rely on the unspecified
  evaluation order inside the let.
2013-06-08 21:38:24 +02: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
Nicolas Goaziou ca99372d83 org-element: Use internal version of `org-list-struct'
* lisp/org-element.el (org-element--list-struct): New function.
(org-element-plain-list-parser, org-element--current-element): Use new
function.

This patch removes dependency on org-list.el to parsing lists. For
now, it leads to code duplication, but, ultimately (i.e., when parsing
will be faster), org-list.el will delegate the parsing job to
org-element. The new implementation is also faster than the previous one.
2013-05-31 20:14:02 +02:00
Nicolas Goaziou 206762bd34 org-element: Small optimization
* lisp/org-element.el (org-element--remove-indentation): Small
  optimization.
2013-05-25 22:02:26 +02:00
Nicolas Goaziou 10169054eb org-element: Fix a docstring
* lisp/org-element.el (org-element--remove-indentation): Fix
  docstring.
2013-05-25 17:08: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 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 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
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
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 6ce2b72c9f org-element: Parse table cells with missing ending space
* lisp/org-element.el (org-element-table-cell-successor): Parse table
  cells with missing ending space.
2013-04-09 16:17:08 +02:00
Bastien Guerry 78959943e2 Merge branch 'master-group-tags2' 2013-03-25 06:59:23 +01:00