mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-08-25 13:02:51 +00:00
org-element-ignored-local-variables: Add missing variables
This fixes ox-hugo bug when Org buffer copy cache is corrupted. * lisp/org-element.el (org-element--cache-variables): Add more state variables. Move above `org-element-ignored-local-variables' definition. (org-element-ignored-local-variables): Make use of the value of `org-element--cache-variables'. * testing/lisp/test-org-element.el (test-org-element/cache-ignored-locals): Add guard against adding new cache state variables that are not listed in `org-element--cache-variables'. Reported-by: George Kettleborough <kettleg@gmail.com> Link: https://orgmode.org/list/41acf96e-8f62-4ed5-9853-b4ff4e0e2fa9@gmail.com
This commit is contained in:
parent
c7db1c0981
commit
9c255cacfe
|
@ -499,14 +499,22 @@ past the brackets."
|
|||
(goto-char end)
|
||||
(buffer-substring-no-properties (1+ pos) (1- end)))))))))
|
||||
|
||||
(defconst org-element--cache-variables
|
||||
'( org-element--cache org-element--cache-size
|
||||
org-element--headline-cache org-element--headline-cache-size
|
||||
org-element--cache-hash-left org-element--cache-hash-right
|
||||
org-element--cache-sync-requests org-element--cache-sync-timer
|
||||
org-element--cache-sync-keys-value org-element--cache-change-tic
|
||||
org-element--cache-last-buffer-size
|
||||
org-element--cache-diagnostics-ring
|
||||
org-element--cache-diagnostics-ring-size
|
||||
org-element--cache-gapless
|
||||
org-element--cache-change-warning)
|
||||
"List of variable symbols holding cache state.")
|
||||
|
||||
(defconst org-element-ignored-local-variables
|
||||
'( org-font-lock-keywords org-element--cache-change-tic
|
||||
org-element--cache-change-tic org-element--cache-size
|
||||
org-element--headline-cache-size
|
||||
org-element--cache-sync-keys-value
|
||||
org-element--cache-change-warning org-element--headline-cache
|
||||
org-element--cache org-element--cache-sync-keys
|
||||
org-element--cache-sync-requests org-element--cache-sync-timer)
|
||||
`( org-font-lock-keywords
|
||||
,@org-element--cache-variables)
|
||||
"List of variables not copied through upon Org buffer duplication.
|
||||
Export process and parsing in `org-element-parse-secondary-string'
|
||||
takes place on a copy of the original buffer. When this copy is
|
||||
|
@ -5791,17 +5799,6 @@ See `org-element--cache-key' for more information.")
|
|||
(defvar-local org-element--cache-last-buffer-size nil
|
||||
"Last value of `buffer-size' for registered changes.")
|
||||
|
||||
(defconst org-element--cache-variables
|
||||
'( org-element--cache org-element--cache-size
|
||||
org-element--headline-cache org-element--headline-cache-size
|
||||
org-element--cache-hash-left org-element--cache-hash-right
|
||||
org-element--cache-sync-requests org-element--cache-sync-timer
|
||||
org-element--cache-sync-keys-value org-element--cache-change-tic
|
||||
org-element--cache-last-buffer-size
|
||||
org-element--cache-gapless
|
||||
org-element--cache-change-warning)
|
||||
"List of variable symbols holding cache state.")
|
||||
|
||||
(defvar org-element--cache-non-modifying-commands
|
||||
'(org-agenda
|
||||
org-agenda-redo
|
||||
|
|
|
@ -5303,6 +5303,31 @@ a
|
|||
:title
|
||||
(org-element-lineage (org-element-at-point) '(headline))))))))
|
||||
|
||||
(ert-deftest test-org-element/cache-ignored-locals ()
|
||||
"Test `org-element-ignored-local-variables' value.
|
||||
Anything holding element cache state must not be copied around
|
||||
buffers, as in `org-element-copy-buffer' or
|
||||
`org-export-copy-buffer'. Otherwise, we may encounter
|
||||
hard-to-debug errors when cache state is either not up-to-date or
|
||||
modified by side effect, influencing the original values."
|
||||
(mapatoms
|
||||
(lambda (var)
|
||||
(when (and (boundp var)
|
||||
(symbol-value var)
|
||||
(string-match-p "^org-element--cache" (symbol-name var))
|
||||
(not (memq var '(org-element--cache-interrupt-C-g-max-count
|
||||
org-element--cache-map-statistics-threshold
|
||||
org-element--cache-variables
|
||||
org-element--cache-interrupt-C-g-count
|
||||
org-element--cache-interrupt-C-g
|
||||
org-element--cache-element-properties
|
||||
org-element--cache-sensitive-re
|
||||
org-element--cache-hash-size
|
||||
org-element--cache-non-modifying-commands
|
||||
org-element--cache-self-verify-frequency
|
||||
org-element--cache-diagnostics-level))))
|
||||
(should (memq var org-element-ignored-local-variables))))))
|
||||
|
||||
(provide 'test-org-element)
|
||||
|
||||
;;; test-org-element.el ends here
|
||||
|
|
Loading…
Reference in a new issue