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:23:08 +03:00
parent 28dc5dd1ac
commit 8b73c8b98f
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 2 additions and 1 deletions

View File

@ -997,7 +997,8 @@ If SPEC-OR-ALIAS is omitted and FLAG is nil, unfold everything in the region."
(when spec (org-fold-core--check-spec spec))
(with-silent-modifications
(org-with-wide-buffer
(when (eq org-fold-core-style 'overlays) (remove-overlays from to 'invisible spec))
(when (and (eq org-fold-core-style 'overlays) spec)
(remove-overlays from to 'invisible spec))
(if flag
(if (not spec)
(error "Calling `org-fold-core-region' with missing SPEC")