Skip to content

Find Antora cross-references project-wide#84

Merged
bbatsov merged 1 commit into
masterfrom
antora-xref-references
Jun 5, 2026
Merged

Find Antora cross-references project-wide#84
bbatsov merged 1 commit into
masterfrom
antora-xref-references

Conversation

@bbatsov

@bbatsov bbatsov commented Jun 5, 2026

Copy link
Copy Markdown
Owner

Phase 2c of the Antora/xref work, completing the cross-file story.

In an Antora component, M-? (xref-find-references) on an id now searches the whole component rather than just the current buffer. So you see every cross-page reference - xref:this/page.adoc#id[] from other pages, including module:-qualified forms - alongside the same-page <<id>> / xref:id[] usages. Outside a component it stays in-buffer as before.

It's built on Emacs' own xref-matches-in-directory (grep). The match regexp distinguishes by page+fragment, so a same-id-but-different-page reference isn't a false positive, and prefix collisions (foo vs foobar) are excluded.

Notably I tested this against both BSD grep (my machine) and GNU grep 3.12 (the CI/Linux flavor) - an earlier version used a shy group that BSD grep tolerated but GNU grep rejects, which would have broken M-? on CI; the committed regexp is a flat alternation that both accept.

That wraps up Phase 2 (Antora xref: following, completion, references). Next: paste-image-from-clipboard.

  • The commits are consistent with our contribution guidelines
  • You've added tests (if possible) to cover your change(s)
  • All tests are passing (eldev test)
  • The new code is not generating bytecode or M-x checkdoc warnings
  • You've updated the changelog (if adding/changing user-visible functionality)
  • You've updated the readme (if adding/changing user-visible functionality)

In an Antora component, M-? (xref-find-references) on an id now greps the
whole component instead of only the current buffer, so cross-page
references - xref:this/page.adoc#id[] from other pages, including
module:-qualified forms - show up alongside the same-page <<id>> /
xref:id[] usages. Outside a component the search stays in-buffer.

Built on xref-matches-in-directory; the match regexp is a flat
alternation (no shy group) so grep -E accepts it under GNU grep too.

Phase 2c of the Antora/xref work.
@bbatsov bbatsov merged commit b6f0205 into master Jun 5, 2026
8 checks passed
@bbatsov bbatsov deleted the antora-xref-references branch June 5, 2026 19:46
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