org-element: Implement lazy cache synchronization
commiteed0500913a3534a32abfd5864cf674d9d0cdf64
authorNicolas Goaziou <n.goaziou@gmail.com>
Fri, 31 Jan 2014 00:14:44 +0000 (31 01:14 +0100)
committerNicolas Goaziou <n.goaziou@gmail.com>
Thu, 20 Feb 2014 21:18:17 +0000 (20 22:18 +0100)
tree5e8070c171ab85db24529ca6078b1419e8173815
parentfb3ecad85102206ad8fcd3e5e311da4ae57054a2
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.
lisp/org-element.el
lisp/ox.el
testing/lisp/test-org-element.el