org-fold-core: Fix bad interaction between fold overlays and isearch
* lisp/org-fold-core.el (org-fold-core-region): (org-fold-core--isearch-show-temporary): Clear/restore folding property in addition to 'invisible property when revealing folds temporarily for the purposes of isearch. This is needed because fold status is determined from that property, not just from 'invisible. The old code sometimes treated temporarily displayed overlays as folded, breaking `org-cycle'.
This commit is contained in:
parent
ba9734aedc
commit
87863b9ec4
|
@ -1070,8 +1070,9 @@ If SPEC-OR-ALIAS is omitted and FLAG is nil, unfold everything in the region."
|
|||
(overlay-get ov 'invisible)
|
||||
(org-fold-core-get-folding-spec-property
|
||||
(overlay-get ov 'invisible) :isearch-open))
|
||||
(when (overlay-get ov 'invisible)
|
||||
(overlay-put ov 'org-invisible (overlay-get ov 'invisible)))
|
||||
(when-let* ((spec (overlay-get ov 'invisible)))
|
||||
(overlay-put ov 'org-invisible spec)
|
||||
(overlay-put ov (org-fold-core--property-symbol-get-create spec) nil))
|
||||
(overlay-put ov 'invisible nil)
|
||||
(when org-fold-core--isearch-active
|
||||
(cl-pushnew ov org-fold-core--isearch-overlays)))))
|
||||
|
@ -1259,8 +1260,9 @@ REGION can also be an overlay in current buffer."
|
|||
(if hide-p
|
||||
(if (not (overlayp region))
|
||||
nil ;; FIXME: after isearch supports text properties.
|
||||
(when (overlay-get region 'org-invisible)
|
||||
(overlay-put region 'invisible (overlay-get region 'org-invisible))))
|
||||
(when-let* ((spec (overlay-get region 'org-invisible)))
|
||||
(overlay-put region 'invisible spec)
|
||||
(overlay-put region (org-fold-core--property-symbol-get-create spec) spec)))
|
||||
;; isearch expects all the temporarily opened overlays to exist.
|
||||
;; See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=60399
|
||||
(org-fold-core--keep-overlays
|
||||
|
|
Loading…
Reference in New Issue