ox-md: Generate md links to other Org files

* lisp/ox-md.el (org-md-link): Generate md links to other Org files
  instead of html links.

Thanks to Mark Janssen for suggesting it.
Merge branch 'maint'
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.
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.
Merge branch 'maint'
org-feed.el: Allow current buffer to be indirect

* lisp/org-feed.el (org-feed-alist): Allow current buffer to be an
indirect buffer.
Improve message when file to include is missing

* org.el (org-file-contents): Improve message when linked file does not exist.
Update org-drill to the latest version.
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.
Simplify ERT for TBLFM with sub-total

* testing/lisp/test-org-table.el (test-org-table/sub-total): Simplify
condition in "if".
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.
org-element: Fix cache bug

* lisp/org-element.el (org-element--parse-to): Fix cache parsing when
  the next element to shift is at the contents beginning of its
  parent.  Refactor function.
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.
ox-latex: Support CUSTOM_ID property as label

* lisp/ox-latex.el (org-latex-custom-id-as-label): New variable.
(org-latex-headline): Optionally generate label keys based on
CUSTOM_ID, depending on value of :latex-custom-id-labels option
(org-latex-link): Optionally generate refs based on CUSTOM_ID,
depending on value of :latex-custom-id-labels option.

This change was discussed in the following thread:
http://thread.gmane.org/gmane.emacs.orgmode/82392
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.
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.
Open [[file+emacs:file::options]] links

* lisp/org.el (org-open-at-point): Allow options when using
  applications in links with options.
(org-open-file-with-system, org-open-file-with-emacs): Change
signature to be compatible with `org-open-file'
org-element: Add checks relative to cache

* lisp/org-element.el (org-element--cache-put, org-element-context):
  Check if cache is active before trying to access it.
org-element: Fix parsing of inlinetasks within lists

* lisp/org-element.el (org-element--list-struct): Fix regexp.
Merge branch 'maint'