branch: externals/org
commit 24c4a40f79355371bd1ea4843d86a416d0b6f079
Author: Ihor Radchenko <yanta...@posteo.net>
Commit: Ihor Radchenko <yanta...@posteo.net>

    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 <paulstans...@gmail.com>
    Link: 
https://orgmode.org/list/camjkazy2mt1_neop3ng3uv68372h3rhhu1fcmsgo4xlprqz...@mail.gmail.com
---
 lisp/org-fold-core.el | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lisp/org-fold-core.el b/lisp/org-fold-core.el
index 41b16851f2..38ce531086 100644
--- a/lisp/org-fold-core.el
+++ b/lisp/org-fold-core.el
@@ -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.

Reply via email to