orgmode icon indicating copy to clipboard operation
orgmode copied to clipboard

Date Ranges Seem To Have Stopped Working

Open oncomouse opened this issue 2 years ago • 3 comments

Describe the bug

I feel like this used to work, but items with date ranges composed of two dates connected by two hypens (for instance, <2023-07-11 Tue 09:30>--<2023-07-11 Tue 10:30>) no longer display as a range in agenda mode.

Given the following org file:

* Example Headline
<2023-07-11 Tue 09:30>--<2023-07-11 Tue 10:30>

I see the following item in my agenda:

Tuesday    11 July 2023
  todo:       09:30......  Example Headline

Steps to reproduce

With the above example org file and a minimal config, open agenda mode.

Expected behavior

This is the output I should see on my agenda:

Tuesday    11 July 2023
  todo:       09:30-10:30  Example Headline

Emacs functionality

Emacs displays the range correctly, with a start and a stop time.

Minimal init.lua

-- Set Leader:
vim.g.mapleader = " "
local lazypath = os.getenv("HOME") .. "/.local/share/lazy-org/lazy.nvim"
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({
  root = vim.fn.stdpath("data") .. "/lazy-org",
  dev = {
    path = vim.fn.expand("~/Projects"),
  },
  spec = {
    {
      "nvim-orgmode/orgmode",
      dev = true,
      opts = {},
      config = function(_, opts)
        require("orgmode").setup_ts_grammar()
        require("nvim-treesitter.configs").setup({
          highlight = {
            enable = true,
            additional_vim_regex_highlighting = { "org" },
          },
          ensure_installed = { "org" },
        })
        require("orgmode").setup(opts)
      end,
      dependencies = {
        {
          "nvim-treesitter/nvim-treesitter",
        },
      },
    },
  },
})
-- # vim:ts=2:sw=2:sts=2:expandtab

Screenshots and recordings

No response

OS / Distro

macOS 13.4.1

Neovim version/commit

NVIM v0.10.0-dev-653+gfbeef0d4e

Additional context

I feel like this was working a few weeks ago, but I can't find what commit caused it.

oncomouse avatar Jul 10 '23 15:07 oncomouse

I've done some digging into this. The orgmode spec is vague about whether same-day time ranges are to be used (i.e. a timestamp range of <2023-07-11 Tue 09:30>--<2023-07-11 Tue 10:30> that begins and ends on the same date). In emacs, a same-day time range displays as one would expect on the agenda (i.e. as todo: 09:30-10:30 for the range I described). In nvim orgmode, these are explicitly prevented (because of Date:is_obsolete_range_end and because of the guard here.

The orgmode spec doesn't say anything about how to handle these cases, but in my testing, emacs orgmode will display same-day ranges correctly, but nvim orgmode will not.

This is frustrating because I use beorg to update my agenda on iOS and beorg does all time ranges as two timestamps connected by double hyphens, even if the start and end date are the same.

oncomouse avatar Jul 12 '23 15:07 oncomouse

@oncomouse time range in the same day should be entered like this: <2023-08-24 Thu 17:00-18:00> You can see example in the orgmode docs https://orgmode.org/manual/Timestamps.html#index-timestamp-1

kristijanhusak avatar Aug 24 '23 16:08 kristijanhusak

@kristijanhusak time ranges in the same day can also be entered like this: <2023-08-24 Thu 17:00>--<2023-08-24 Thu 18:00> You can see an example in the orgmode docs right below where you linked: https://orgmode.org/manual/Timestamps.html#index-timerange

The documentation doesn't say you anything about which form is required for same-day time ranges, and as I said in my original bug report, in emacs, <2023-08-24 Thu 17:00-18:00> and <2023-08-24 Thu 17:00>--<2023-08-24 Thu 18:00> both display the same in the agenda, which also indicates that either form is correct for same-day time range.

oncomouse avatar Aug 24 '23 20:08 oncomouse

@oncomouse This issue was addressed in the meantime. Thanks for reporting.

kristijanhusak avatar Feb 27 '24 07:02 kristijanhusak