Skip to content

Buffer lookup fails for filenames with special regex characters #1021

@seflue

Description

@seflue

Describe the bug

Buffer lookup functionality fails when file paths contain special regex characters like square brackets [], parentheses (), dots ., and other regex metacharacters.

checkhealth

Orgmode ~

  • ✅ OK Treesitter grammar installed (version 2.0.0)
  • ✅ OK Setup called
  • ✅ OK org_agenda_files configured
  • ✅ OK org_default_notes_file configured

Steps to reproduce

  1. Open an org file with special characters in the filename (e.g., [project].org, test(1).org)
  2. Try to use functionality that requires buffer lookup (e.g. changing todo state, refiling etc.)
  3. The operation fails because the buffer cannot be found

Expected behavior

Buffer lookup should work correctly regardless of special characters in the filename.

Emacs functionality

No response

Minimal init.lua

-- Enter your minimal_init.lua here

Screenshots and recordings

No response

nvim-orgmode version

latest

OS / Distro

Arch Linux

Neovim version/commit

v0.11.3

Additional context

Root cause:

vim.fn.bufnr() patterns are not properly escaped for Vim regex syntax, causing special characters in filenames to be interpreted as regex metacharacters. The bug was introduced in 94886d6.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions