fix: fall back to /tmp for buffers without a backing file#60
Merged
barrettruth merged 2 commits intomainfrom Mar 13, 2026
Merged
fix: fall back to /tmp for buffers without a backing file#60barrettruth merged 2 commits intomainfrom
barrettruth merged 2 commits intomainfrom
Conversation
Problem: markdown and gfm presets fail when the buffer has no file on
disk (e.g. unnamed buffer with `ft=markdown`, or a named buffer whose
path doesn't exist yet) because `build_context` passes a nonexistent
path to pandoc and `compile` guards reject empty buffer names.
Solution: `build_context` now detects missing files and redirects
`ctx.file` to `/tmp/{bufnr}-{name}`. `compile` writes buffer contents
to that temp path via `vim.fn.writefile` instead of `:silent! update`.
Problem: the unnamed buffer guard tests expected a "no file name"
warning that no longer exists after the tmpfile fallback change.
Solution: update assertions to expect the downstream messages that
unnamed buffers now reach ("no provider configured", "no output file").
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.
Problem
Markdown and gfm presets fail when the buffer has no file on disk (e.g. unnamed buffer with
ft=markdown, or a named buffer whose path doesn't exist yet) becausebuild_contextpasses a nonexistent path to pandoc and the public API guards reject empty buffer names.Solution
build_contextdetects missing files and redirectsctx.fileto/tmp/{bufnr}-{name}.compiler.compilewrites buffer contents to that temp path viavim.fn.writefileinstead of:silent! update. The early-return guards on empty buffer names are removed so unnamed buffers flow through to provider resolution normally.