Skip to content

fix: degrade BufModifiedSet autocmd gracefully when event is unavailable - #31

Merged
pablopunk merged 1 commit into
mainfrom
fix/bufmodifiedset-pcall
Jun 28, 2026
Merged

pablopunk merged 1 commit into
mainfrom
fix/bufmodifiedset-pcall

Conversation

@pablopunk

@pablopunk pablopunk commented Jun 28, 2026

Copy link
Copy Markdown
Owner

The BufModifiedSet event doesn't exist in all Neovim builds (missing from some 0.13.0-dev builds, and all versions before 0.10). This wraps the autocmd creation in pcall so the plugin loads without errors, silently degrading — the BufWritePost handler already covers keeping modified buffers in the tabline.

Summary by CodeRabbit

  • Bug Fixes
    • Improved compatibility in environments where a buffer-modified event is unavailable.
    • The feature now fails gracefully without showing errors, so the app continues to work normally in more setups.

@codesandbox

codesandbox Bot commented Jun 28, 2026

Copy link
Copy Markdown

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@pablopunk
pablopunk merged commit a531ee7 into main Jun 28, 2026
4 of 9 checks passed
@pablopunk
pablopunk deleted the fix/bufmodifiedset-pcall branch June 28, 2026 19:39
@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b73a1419-21f2-46e8-ac24-6a8f5bc45230

📥 Commits

Reviewing files that changed from the base of the PR and between ff0099a and d9cb545.

📒 Files selected for processing (1)
  • lua/unclutter/autocmds.lua

Walkthrough

In lua/unclutter/autocmds.lua, the autocmds.on_buf_modified_set function is updated to wrap the vim.api.nvim_create_autocmd call in pcall. This change prevents errors in environments where the BufModifiedSet event does not exist, silently ignoring the failure. The surrounding comments are updated to document this fallback behavior.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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