nvim-orgmode / nvim-orgmode/orgmode

Refiling ignores preamble export options

Open
#760 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Lua
Stars
3.9k
Forks
190
Avg merge
2d 13h
Merged PRs (30d)
7

Description

Describe the bug

Appreciate the repo, but partially broke after recently updating. Content on the refile location ignores preamble export options, starting only on the first header. Broken by 72d48c6. Possibly related to #729.

Steps to reproduce
  1. Open nvim with included minimal init.lua
  2. Activate capture of test template w/<leader>oce
  3. Close capture w/<C-c>
  4. Open ~/Downloads/test.org
Expected behavior
#+date: 2024/06/22 1:40:29 # <-- Missing lines
                            # <-- Missing lines
* Saturday 06/22/24

** Test

- 
Emacs functionality

No response

Minimal init.lua
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or 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_capture_templates = {
            t = { description = 'Task', template = '* TODO %?\n  %u' },
            e = {
              description = 'Test',
              template =
                 '#+date: %<%Y/%m/%d %H:%M:%S>\n'..
                 '\n'..
                 '* %<%A> %<%m/%d/%y>\n\n'..
                 '** Test\n\n'..
                 '- %?\n',
              target = '~/Downloads/test.org'
             }
           }
         })
      end,
  },
})
Screenshots and recordings

No response

OS / Distro

MacOS 12.7.2

Neovim version/commit

NVIM v0.10.0 Release

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided minimal init.lua and reproduce the capture into ~/Downloads/test.org using the oce flow. Trace the refile handling for the target and preamble export options; done means the generated file retains the preamble lines before the first heading.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua, vim
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.