* 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
* 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.
* 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.
* 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
* 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.
* 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.
* 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.
* 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.
* lisp/org-element.el (org-element--cache-for-removal): Fix corner
case when changes happen in a robust element (e.g., a center block)
within a fragile element (e.g., a plain list). Do not assume that
all parents from a robust element are also robust.
* lisp/org-element.el (org-element--cache-submit-request): Store
parent of first element to delete, if any. This saves a call to
`org-element--cache-find' in a very common use case.
(org-element--cache-sync-requests): Update docstring accordingly.
* lisp/org-element.el (org-element--cache-process-request): Threshold
is based off beginning of the first element to shift instead of the
end of the changes.
* lisp/org-element.el (org-element--cache-submit-request): Do not
trust a stored request after calling `org-element--cache-sync' since
it may as well not exist anymore (i.e., the synchronization was
complete).
* lisp/org-element.el (org-element--cache-submit-request): Fix off by
one error when updating cache. Changes happening at the beginning
to the previous ones, which are always located at the beginning of
an element, imply to delete previous element. Also do not call
`org-element--cache-sync' if there's nothing to synchronize.
* lisp/org-element.el (org-element-inlinetask-parser): Do not infloop
when parsing property drawer in an inlinetask.
* testing/lisp/test-org-element.el (test-org-element/headline-properties):
Add test.
Thanks to Aaron Ecay for reporting it.
http://permalink.gmane.org/gmane.emacs.orgmode/88133
* lisp/org-element.el (org-element--cache-submit-request): Correctly
update cache when changes alter the contents of a greater
element (e.g. a property drawer).
Thanks to Alan Schmitt for reporting it.
http://permalink.gmane.org/gmane.emacs.orgmode/88086
* lisp/org-element.el (org-element-link-parser): Do not prepend "//"
to paths starting with "~".
Since b1dcd0fb0b, link parser doesn't
expand file names anymore. We need to prevent it from "fixing" paths
starting with "~", as it can cause trouble to some
exporters (e.g. latex).
* lisp/org-element.el (org-element-cache-sync-idle-time,
org-element-cache-sync-break): Increase values as synchronizing
cache too makes editing somewhat sluggish without any benefit.
* lisp/org-element.el (org-element--cache-for-removal): New function.
(org-element--cache-submit-request): Do not synchronize cache when
changes can be merged with next request.
This shortcut is particularly useful when many changes happen in the
same area, which is expensive to parse (e.g., a large list).
* lisp/org-element.el (org-element--cache-sync,
org-element--cache-process-request): Change signature.
(org-element--cache-before-change): Do not synchronize cache
preemptively.
(org-element--cache-submit-request): Synchronize cache preemptively.
This change makes possible to skip cache preemptive synchronization
under some circumstances.
* lisp/org-element.el (org-element--cache-sync-requests): Also store
beginning position for buffer modifications.
(org-element--cache-sync, org-element--cache-process-request)
(org-element--cache-submit-request): Adapt to new request template.
This change is required for a future cache optimization.
* lisp/org-element.el (org-element--cache-sync): Do not check return
value from `org-element--cache-process-request'.
(org-element--cache-process-request): Throw `interrupt' when the
request cannot be processed.
(org-element--cache-process-request): Do not catch interruption from
`org-element--parse-to'.
(org-element--parse-to): Throw `interrupt' when the process stops
before finding the result.
* lisp/org-element.el (org-element-headline-parser,
org-element-inlinetask-parser): First find appropriate property
drawer in order to read properties.
* testing/lisp/test-org-element.el (test-org-element/headline-properties):
Add tests.
Thanks to Sébastien Vauban for reporting it.
http://permalink.gmane.org/gmane.emacs.orgmode/87701
* lisp/org-element.el (org-element-link-parser): Do not expand file
name when parsing links so that Tramp doesn't kick in.
Thanks to Sébastien Vauban for reporting it.
http://permalink.gmane.org/gmane.emacs.orgmode/87696
* lisp/org-element.el (org-element--cache-generate-key): Small fix.
Check if UPPER is non nil before comparing its car with 1. This is
a safety feature, though, as a key shouldn't end on 0 anyway.
* lisp/org-element.el (org-element--cache-remove): New function.
(org-element--cache-process-request): Use new function.
(org-element-cache-reset): Do not rely on a weak hash table to handle
objects cache.
Elements used as keys in object cache cannot be garbage collected
since they appear in the :parent hierarchy in objects. Instead we
remove entries from the objects cache whenever an element is removed
from the element cache.
* 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.
* 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.
* lisp/org-element.el (org-element-link-parser): Fix ill-defined
"file" type links. Expand absolute file names in the process.
Org accepts invalid URI syntax for absolute "file" links, e.g.,
file:/home/user/file.txt. This patch normalizes them.
* 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