org-element: Fix buffer positions when merging requests

* lisp/org-element.el (org-element--cache-submit-request): Correctly
  compute buffer positions where cache is missing, taking into account
  the request not yet applied.
org-element: Reach orphaned elements during cache sync

* lisp/org-element.el (org-element--cache-sync-requests): Change
  pattern.
(org-element--cache-sync, org-element--cache-submit-request): Update
request pattern.
(org-element--cache-process-request): Remove orphaned elements during
first phase.

An orphaned element is an element not directly altered by changes to
buffer but with one of its parent removed.
org-element: Remove :inline-definition from inline footnotes

* lisp/org-element.el (org-element-recursive-objects): Add
  `footnote-reference'.
(org-element-secondary-value-alist): Remove reference to
`footnote-reference'.
(org-element-footnote-reference-parser): Definition for inline
references is stored as the contents of the reference, not in
a secondary string.
(org-element-footnote-reference-interpreter): Apply changes from
parser.

* lisp/ox.el (org-export-get-footnote-definition,
  org-export-get-environment): Apply changes from parser.

* testing/lisp/test-org-element.el (test-org-element/footnote-reference-parser):
  Update test.
(test-org-element/context): Add test.

Storing definition in a secondary string was a poor design choice as
there is no "primary" string anyway.  This also prevents
`org-element-context' from finding objects within the inline
definition.
org-element: Fix docstring

* lisp/org-element.el (org-element-footnote-reference-interpreter):
  Fix docstring.
org-element: Small optimizations

* lisp/org-element.el (org-element-latex-fragment-parser): Avoid
  matching twice regexps in some cases.
(org-element--object-lex): Avoid making a funcall if a line break
isn't possible.

This patch also removes the limit on the number of lines a latex
fragment with a single dollar can span over.
org-element: Avoid using a slow regexp

* lisp/org-element.el (org-element-latex-fragment-parser): Avoid using
  a slow regexp.
contrib/lisp/org-contacts.el: Complete contacts using tags and properties

* contrib/lisp/org-contacts.el (org-contacts-complete-tags-props): New
function that allows the user to retrieve contacts based on tags and
properties.

(org-contacts-complete-functions): Add
org-contacts-complete-tags-props to the completion functions.

(org-contacts-tags-props-prefix): Prefix used to detect the
completion method wished.

Based on the idea and implementation of John Kitchin
contrib/lisp/org-contacts.el: Fix a bug when contacts don't have an email address

* contrib/lisp/org-contacts.el (org-contacts-complete-tags-props,
org-contacts-complete-group): Fix a bug when contacts don't have an
email address.
ox: Fix inline footnote definitions

* lisp/ox.el (org-export-collect-tree-properties): Make sure changes
  to the parse tree propagate to the value of
  `org-export-get-footnote-definition'.

Thanks to Florian Beck for reporting it.
http://permalink.gmane.org/gmane.emacs.orgmode/88419
org-element: Fix "wrong-type-argument" error in cache

* lisp/org-element.el (org-element--cache-sync): Do not copy phase
  number into next request.  This is a special case that deserves to
  be handled locally.  See below.
(org-element--cache-process-request): Properly transfer phase in
a special case, which is now commented.  Also fix phase numbers in
comments.  Small refactoring.

Thanks to Alan Schmitt for reporting it.
http://permalink.gmane.org/gmane.emacs.orgmode/88406
org-element: Fix corner case in cache synchronization

* lisp/org-element.el (org-element--cache-submit-request): When
  changes happen before first know element, start from phase 1 instead
  of phase 2 in order to properly re-parent subsequent elements, if
  needed.
(org-element--cache-process-request): Do not propagate beginning
position since it is already available to the request.
org-element: Fix re-parenting during cache synchronization

* lisp/org-element.el (org-element--cache-process-request): Correctly
  re-parent elements in cache in some corner cases.
* testing/lisp/test-org-element.el (test-org-element/cache): Add tests.
org-clean-before-export matches non-special columns spuriously

* org-table.el (org-table-clean-before-export): The regexes match
  spaces in addition to the special characters that might be used in
  the first column as special marking characters.  Remove the space
  from the character class.

  In addition, the `special' variable included a backslash which
  afaict does nothing: delete it.

  The function itself takes an optional parameter which is not used by
  any of the callers: get rid of it.  Getting rid of it allows a small
  simplification of the code.

The bug was found by Thorsten Grothe:

    http://thread.gmane.org/gmane.emacs.orgmode/88634
Merge branch 'maint'

Merge bug fix for org-table.el:org-table-clean-before-export.
org-element: Better collision handling in cache sync requests

* lisp/org-element.el (org-element--cache-process-request): Handle
  cases where procesing the first request brings us past the start of
  the next one.
org-element: Fix infloop in cache

* lisp/org-element.el (org-element--cache-process-request): Take into
  consideration changes to come so as to avoid parsing elements with
  false beginning positions.
(org-element--cache-sync): Change signature.

Thanks to Thorsten Jolitz for reporting it.
http://permalink.gmane.org/gmane.emacs.orgmode/88673
org-element: Small optimization

* lisp/org-element.el (org-element--cache-for-removal): Do not remove
a robust element whenever only its contents are modified.  Remove
inlinetasks as robust elements since modifying a node property inside
implies to parse the task again.