Skip to content

On org_agenda_custom_commands, cannot use org_agenda_start_on_weekday to start at today #919

Closed
@silvus

Description

@silvus

Describe the bug

It seems there's a problem with org_agenda_start_on_weekday = false, the start day is not today.

Steps to reproduce

With the following org_agenda_custom_commands:

org_agenda_custom_commands = {
	o = {
		description = 'Custom agenda view',
		types = {
			{
				type = 'agenda',
				org_agenda_span = 'week',
				org_agenda_start_on_weekday = false,
				org_agenda_start_day = '-2d',
			},
		}
	},
},

Displayed calendar start at Saturday (Monday (1) - 2 = 6). If I use org_agenda_start_day = '-1d', it's start at Sunday... So it's look like org_agenda_start_on_weekday = false, is ignored.

If I use:

org_agenda_start_on_weekday = 2,
org_agenda_start_day = '+1d',

The agenda start at Wednesday (witch is correct, 2 + 1 = 3 so Wednesday).

Expected behavior

The doc stay this is not normal, the calendar should start 2 days from now (Thursday minus 2 days, so Tuesday):
https://github.com/nvim-orgmode/orgmode/blob/master/doc/orgmode.txt#L688

Example: If org_agenda_start_on_weekday is false, and
org_agenda_start_day is -2d, agenda will always show current week from
today - 2 days

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.uv.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_custom_commands = {
          -- "o" is the shortcut that will be used in the prompt
          o = {
            description = 'Custom agenda view', -- Description shown in the prompt for the shortcut
            types = {
              {
                type = 'agenda',
                org_agenda_span = 'week',
                org_agenda_start_on_weekday = false, -- start at today?
                org_agenda_start_day = '-2d',
              },
            }
          },
        }
      })
    end,
  },
}, {
  root = lazy_root,
  lockfile = nvim_root .. '/lazy.json',
  install = {
    missing = false,
  },
})

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

Screenshots and recordings

Image

nvim-orgmode version

0.5.1

OS / Distro

Debian 12

Neovim version/commit

v0.10.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