org-fold-core-region: Fix isearch when fold style is overlays

* lisp/org-fold-core.el (org-fold-core--isearch-show): Only delete
overlay, when overlay is supplied.
(org-fold-core-region): Do not use custom "open temporarily" function
for overlay style.

Reported-by: Paul Stansell <paulstansell@gmail.com>
Link: https://orgmode.org/list/CAMJKaZy2Mt1_NeoP3nG3Uv68372H3rHHU1fcmSgO4xLpRQZi5Q@mail.gmail.com
This commit is contained in:
Ihor Radchenko 2024-05-09 11:33:07 +03:00
parent 773bba92a8
commit 24c4a40f79
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 4 additions and 3 deletions

View File

@ -1094,8 +1094,7 @@ If SPEC-OR-ALIAS is omitted and FLAG is nil, unfold everything in the region."
(overlay-put o 'invisible spec)
;; Preserve priority.
(overlay-put o 'priority (length (member spec (org-fold-core-folding-spec-list))))
(overlay-put o 'isearch-open-invisible #'org-fold-core--isearch-show)
(overlay-put o 'isearch-open-invisible-temporary #'org-fold-core--isearch-show-temporary))
(overlay-put o 'isearch-open-invisible #'org-fold-core--isearch-show))
(put-text-property from to (org-fold-core--property-symbol-get-create spec) spec)
(put-text-property from to 'isearch-open-invisible #'org-fold-core--isearch-show)
(put-text-property from to 'isearch-open-invisible-temporary #'org-fold-core--isearch-show-temporary)
@ -1246,7 +1245,9 @@ This function is intended to be used as `isearch-filter-predicate'."
;; FIXME: Reveal the match (usually point, but may sometimes go beyond the region).
(when (< beg (point) end)
(funcall org-fold-core-isearch-open-function (point)))
(org-fold-core-region beg end nil)))
(if (overlayp overlay-or-region)
(delete-overlay overlay-or-region)
(org-fold-core-region beg end nil))))
(defun org-fold-core--isearch-show-temporary (region hide-p)
"Temporarily reveal text in REGION.