Skip to content

Wrong autocompleted paths when refiling if path contains the dot character #877

@iordanisg

Description

@iordanisg

Describe the bug

If an org path contains the dot character, e.g. /Users/firstname.lastname/org/gtd/inbox.org, trim_common_root returns incorrect refile targets.

Steps to reproduce

  1. Create an org path that contains the dot character
  2. Configure orgmode to use that as an agenda file
  3. Add a task
  4. Try to trigger autocompletion in the refile window

Expected behavior

Autocompleted refile targets are presented correctly.

Emacs functionality

No response

Minimal init.lua

local tmp_dir = vim.env.TMPDIR or vim.env.TMP or vim.env.TEMP or '/tmp'
local nvim_root = tmp_dir .. '/nvim_orgmode'
local lazy_root = nvim_root .. '/lazy'
local lazypath = lazy_root .. '/lazy.nvim'

for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = nvim_root .. "/" .. name
end

-- Install lazy.nvim if not already installed
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    'git',
    'clone',
    '--filter=blob:none',
    'https://github.com/folke/lazy.nvim.git',
    '--branch=stable', -- latest stable release
    lazypath,
  })
end
vim.opt.rtp:prepend(lazypath)

require('lazy').setup({
  {
    'nvim-orgmode/orgmode',
    event = 'VeryLazy',
    ft = { 'org' },
    config = function()
      require('orgmode').setup(
        org_agenda_files = {
          "/Users/firstname.lastname/org/gtd/inbox.org",
        }
      )
    end,
  },
}, {
  root = lazy_root,
  lockfile = nvim_root .. '/lazy.json',
  install = {
    missing = false,
  },
})

require('lazy').sync({
  wait = true,
  show = false,
})

Screenshots and recordings

No response

OS / Distro

macOS 14.7.1

Neovim version/commit

0.10.3

Additional context

No response

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