forked from mirrors/org-mode
org-element-cache: Reduce memory footprint in indirect buffers
* lisp/org-element.el (org-element--cache-setup-change-functions): Set buffer-local cache values to nil in indirect buffers. Reported-by: Sebastian Wålinder <s.walinder@gmail.com> Link: https://orgmode.org/list/87v8funovi.fsf@localhost
This commit is contained in:
parent
34082ff184
commit
2f7b35ac89
|
@ -6767,6 +6767,11 @@ that range. See `after-change-functions' for more information."
|
|||
(defun org-element--cache-setup-change-functions ()
|
||||
"Setup `before-change-functions' and `after-change-functions'."
|
||||
(when (and (derived-mode-p 'org-mode) org-element-use-cache)
|
||||
;; Clear copied local cache to avoid extra memory usage.
|
||||
;; We only use cache stored in the base buffer.
|
||||
(when (buffer-base-buffer)
|
||||
(setq-local org-element--cache nil
|
||||
org-element--headline-cache nil))
|
||||
(add-hook 'before-change-functions
|
||||
#'org-element--cache-before-change nil t)
|
||||
;; Run `org-element--cache-after-change' early to handle cases
|
||||
|
|
Loading…
Reference in New Issue