From 8b73c8b98f4b4240e6342f517624887afa37bab3 Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Sat, 16 Mar 2024 12:23:08 +0300 Subject: [PATCH] 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 Link: https://orgmode.org/list/65f4a408.df0a0220.5debf.2c65@mx.google.com --- lisp/org-fold-core.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/org-fold-core.el b/lisp/org-fold-core.el index be90ca398..d57a80d7c 100644 --- a/lisp/org-fold-core.el +++ b/lisp/org-fold-core.el @@ -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")