Skip to content

Commit

Permalink
org-fold-core: Respect 'ignore-indirect optimization better
Browse files Browse the repository at this point in the history
* lisp/org-fold-core.el (org-fold-core--property-symbol-get-create):
(org-fold-core-decouple-indirect-buffer-folds): Do not try to decouple
folding state in indirect buffers when 'ignore-indirect is requested
in `org-fold-core--optimise-for-huge-buffers'.
  • Loading branch information
yantar92 committed Sep 29, 2022
1 parent 791ea50 commit e9781f1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lisp/org-fold-core.el
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,8 @@ unless RETURN-ONLY is non-nil."
org-fold-core--property-symbol-cache))))
(prog1
local-prop
(unless return-only
(unless (or return-only
(memql 'ignore-indirect org-fold-core--optimise-for-huge-buffers))
(with-current-buffer buf
;; Update folding properties carried over from other
;; buffer (implying that current buffer is indirect
Expand Down Expand Up @@ -623,9 +624,11 @@ unless RETURN-ONLY is non-nil."

(defun org-fold-core-decouple-indirect-buffer-folds ()
"Copy and decouple folding state in a newly created indirect buffer.
This function is mostly indented to be used in `clone-indirect-buffer-hook'."
This function is mostly intended to be used in
`clone-indirect-buffer-hook'."
(when (and (buffer-base-buffer)
(eq org-fold-core-style 'text-properties))
(eq org-fold-core-style 'text-properties)
(not (memql 'ignore-indirect org-fold-core--optimise-for-huge-buffers)))
(org-fold-core--property-symbol-get-create (car (org-fold-core-folding-spec-list)))))

;;; API
Expand Down

0 comments on commit e9781f1

Please sign in to comment.