Absorb overlapping folds in occult-hide-region#6
Merged
Conversation
Previously, collapsing a region that overlapped an existing fold
signaled `user-error ("Region overlaps an existing occult fold")',
which left the user's intent unfulfilled: the selection was ignored
and the prior fold stayed put.
Now `occult-hide-region' iterates the overlapping folds, extends
BEG/END outward to each fold's bounds, deletes them via
`occult--delete-fold', then creates a single new fold at the
possibly-expanded span. The new fold always covers at least the
union of the selection and every absorbed fold, so no hidden content
is lost. Empty/blank-region refusal is unchanged; `occult-toggle'
and the rest of the package are untouched.
- occult.el: rewrite `occult-hide-region' body and docstring.
- test/occult-tests.el: drop the "refuses overlapping regions"
spec; add four specs on `occult-hide-region' covering full
containment, partial overlap at each end, and multiple absorbed
folds; add one spec on `occult-toggle' for the overlapping-region
flow.
- SPEC.md: update the programmatic API description and the
Edge Cases entries for overlapping and nested regions.
- changelog.org: add 1.3.0 entry.
agzam
force-pushed
the
absorb-overlapping-folds
branch
from
April 20, 2026 22:57
a3be287 to
513be09
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, collapsing a region that overlapped an existing fold signaled `user-error ("Region overlaps an existing occult fold")', which left the user's intent unfulfilled: the selection was ignored and the prior fold stayed put.
Now
occult-hide-region' iterates the overlapping folds, extends BEG/END outward to each fold's bounds, deletes them viaoccult--delete-fold', then creates a single new fold at the possibly-expanded span. The new fold always covers at least the union of the selection and every absorbed fold, so no hidden content is lost. Empty/blank-region refusal is unchanged; `occult-toggle' and the rest of the package are untouched.