fix(OrgCache): Cache miss failure on buffers with loaded org files#1121
Open
dtvillafana wants to merge 1 commit intonvim-orgmode:masterfrom
Open
fix(OrgCache): Cache miss failure on buffers with loaded org files#1121dtvillafana wants to merge 1 commit intonvim-orgmode:masterfrom
dtvillafana wants to merge 1 commit intonvim-orgmode:masterfrom
Conversation
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.
Summary
Org buffers opened via BufRead were not added to orgmode’s buffer cache. For .org files, OrgBuffers.get_buffer_by_filename() only consulted that cache and skipped the bufnr() fallback, so a command like 'cit' on a header could fail with “No valid buffer for file” even when the file was loaded.
This fixes the issue in two places: org buffers are now registered on both BufNew and BufRead, and get_buffer_by_filename() now falls back to vim.fn.bufnr() for org files as well. That makes loaded org buffers resolvable even if the cache misses them.
The reason this could be an issue (and was for me) is that restoring a session did not trigger BufNew, and even when I closed the buffer with the org file, and re-opened it, it still was not added to the cache.
to verify this issue, I ran the following on the buffer:
and got the following results
Closes #
Should I create a corresponding issue?
Checklist
I confirm that I have:
Conventional Commits
specification (e.g.,
feat: add new feature,fix: correct bug,docs: update documentation).make test. (tests fail on my NixOS machine)