org-fold-core-region: Fix removing non-fold overlays

* lisp/org-fold-core.el (org-fold-core-region): Do not clear all the
overlays in region when unfolding and when SPEC-OR-ALIAS is nil.

Reported-by: Bruno Barbier <brubar.cs@gmail.com>
Link: https://orgmode.org/list/65f4a408.df0a0220.5debf.2c65@mx.google.com
This commit is contained in:
Ihor Radchenko 2024-03-16 12:26:00 +03:00
parent 9f4064e68e
commit 712ef988c3
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 3 additions and 2 deletions

View File

@ -1071,8 +1071,9 @@ If SPEC-OR-ALIAS is omitted and FLAG is nil, unfold everything in the region."
(when org-fold-core--isearch-active
(cl-pushnew ov org-fold-core--isearch-overlays)))))
(overlays-in from to))
(remove-overlays from to 'org-invisible spec)
(remove-overlays from to 'invisible spec)))
(when spec
(remove-overlays from to 'org-invisible spec)
(remove-overlays from to 'invisible spec))))
(if flag
(if (not spec)
(error "Calling `org-fold-core-region' with missing SPEC")