Skip to content

Error after new capture on Windows #1068

@OmadaCast

Description

@OmadaCast

Describe the bug

I am experiencing this bug on Windows using Neovim 0.11.2.

Error:
When I do :Org capture and save the buffer that opens, I get the following error:

E5108: Error executing lua: ...ocal/nvim-data/lazy/orgmode/lua/orgmode/capture/init.lua:203: Invalid buffer id: -1
stack traceback:
        [C]: in function 'nvim_buf_set_lines'
        ...ocal/nvim-data/lazy/orgmode/lua/orgmode/capture/init.lua:203: in function 'action'
        .../Local/nvim-data/lazy/orgmode/lua/orgmode/files/file.lua:128: in function 'update'
        .../Local/nvim-data/lazy/orgmode/lua/orgmode/files/file.lua:138: in function 'update_sync'
        ...ocal/nvim-data/lazy/orgmode/lua/orgmode/capture/init.lua:194: in function '_refile_from_capture_buffer'
        ...ocal/nvim-data/lazy/orgmode/lua/orgmode/capture/init.lua:130: in function <...ocal/nvim-data/lazy/orgmode/lua/orgmode/capture/init.lua:123>

checkhealth

===========================================================================
orgmode: ✅

Orgmode ~

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

Steps to reproduce

Reproduction:

  1. Go to any buffer
  2. Run :Org capture
  • Select 't' for task
  1. Fill in any information (or don't)
  2. Save with <C-c>
  3. Error occurs (See error)
  4. Empty buffer opens in the bottom right corner
  • This is focused after removing the error

Note: If I write something to the empty buffer (Last screenshot), the content is saved to the captured file. If I leave it empty, nothing is saved.

Expected behavior

The capture should be saved without throwing an error. Also through org-roam.

Emacs functionality

No response

Minimal init.lua

It works perfectly fine on MacOS, but throws an error on Windows.

  {
    'nvim-orgmode/orgmode',
    tag = "0.7.0",
    event = 'VeryLazy',
    ft = { 'org' },
    dependencies = {
      'akinsho/org-bullets.nvim',
      'danilshvalov/org-modern.nvim',
      {
          "lukas-reineke/headlines.nvim",
          dependencies = "nvim-treesitter/nvim-treesitter",
          opts = {}
      },
      {
        "chipsenkbeil/org-roam.nvim",
        tag = "0.2.0",
      }
    },
    config = function()
      local notesHomePath = "~/org-roam"
      local isWindows = vim.loop.os_uname().sysname == "Windows_NT"
      local defaultNotesFile = '/index.org'
      local orgAgendaFiles = '/**/*'
      if isWindows then
        require('orgmode.utils.treesitter.install').compilers = { 'gcc' }
      end

      -- Setup orgmode
      require('orgmode').setup({
        org_agenda_files = notesHomePath .. orgAgendaFiles,
        org_default_notes_file = notesHomePath .. defaultNotesFile,
        ui = {
          menu = {
            handler = function(data)
              require("org-modern.menu"):new({
                window = {
                  margin = { 1, 0, 1, 0 },
                  padding = { 0, 1, 0, 1 },
                  title_pos = "center",
                  border = "single",
                  zindex = 1000,
                },
                icons = {
                  separator = "",
                },
              }):open(data)
            end,
          },
        },
      })

      require('org-bullets').setup()

      require("org-roam").setup({
        directory = notesHomePath,
      })
    end,
  }

Screenshots and recordings

Image Image Image

nvim-orgmode version

0.7.0

OS / Distro

Windows 11

Neovim version/commit

0.11.2

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