Skip to content

Fix rough edges in the Asciidoctor integration - #93

Merged
bbatsov merged 5 commits into
masterfrom
fix-asciidoctor-integration
Oct 7, 2026
Merged

bbatsov merged 5 commits into
masterfrom
fix-asciidoctor-integration

Conversation

@bbatsov

@bbatsov bbatsov commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Export errors weren't navigable, a one-off preview left its HTML file next to the document, the auto preview backend chose xwidgets on builds without them, and Flymake flagged every Antora partial$/example$ include as a missing file. It also fixes the Flymake spec that fails on the snapshot build.

The export buffer now has its own compilation mode, rather than adoc-asciidoctor adding the matcher to the global compilation-error-regexp-alist, so a plain M-x compile running asciidoctor still won't navigate its errors. That's the same as before.

On Emacs master, flymake-diagnostic-text joins the diagnostic's origin,
code and message, so a diagnostic with neither starts with spaces and
the parse-output spec failed on the snapshot build. The two-argument
form that picks the parts doesn't exist before Emacs 31, so trim.
adoc-mode added the `asciidoc' matcher to compilation-error-regexp-alist
buffer-locally in the AsciiDoc buffer, but compilation-start doesn't
carry that over, so the `*asciidoctor: ...*' export buffer never matched
a thing. Exports now run in adoc-asciidoctor-compilation-mode, which
sets the alist itself, and the matcher is registered when
adoc-asciidoctor is loaded. It accepts `Line' as well as `line', like
the Flymake regexp.
adoc-preview writes adoc-preview-XXXXXX.html next to the document, so
relative image paths resolve, but only adoc-live-preview-mode installed
the hook that deletes it. A one-off preview left the file in the
source directory for good.

The file is now cleaned up from kill-buffer-hook as soon as it's
created, and from kill-emacs-hook, since buffers aren't killed when
Emacs exits. adoc--preview-file is permanent-local so revert-buffer
doesn't lose track of it.
`auto' chose the xwidget backend whenever xwidget-webkit-browse-url was
fboundp, but that function is autoloaded on every build, so a
graphical Emacs without xwidgets failed with "Your Emacs was not
compiled with xwidgets support". Check (featurep 'xwidget-internal).

The pane also looked for a `*xwidget-webkit*' buffer, a name Emacs 28
and later don't use; use xwidget-webkit-last-session-buffer, and keep
the source window's buffer like the eww backend does.
Asciidoctor resolves `include::partial$snip.adoc[]' and the like as
plain paths, so in an Antora component every such include came back as
an "include file not found" error. Inside a component (antora.yml above
the file) those diagnostics are dropped. They still count towards the
fatal-failure fallback, which would otherwise report the first one.
@bbatsov
bbatsov merged commit 2309bd6 into master Oct 7, 2026
8 checks passed
@bbatsov
bbatsov deleted the fix-asciidoctor-integration branch October 7, 2026 12:44
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