Skip to content

Absorb overlapping folds in occult-hide-region#6

Merged
agzam merged 1 commit into
mainfrom
absorb-overlapping-folds
Apr 21, 2026
Merged

Absorb overlapping folds in occult-hide-region#6
agzam merged 1 commit into
mainfrom
absorb-overlapping-folds

Conversation

@agzam

@agzam agzam commented Apr 20, 2026

Copy link
Copy Markdown
Owner

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 covering full containment, partial overlap at each end, and multiple absorbed folds.
  • SPEC.md: update the programmatic API description and the Edge Cases entries for overlapping and nested regions.
  • changelog.org: add 1.3.0 entry.

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
agzam force-pushed the absorb-overlapping-folds branch from a3be287 to 513be09 Compare April 20, 2026 22:57
@agzam
agzam merged commit 7400632 into main Apr 21, 2026
4 checks passed
@agzam
agzam deleted the absorb-overlapping-folds branch April 21, 2026 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant