Skip to content

feat: scope sidebar to the narrowed region - #69

Merged
d12frosted merged 1 commit into
masterfrom
feat/narrowing-scoped-backlinks
Aug 25, 2026
Merged

d12frosted merged 1 commit into
masterfrom
feat/narrowing-scoped-backlinks

Conversation

@d12frosted

Copy link
Copy Markdown
Owner

When the note's buffer is narrowed (say org-narrow-to-subtree on one heading of a journal file), the sidebar now follows:

  • The backlinks widget shows only links targeting IDs inside the restriction, and the header count gets a "narrowed" marker so a shorter list reads as scoped, not as missing backlinks.
  • Outline and stats cover only the accessible portion. They sort of did this before (the buffer copy respected narrowing), but only refreshed on edit, and outline positions were offset by the restriction start, so jumping from a narrowed outline landed on the wrong heading. Both are deliberate now: restriction bounds are a memo dependency, so narrow/widen is picked up on the next idle refresh, and outline positions always point into the widened file.
  • The stats link count is filtered by position to match, so chars, words and links all describe the same region.

Narrowing has no change hook in Emacs, so the sidebar notices a narrow or widen on the next idle refresh (or a manual refresh).

The forward links and unlinked mentions widgets stay whole-file for now; scoping them is a possible follow-up if it turns out to be useful.

vulpea-ui-respect-narrowing (default t) turns the whole behaviour off.

Closes #68

When the note's buffer is narrowed (e.g. org-narrow-to-subtree), the
backlinks widget now shows only links targeting IDs inside the
restriction, with a 'narrowed' marker on the header count. Outline and
stats cover only the accessible portion; they used to do this
half-accidentally (the buffer copy respected narrowing) but only
refreshed on edit, and outline positions were offset by the
restriction start, so jumping from a narrowed outline landed on the
wrong heading. Both are deliberate now: restriction bounds are a memo
dependency, so narrow/widen is picked up on the next idle refresh, and
outline positions always point into the widened file.

vulpea-ui-respect-narrowing (default t) turns the behaviour off.
@d12frosted
d12frosted merged commit 737f6cf into master Aug 25, 2026
2 checks passed
@d12frosted
d12frosted deleted the feat/narrowing-scoped-backlinks branch August 25, 2026 10:55
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.

When node is narrowed, only show backlinks of that node

1 participant